This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » Extend eZ Publish with Sensio...
expandshrink

Extend eZ Publish with Sensio FrameworkExtraBundle doesn't work

Extend eZ Publish with Sensio FrameworkExtraBundle doesn't work

Wednesday 10 April 2013 3:59:30 pm - 3 replies

Hey,

I want to extend eZ Publish 5 with the FrameworkExtraBundle of symfony to use annotations.

 

I did it the following way:

I created the following folder structure: /vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle

and copied the following files into it:

https://github.com/sensio/SensioFrameworkExtraBundle

 

After that, I wanted to add the bundle into EzPublishKernel.php

and wrote the following:

use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle;

and in the function registerBundles() ()

{

new SensioFrameworkExtraBundle(),

}

 

I also tried several combinations of writing the path in the registerBundles function but I always get the error:

FatalErrorException: Error: Class 'Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle' not found in /home/www/diomega.local.content01/ezpublish/EzPublishKernel.php line 50

Do you know what I am doing wrong??

Wednesday 10 April 2013 4:11:48 pm

You need to tell symfony where to fetch the Sensio Bundle from.

For this open autoload_namespaces.php under the vendor/composer directory and add the following item to the array:

'Sensio\\Bundle\\FrameworkExtraBundle' => $vendorDir . '/sensio/framework-extra-bundle/',

After this is saved EzPublishKernel will know where the bundle is to be loaded from.

(I think you can even omit the 'use statement from the beginning of the kernel class.)

Wednesday 10 April 2013 4:19:19 pm

DiOmega: The problem is that you manually downloaded the bundle instead of installing it via Composer.

  1. Install Composer in your project
  2. php composer.phar require sensio/distribution-bundle:2.1.* (use 2.2.* if using eZ Publish CP 2013.1+)
  3. php composer.phar install

Like the majority of bundles in Symfony, you need to use Composer to install them. This is Composer which takes care of autoloading.

Thursday 11 April 2013 11:14:20 am

Thanks for your answers happy.gif Emoticon

I didn't know the composer before. It seems to be a good tool to install the bundles correctly and a nice way to extend eZ with new features.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from