Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将捆绑名称从其短形式提取为完整名称,例如我想将AcmeDemoBundle原始字符串转换为Acme\DemoBundle捆绑真实名称空间
AcmeDemoBundle
Acme\DemoBundle
我们可以通过 usinggetBundle方法从内核中获取 bundle 实例,然后使用 usergetNamespace()方法获取 bundle 的实际命名空间:
getBundle
getNamespace()
$this->container->get('kernel')->getBundle('AcmeDemoBundle')->getNamespace(); // gives me Acme/DemoBundle