在适应 Symfony 2.7 中新的推荐结构后,我无法通过$em->getRepository('Bundle:Entity')
.
这是我的目录结构:
MyBundle
- Component
- Catalog
- Model
Product.php
我的映射定义在config.yml
:
mappings:
mybundle:
type: annotation
dir: %kernel.root_dir%/../src/mybundle/Component/Product/Model
prefix: MyBundle\Component\Product\Model
alias: ??? # I tried different things
我应该写什么$em->getRepository('MyBundle:Product')
而不是MyBundle:Product
成功访问实体?
如果可能的话,我想使用默认的 Symfony 别名,所以我不需要为每个实体指定别名config.yml