From cc3adea0e70fc98ea0458c74b414b0ac1b389b24 Mon Sep 17 00:00:00 2001 From: Christoph Kappestein Date: Wed, 14 Jan 2015 19:41:31 +0100 Subject: [PATCH] fix api generate command template --- library/PSX/Console/Generate/ApiCommand.php | 6 ++++-- tests/PSX/Console/Generate/ApiCommandTest.php | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/library/PSX/Console/Generate/ApiCommand.php b/library/PSX/Console/Generate/ApiCommand.php index ca5ef03b..701b92dd 100644 --- a/library/PSX/Console/Generate/ApiCommand.php +++ b/library/PSX/Console/Generate/ApiCommand.php @@ -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} @@ -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); } diff --git a/tests/PSX/Console/Generate/ApiCommandTest.php b/tests/PSX/Console/Generate/ApiCommandTest.php index a601b936..b19ea8fc 100644 --- a/tests/PSX/Console/Generate/ApiCommandTest.php +++ b/tests/PSX/Console/Generate/ApiCommandTest.php @@ -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 @@ -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); } @@ -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 @@ -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); } @@ -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 @@ -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); }