php - Symfony container: Definition not transformed into service -


on legacy application, introduced container in add definition inside extension

    $serviceid  = ($alias == 'default') ? 'm6_statsd' : 'm6_statsd.'.$alias;     $definition = new definition('m6web\component\statsd\client');     $definition->setscope(containerinterface::scope_container);     $definition->addargument($usedservers);      $container->setdefinition($serviceid, $definition); 

// method compile container

private function loadcontainer() {     // ok that's plain bad, @ least works. need static because controllers can't access application     // , can't put container in models because inherited front office.     self::$container = new containerbuilder();      $helpscoutextension = new helpscoutextension();     self::$container->registerextension($helpscoutextension);     self::$container->loadfromextension($helpscoutextension->getalias());      $statsdextension = new statsdextension();     self::$container->registerextension($statsdextension);     self::$container->loadfromextension($statsdextension->getalias());      $loader = new yamlfileloader(self::$container, new filelocator(c_path_global_conf));     $loader->load('bov6.yml');      self::$container->compile();     dump(self::$container); } 

the container compiled when dump container, shows definition , there no services available

enter image description here

what missing please ? why definition not transformed service ?

if haven't called $container->get('service') method service, service isn't created.

service instantiated first time try access it.


Comments