I have two entities
class Promotor
{
/**
* @ORM\ManyToOne(targetEntity="Ciudad", inversedBy="promotor")
* @ORM\JoinColumn(name="ciudad_id", referencedColumnName="id", nullable=false)
*/
protected $ciudad;
and
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;
A "Promotor" can live in one "Ciudad" (City). And in a "Ciudad" (City) can live many "Promotores".
If i add onDelete="CASCADE" in JoinColumn
/**
* @ORM\ManyToOne(targetEntity="Ciudad", inversedBy="promotor")
* @ORM\JoinColumn(name="ciudad_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
*/
protected $ciudad;
it generate the next code
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
but also i like do CASCADE on update. I try with onUpdate="CASCADE" but it doesn' work
[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
By the error I understand that the property onUpdate does not exist, but.. Is there any way to do cascade on update?