Hi All,
I just wanted to know what the difference is between a shared and a non-shared service, is ite merely performance based? What are the best practices?
Lets have a look at an example :
$di->set('commonv', function() {
$view = new \Phalcon\Mvc\View();
$view->setViewsDir(APP_DIR.'/common/views/');
$view->setPartialsDir(APP_DIR.'/common/views/partials/');
return $view;
}, true);
Here we can see that commonv is a shared service, I can access it as follows :
$di = $this->di->getDefault();
$commonv = $di->get("commonv");
Any advice much appreciated.
Thanks!