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] Phalcon\Mvc\Micro\Collection::map returns NULL instead of Phalcon\Mvc\Router\RouteInterface #1037

Closed
jeffreycahyono opened this issue Aug 8, 2013 · 6 comments
Labels
bug A bug report status: medium Medium

Comments

@jeffreycahyono
Copy link

$upload = new MicroCollection();
$upload->setHandler('UploadController',true);
$upload->setPrefix('/upload');
$x = $upload->map('/', 'execUpload');

print_r($x); //The output is NULL!!

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@ghost
Copy link

ghost commented Aug 8, 2013

I would say this is a bug in the documentation — I don't see how Phalcon\Mvc\Micro\Collection can return Phalcon\Mvc\Router\RouteInterface; it can return Phalcon\Mvc\Micro\CollectionInterface

@phalcon what do you think?

https://github.com/phalcon/cphalcon/blob/master/ext/mvc/micro/collection.c#L85

@jeffreycahyono
Copy link
Author

The map method should return Phalcon\Mvc\Router\RouteInterface so it can be chained using via(...);

 $upload->map('/', 'execUpload')->via(['POST','OPTIONS','HEAD']);

It should mimic Phalcon\Mvc\Micro::map method that can be called like this

//Matches if the HTTP method is GET or POST
$app->map('/repos/store/refs',"action_product")->via(array('GET', 'POST'));

@ghost
Copy link

ghost commented Sep 24, 2013

Micro collections now return Phalcon\Mvc\Micro\CollectionInterface

@phalcon
Copy link
Collaborator

phalcon commented Oct 2, 2013

A collection does not create a route, so it can't return a Phalcon\Mvc\Router\RouteInterface, routes are created when the collection is mounted in the Micro\App

@ghost
Copy link

ghost commented Jan 30, 2014

Should this one be closed?

@Green-Cat
Copy link
Contributor

@phalcon This should probably be closed as not a bug.

@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

4 participants