Articles


Injecting a model instance into a controllers action

8 months ago by: matt

This is a continuation/update from my Phalcon PHP route model binding post. My pull request has since been merged and made its way into Phalcon 3.0.0. This is taken from the documentation I wrote for this feature here.


From 3.0.x onwards the dispatcher comes with an option to handle this internally for all models passed into a controller action.

use Phalcon\Mvc\Dispatcher;

$dispatcher = new Dis...

Continue reading


Phalcon PHP Paginator with URL parameters

1 year ago by: matt

So this is an issue that a few people on the forums and github have reported. Common scenario would be searching or filtering where you are adding additional parameters into your request. Something like the following:

http://mydomain.com/articles?sort=desc


Now you would expect the following output if you have your Paginator set up correctly:

<?php echo $page->next ?>

//Output
?page=2&sort=desc


How...

Continue reading


Phalcon PHP route model binding

1 year ago by: matt

Edit: I have since this article was written updated the Phalcon documentation here to include this example. I have also put in a pull request to 2.1.x to put this functionality into the dispatcher in the phalcon core.


So this is something I discovered today after creating a new feature request over on the cphalcon GitHub. My initial request was to allow for route model binding similar to what is ...

Continue reading