Skip to content

Commit

Permalink
fix api generate command template
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Jan 14, 2015
1 parent ccd21d3 commit cc3adea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
6 changes: 4 additions & 2 deletions library/PSX/Console/Generate/ApiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ protected function getControllerSource(ServiceDefinition $definition)
namespace {$namespace};
use PSX\Controller\SchemaApiAbstract;
use PSX\Api\Documentation;
use PSX\Api\Version;
use PSX\Api\View;
use PSX\Controller\SchemaApiAbstract;
use PSX\Data\RecordInterface;
/**
* {$className}
Expand All @@ -123,7 +125,7 @@ class {$className} extends SchemaApiAbstract
public function getDocumentation()
{
\$view = new View();
\$view->setGet(\$this->schemaManager->get('{$namespace}\Schema\GetResponse'));
\$view->setGet(\$this->schemaManager->getSchema('{$namespace}\Schema\Collection'));
return new Documentation\Simple(\$view);
}
Expand Down
18 changes: 12 additions & 6 deletions tests/PSX/Console/Generate/ApiCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ protected function getExpectedSource()
namespace Acme\Foo;
use PSX\Controller\SchemaApiAbstract;
use PSX\Api\Documentation;
use PSX\Api\Version;
use PSX\Api\View;
use PSX\Controller\SchemaApiAbstract;
use PSX\Data\RecordInterface;
/**
* Bar
Expand All @@ -199,7 +201,7 @@ class Bar extends SchemaApiAbstract
public function getDocumentation()
{
$view = new View();
$view->setGet($this->schemaManager->get('Acme\Foo\Schema\GetResponse'));
$view->setGet($this->schemaManager->getSchema('Acme\Foo\Schema\Collection'));
return new Documentation\Simple($view);
}
Expand Down Expand Up @@ -261,9 +263,11 @@ protected function getExpectedOtherDiSource()
namespace Acme\Foo;
use PSX\Controller\SchemaApiAbstract;
use PSX\Api\Documentation;
use PSX\Api\Version;
use PSX\Api\View;
use PSX\Controller\SchemaApiAbstract;
use PSX\Data\RecordInterface;
/**
* Bar
Expand All @@ -284,7 +288,7 @@ class Bar extends SchemaApiAbstract
public function getDocumentation()
{
$view = new View();
$view->setGet($this->schemaManager->get('Acme\Foo\Schema\GetResponse'));
$view->setGet($this->schemaManager->getSchema('Acme\Foo\Schema\Collection'));
return new Documentation\Simple($view);
}
Expand Down Expand Up @@ -346,9 +350,11 @@ protected function getExpectedOtherDiSourceNoObject()
namespace Acme\Foo;
use PSX\Controller\SchemaApiAbstract;
use PSX\Api\Documentation;
use PSX\Api\Version;
use PSX\Api\View;
use PSX\Controller\SchemaApiAbstract;
use PSX\Data\RecordInterface;
/**
* Bar
Expand All @@ -369,7 +375,7 @@ class Bar extends SchemaApiAbstract
public function getDocumentation()
{
$view = new View();
$view->setGet($this->schemaManager->get('Acme\Foo\Schema\GetResponse'));
$view->setGet($this->schemaManager->getSchema('Acme\Foo\Schema\Collection'));
return new Documentation\Simple($view);
}
Expand Down

0 comments on commit cc3adea

Please sign in to comment.