We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Set container in Service

Is it okay to move the container to a service like this in the code? or is there a better way?

/* Stream Wrapper Manager service */
$di->setShared('stream_wrapper_manager', function () {
    $streamWrapperManager =  new \Druphal\Core\StreamWrapper\StreamWrapperManager();
    $streamWrapperManager->setContainer($this);  // it is right?
    return $streamWrapperManager;
});
edited Oct '16

No it's not. Just use InjectionAwareInterface. You can always extend Druphal\Core\StreamWrapper\StreamWrapperManager and implement Phalcon\Di\InjectionAwareInterface