php - Symfony2 error Looked for namespace "services", found none -


i have error starting symfony2.

invalidargumentexception in yamlfileloader.php line 356: there no extension able load configuration "services" (in /users/jm/documents/websites/www.brsymfony.dev/src/calcbundle/dependencyinjection/../resources/config/services.yml). looked namespace "services", found none

my services.yml , has whitespaces correctly:

services:     calculator:         class: calcbundle\services\calculator         arguments:             - @doctrine.orm.default_entity_manager     listoperations:         class: calcbundle\services\listoperations         arguments:             - @doctrine.orm.default_entity_manager 

can me?

--

yes, have code on calcextension.php inside dependencyinjection folder:

<?php  namespace calcbundle\dependencyinjection;  use symfony\component\config\filelocator; use symfony\component\dependencyinjection\loader\yamlfileloader; use symfony\component\httpkernel\dependencyinjection\extension; use symfony\component\dependencyinjection\containerbuilder;  /**  * class appextension  */  class calcextension extends extension {     /**      * loads specific configuration.      *      * @param array            $config    array of configuration values      * @param containerbuilder $container containerbuilder instance      *      * @throws \invalidargumentexception when provided tag not defined in extension      *      * @api      */     public function load(array $config, containerbuilder $container)     {         $loader = new yamlfileloader(             $container,             new filelocator(__dir__ . '/../resources/config')         );         $loader->load('services.yml');     } } 

thanks in advance :)

have created extension on dependencyinjection folder? should calcbundle/dependencyinjection/calcextension.php

you have documentation examples here http://symfony.com/doc/current/cookbook/bundles/extension.html

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'); } 

the services.yml should located on calcbundle/resources/config/services.yml

be careful because examples creating parameters , services config.yml, have adapt case (services.yml , parameters.yml separated, recommend way)

you have documentation examples here

https://symfony.com/doc/current/book/service_container.html


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -