Doctrine many repository for same entity -


is possible have 2 repositories same entity ?

i try that, not work..

class packagerepository extends entityrepository {     public function __construct($em, mapping\classmetadata $class)     {         $cmf = $em->getmetadatafactory();         $class = $cmf->getmetadatafor('product');         parent::__construct($em, $class);     } } 

any ideas ?

first of all, why want that?

second, answer question. can have many repositories working same entities like, simple classes after all.

but can link 1 class entity class using @repository annotation (or yaml, or xml, whatever). mapping data stored in entitymanager. entitymanager know 1 repository class linked entity class, if try $entity->getreposiotry() or similar return linked class.

but nothing can stop creating own classes queries , call them directly, explicitly, without relying on entitymanagers repository mapping.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -