symfony - Annotation doctrine ManyToOne -


i have 1 class b 4 array collection :

class b {     private $fws;     private $fxs;     private $fys;     private $fzs;      ... } 

each class fw, fx, fy, fz extend other abstract class f.

i :

b->getfws(); b->getfxs(); b->getfys(); b->getfzs();  fw->getb(); fx->getb(); fy->getb(); fz->getb(); 

i don't know annotation should put :

abstract class f {     /**      * @omr\manytoone(targetentity="b", inversedby= ? )      */      private $b; }  class b {     /**      * @orm\onetomany(targetentity= ?, mappedby="b")      */     private $fws;      ... } 

can me. thank.

if set $b protected in abstract classe, annotations set on children added parent annotations.

(if arrive here , want override annotations has explained here)

just define manytoone relations in children classes :

abstract class f {      protected $b; }  class fw extends f{     /**      * @omr\manytoone(targetentity="b", inversedby= "fws" )      */      protected $b; }  class fx extends f {     /**      * @omr\manytoone(targetentity="b", inversedby= "fxs" )      */      protected $b; }  ...  class b {     /**      * @orm\onetomany(targetentity= "fw", mappedby="b")      */     private $fws;      /**      * @orm\onetomany(targetentity= "fx", mappedby="b")      */     private $fxs;      ... } 

Comments