anon
anon

Reputation:

How to add custome bundles in symfony which are hosted locally?

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

Upvotes: 0

Views: 162

Answers (2)

S.Thiongane
S.Thiongane

Reputation: 6905

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

Upvotes: 2

bjuice
bjuice

Reputation: 291

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

Upvotes: 1

Related Questions