title: Cannot instantiate abstract class ... in appDevDebugProjectContainer.php - Symfony2
body: <p>I have just installed yesterday <strong><em>apc</em></strong> and I am now getting this error:</p>
  
  <pre><code>FatalErrorException: Error: Cannot instantiate abstract class
  ACME\WebBundle\Menu\MenuBuilder in
  /var/www/app/cache/dev/appDevDebugProjectContainer.php line 743
  </code></pre>
  
  <p>and in that line there is:</p>
  
  <pre><code>protected function getEposMain_MenuBuilderService()
  {
      return $this-&gt;services['epos_main.menu_builder'] = new \ACME\WebBundle\Menu\MenuBuilder($this-&gt;get('knp_menu.factory'));
  }
  </code></pre>
  
  <p>Does any one know what does it mean and what I can do with it?</p>
  
  <p>services.yml</p>
  
  <pre><code>services:
      epos_main.menu_builder:
          class: ACME\WebBundle\Menu\MenuBuilder
          arguments: ["@knp_menu.factory"]
  
      epos_main.menu.main:
          class: Knp\Menu\MenuItem # the service definition requires setting the class
          factory_service: epos_main.menu_builder
          factory_method: createMainMenu
          arguments:
              - @request
              - @twig
              - 'ACMEWebBundle:Menu:menu.html.twig'
          scope: request # needed as we have the request as a dependency here
          tags:
              - { name: knp_menu.menu, alias: main } # The alias is what is used to retrieve the menu
  
      epos.twig.epos_extension:
          class: ACME\WebBundle\Twig\ePOSTwigExtension
          tags:
              - { name: twig.extension }
  </code></pre>
  
  <p>a bit of MenuBuilder Class code:</p>
  
  <pre><code>namespace ACME\WebBundle\Menu;
  
  use Knp\Menu\FactoryInterface;
  use Symfony\Component\HttpFoundation\Request;
  
  class MenuBuilder
  {
      private $factory;
  
      /**
       * @param FactoryInterface $factory
       */
      public function __construct(FactoryInterface $factory)
      {
          $this-&gt;factory = $factory;
      }
  
      public function createMainMenu(Request $request)
      {
  
          $menu = $this-&gt;factory-&gt;createItem('root');
          $menu-&gt;setChildrenAttribute('class', 'nav');
          ...
          ...
          return $menu;
      }
  }
  </code></pre>