We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Does DI setter injection work with a \Phalcon\Mvc\Collection

Using Phalcon 1.1.0 and trying to get the DI to work on a \Phalcon\Mvc\Collection

$di->set('myservice', function() {
    return $myservice = new myService();
$di->set('Data', array(
    'className' => 'Namespace\Model\Data',
    'calls' => array(
            'method' => 'setMyservice',
            'value' => array('type' => 'service', 'name' => 'myservice')

But the corresponding method in the collection class never gets called. What am I doing wrong?


Check this gist out, you have an error on how you're passing the parameters for setMyservice: https://gist.github.com/phalcon/5695689