public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
$settingsService = new SettingsService($container);
$settingsService->test();
}
my.bundle.settings:
class: My\Bundle\Services\SettingsService
arguments: [ '@doctrine.orm.entity_manager', '@service_container' ]
use Doctrine\ORM\EntityManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
class SettingsService {
public $em;
public $container;
/**
* {@inheritDoc}
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
*/
public function __construct(ContainerInterface $container){
$this->container = $container;
$this->em = $this->container->get('doctrine.orm.entity_manager');
}
public function test() {
// var_dump($this->container);
// exit;
}
}
InvalidArgumentException: The service definition "doctrine.orm.entity_manager" does not exist.