我想覆盖另一个包的实体和存储库
所以
我想覆盖
src/MyBundle/Entity/Product
src/MyBundle/Entity/ProductRepository
所以我创建了另一个包AppBundle
src/AppBundle/Entity/Product extends src/MyBundle/Entity/Product
src/AppBundle/Entity/ProductRepository extends src/MyBundle/Entity/ProductRepository
所以在AppBundle中我想添加一些属性,并且还想在ProductRepository中编写自定义查询。
所以
class AppBundle extends Bundle
{
public function getParent()
{
return 'MyBundle';
}
}
In my AppBundle entity i have specify repository of src/AppBundle/Entity/ProductRepository
我该怎么做?
* @ORM\Entity(repositoryClass="MyBundle\Entity\ProductRepository")
*/
class Product extends Base
{
}
$ em-> getRepository('AppBundle:Product')提供了
的存储库MyBundle\Entity\ProductRepository