symfony - How do I generate ID when I have composite keys in Doctrine? -
i have entity
composite keys. see below:
class bankaccount { /** * @orm\id * @orm\column(type="integer") * */ protected $bank; /** * @orm\id * @orm\manytoone(targetentity="companybundle\entity\company") */ protected $company; ... }
because doctrine has issues composite keys won't generates sequences (i'm working in postgresql), how deal in order generate $bank
pk?
if sounds don't want composite key, primary key on $bank
, foreign key on $company
. if that's case,
class bankaccount { /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $bank; /** * @orm\manytoone(targetentity="companybundle\entity\company") */ protected $company; ... }
should it.
Comments
Post a Comment