سؤال

Let's assume, I made a custom symfony bundle like a small ORM, and now I want to include this bundle and register it in the AppKernel currently, the bundle in found in the Vendor folder. So, what I did primary is add it in the kernel

new Virka\ORMBundle\VirkaORMBundle(),

then I tried to add it, in the autoloader like this:

$loader->add('Virka',__DIR__.'/../vendor/VirkaORMBundle()');

Now, symfony gives me an error saying,

FatalErrorException: Error: Class 'Virka\ORMBundle\VirkaORMBundle' not found in C:\wamp\www\Symfony\app\AppKernel.php line 20

Obviously, line 20 is new Virka\ORMBundle\VirkaORMBundle(), I have tried every thing, but it just won't work. And, I want to be able to do this without uploading the bundle to github or pacakgist.

So, How do I would like help from you, thanks

هل كانت مفيدة؟

المحلول

Delete the parantheses () :

$loader->add( 'YOURNAMESPACE', __DIR__.'/../vendor/YOURBUNDLEDIR/' );

Edit :

YOURNAMESPACE : the namespace to use in use statements

YOURBUNDLEDIR : the folder in your file system which contains the class VirkaORMBundle()

This link may help

نصائح أخرى

Do you use composer? If so, you have to add your namespace in the vendor/composer/autoload_namespace.php file.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top