Injecting a model instance into a controllers action

2 years 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

2 years 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:

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

<?php echo $page->next ?>



Continue reading

Phalcon PHP route model binding

2 years 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