ORM Doctrine ManyToOne po aktualizacji CASCADE (Symfony)
Mam dwa podmioty
class Promotor
{
/**
* @ORM\ManyToOne(targetEntity="Ciudad", inversedBy="promotor")
* @ORM\JoinColumn(name="ciudad_id", referencedColumnName="id", nullable=false)
*/
protected $ciudad;
i
class Ciudad
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="nombre", type="string", length=50)
*/
private $nombre;
„Promotor” może mieszkać w jednym „Ciudad” (mieście). A w „Ciudad” (mieście) może żyć wiele „Promotores”.
Jeśli dodam onDelete = "CASCADE" w JoinColumn
/**
* @ORM\ManyToOne(targetEntity="Ciudad", inversedBy="promotor")
* @ORM\JoinColumn(name="ciudad_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
*/
protected $ciudad;
generuje następny kod
ALTER TABLE promotor DROP FOREIGN KEY FK_BF20A37FE8608214;
ALTER TABLE promotor ADD CONSTRAINT FK_BF20A37FE8608214 FOREIGN KEY (ciudad_id)
REFERENCES Ciudad (id) ON DELETE CASCADE
ale lubię też robić CASCADE przy aktualizacji. Próbuję z onUpdate = "CASCADE", ale nie działa
[Doctrine\Common\Annotations\AnnotationException]
[Creation Error] The annotation @ORM\JoinColumn declared on property Web\PromotorBundle\Entity\Promotor::$ciudad does not have a property named
"onUpdate". Available properties: name, referencedColumnName, unique, nulla
ble, onDelete, columnDefinition, fieldName
Przez błąd rozumiem, że właściwość onUpdate nie istnieje, ale .. Czy jest jakiś sposób na kaskadę aktualizacji?