Symfony Many to Many relationship Persistent collection -
many many relationship:
i have 2 tables joined many many relationship.
account group entity:
/** * @var arraycollection * @orm\manytomany(targetentity="account", inversedby="accountgroups", cascade={"persist"}) * @orm\jointable( * joincolumns={@orm\joincolumn()}, * inversejoincolumns={@orm\joincolumn(name="id", referencedcolumnname="id")}) **/ protected $accounts;
account entity:
/** * @var arraycollection * @orm\manytomany(targetentity="accountgroup", mappedby="accounts", cascade={"persist"}) * */ protected $accountgroups;
i tried many many relationship accountgroup entity using find() , findall(). not getting data related accounts though has. getting persistent class collection default dump. whether might relationship problem ?
code used fetch :
$entitymanager->getrepository('accountgroup')->find(1);
thanks @cerad , @stiven llupa comments. getting relationship data. iteration has done individual data.
$accountentity = $entitymanager->getrepository('account')->find(1); foreach($accountentity->getaccountgroups() $accountgroups) { { echo $accountgroups->getid(); }
Comments
Post a Comment