Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Nov 29, 2014
1 parent 52dd35c commit 534ab8e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 7 deletions.
8 changes: 6 additions & 2 deletions doc/concept/api_versioning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ Url versioning
The most easiest solution to versioning is to simply provide multiple routes
to an API i.e.

.. code-block:: none
GET /api/v1/news Acme\News\Lion\Api
GET /api/v2/news Acme\News\Zebra\Api
While this is easy to implement it hast the disadvantage that you have multiple
While this is easy to implement it has the disadvantage that you have multiple
presentations for the same resource. I.e. /api/v1/news and /api/v2/news
represent the same resource but in different formats

Expand All @@ -39,6 +41,8 @@ Accept-Header versioning
PSX comes with support to handle API versioning throught the Accept header
field. That means you must specify an explicit version in the Accept header i.e.

.. code-block:: none
Accept: application/vnd.foobar.v2+json
In the following a short example howto add versioning to an schema API
Expand All @@ -60,7 +64,7 @@ In the following a short example howto add versioning to an schema API
{
public function getSchemaDocumentation()
{
$documentation = new Documentation\Version();
$documentation = new Documentation\Version();
$responseSchema = $this->schemaManager->getSchema('Foo\Blog\Schema\SuccessMessage');
$view = new View(View::STATUS_DEPRECATED);
Expand Down
15 changes: 13 additions & 2 deletions doc/concept/table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Abstract

The PSX table classes offern an alternative to an ORM. Each table class
represents an sql table. The table class contains the table name and all
available columns. It is also the place where you put all complex business
available columns. It is also the place where you can put all complex business
queries like in an repository. To get an first impression here an example:

.. code-block:: php
Expand Down Expand Up @@ -77,7 +77,7 @@ fictional method which returns the best comments
{
// ...
public function getBestComments($userId)
public function getBestCommentsByUser($userId)
{
$sql = ' SELECT id,
title,
Expand All @@ -94,3 +94,14 @@ fictional method which returns the best comments
));
}
}
Generation
----------

It is possible to generate such table classes from an sql table. Therefor you
can use the following command

.. code::
$ ./vendor/bin/psx generate:table Acme\Table\Comment psx_handler_comment
26 changes: 23 additions & 3 deletions doc/design/command.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,29 @@ required parameter is missing an exception gets thrown.
$this->executor->run(new Map('Foo\Bar\Command', array('bar' => 'foo')));
It is also possible to invoke the command through the console
It is also possible to invoke the command through the console. Therefor you have
to pass the parameters as arguments

.. code-block:: none
.. code::
vendor\bin\psx Foo\Bar\Command -bar foo
$ ./vendor/bin/psx command Foo\Bar\Command bar:foo
You could also pipe the parameters as JSON string through stdin with the "-s"
switch

.. code::
$ echo {"bar": "foo"} | ./vendor/bin/psx command -s Foo\Bar\Command
Generation
----------

It is possible to generate an command template. You can use the following
command which takes as first argument the class name and as second a comma
seperated list with service names. These services are automatically included in
the command

.. code::
$ ./vendor/bin/psx generate:command Acme\Command connection,http
13 changes: 13 additions & 0 deletions doc/design/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,16 @@ Usage
));
}
}
Generation
----------

It is possible to generate an controller template. You can use the following
command which takes as first argument the class name and as second a comma
seperated list with service names. These services are automatically included in
the controller

.. code::
$ ./vendor/bin/psx generate:controller Acme\Controller connection,http

0 comments on commit 534ab8e

Please sign in to comment.