Intent and use cases behind EntityManagerDecorator #8839
-
I am having a hard time finding documentation on Can you please explain what I also want to add something which I think is an incorrect usage of the decorator to give you more context behind my question on understanding how to use the decorator correctly: class DoctrineProductRepository extends EntityManagerDecorator
{
function getProduct(int $id): Product
{
return $this->getRepository(Product::class)->find($id);
}
}
// to call
$repository = new DoctrineProductRepository($this->getEntityManager());
$repository->getProduct(2); //Product entity |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You don't need the decorator, see how to configure custom repositories in mapping. You need a ProductRepository extends EntityRepository |
Beta Was this translation helpful? Give feedback.
You don't need the decorator, see how to configure custom repositories in mapping. You need a ProductRepository extends EntityRepository