pleerock
pleerock

Reputation: 18856

Symfony - extract from short bundle name full path bundle name

How do I extract the bundle name from its short form to full, for example I want to convert AcmeDemoBundle raw string to Acme\DemoBundle bundle real namespace

Upvotes: 0

Views: 583

Answers (1)

pleerock
pleerock

Reputation: 18856

We can get the bundle instance from our kernel by using getBundle method, and then user getNamespace() method to get the actual namespace of the bundle:

$this->container->get('kernel')->getBundle('AcmeDemoBundle')->getNamespace();
// gives me Acme/DemoBundle

Upvotes: 1

Related Questions