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