Base construction
Model::query() ->inWhere('id', []) ->execute() ;
need add custom method
Model::query() ->inWhere('id', []) ->execute() ->getByIndex('id') ;
How add it?
By creating your own criteria class and setting it in di as Phalcon\\Mvc\\Model\\Criteria key
Phalcon\\Mvc\\Model\\Criteria
U can show an example?
Oh nvm i missed you want to do it after execute method. So from phalcon 3.1 you can set your custom class for resultset, just do something like:
class MyResultset extends Phalcon\Mvc\Model\Resultset\Simple { public function getByIndex($column) { // do whatever here you need } }
And in your model:
public function getResultsetClass() { return MyResultset::class }