What I am trying to accomplish is the following
$collection = new Phalcon\Mvc\Micro();
$collection->setHandler(new \app\Controllers\Brands());
$collection->setPrefix('api/brands');
$collection->get('','actionIndex');
$collection->post('/search','actionSearch');
$collection->get('/{id:[0-9]+}','resourceGet');
$collection->put('/{id:[0-9]+}','resourcePut');
$collection->delete('/{id:[0-9]+}','resourceDelete');
$app->mount($collection);
However no route is matched when going through it's URI as www.domain.com/api/brands/search
, but the odd thing here is that the app itself can handle the routes if specified on the script as
$app->handle('api/brands/search');
A quick and dirty fix for this would be the following
$app->handle(substr($_GET['_url'], 1));
but I would like to know if there's a better way to solve it.
Any suggestion or answer is highly appreciated! Thank you!