php - Associated entity not merged correctly -
i have 2 associated entities this: class solicitation { <some fields> /** * @var \user * * @orm\manytoone(targetentity="user", fetch="eager", inversedby="solicitation") * @orm\joincolumns({ * @orm\joincolumn(name="id_user", referencedcolumnname="id_user", nullable=false) * }) * @orderby({"nome" = "asc"}) */ private $user; <more fields> } i don't want cascade operations. problem when try merge existing user before persisting solicitation, this: $em = $this->getdoctrine()->getmanager(); if (!(\doctrine\orm\unitofwork::state_managed === $em->getunitofwork()->getentitystate($solicitation->getuser()))) { $em->merge($solicitation->getuser()); } $em->persist($solicitation); ...it won't change user unitofwork state "managed". i`ts still "detached" , receive , error on saving. it t...