Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge e659035 into 0cb6770
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrofeitoza authored Jun 18, 2018
2 parents 0cb6770 + e659035 commit 22886d1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/book/controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,36 @@ following matrix:
should attempt to delete the given entity, and, if successful, return either a
200 or 204 response status.

Creation of action controllers looks like the following example:

```php
namespace Foo\Controller;

use Zend\Mvc\Controller\AbstractRestfulController;

class BarRestController extends AbstractRestfulController
{
//GET request with id: php.net/book/1
public function get($id)
{
return ['title' => 'Book 1'];
}

//GET request: php.net/book
public function getList()
{
return ['title' => 'All Books'];
}

//POST request
public function create($data)
{
return ['message' => 'Book created'];
}
}

```

Additionally, you can map "action" methods to the `AbstractRestfulController`,
just as you would in the `AbstractActionController`; these methods will be
suffixed with "Action", differentiating them from the RESTful methods listed
Expand Down

0 comments on commit 22886d1

Please sign in to comment.