Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Micro collections not returning Router #1130

Closed
iamtgray opened this issue Aug 21, 2013 · 7 comments
Closed

[BUG] Micro collections not returning Router #1130

iamtgray opened this issue Aug 21, 2013 · 7 comments

Comments

@iamtgray
Copy link

Hi Folks

I am writing some custom collections for my routes so I can seperate them into reasonable groups under a controller, and I have found a bug in the software.

The documentation states that the collection's get, put, post and delete methods will return an object implementing the Phalcon\Mvc\Router\RouteInterface interface, however after doing the following code the methods return null (or void).

$collection->setHandler('Controller\Entity\Customer', true);

$getReturn = $collection->get('/customer/{id}', 'get');
$putReturn = $collection->put('/customer/{id}', 'put');
$deleteReturn = $collection->delete('/customer/{id}', 'delete');
$postReturn = $collection->post('/customer', 'post');

var_dump($getReturn, $putReturn, $deleteReturn, $postReturn);

This then returns:

NULL
NULL
NULL
NULL

Discovered this while trying to use the setName() method on the return of these route aditions.

@dreamsxin
Copy link
Contributor

I think it is wrong document.

@iamtgray
Copy link
Author

Hi Dreamsxin what do you mean by wrong document?

@dreamsxin
Copy link
Contributor

What I mean is that it should not return values.
I view the Phalcon\Mvc\Micro\Collection source code, Did not return to the operating, And get\put\delete\post
These methods do not require the second argument.

@jeffreycahyono
Copy link

This is a bug. It is not really a problem if your are using get,put,delete, and post method, but it become a problem when using map. If the map can return Router interface, it can be called as $collection->map(...)->via(['POST','PUT']);

I have reported similiar BUG in: #1037

@Slyvampy
Copy link

Any chance anyone can look at this?

@ghost
Copy link

ghost commented Sep 24, 2013

This is the bug in the documentation — the methods should return Phalcon\Mvc\Micro\CollectionInterface, not Phalcon\Mvc\Router\RouteInterface

@phalcon
Copy link
Collaborator

phalcon commented Sep 24, 2013

This is fixed in 1.2.4/1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants