Note that there are some explanatory texts on larger screens.

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

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload