I have some cross table between User table and Role table. I want to create cascade removing on the database level. I have the next annotation:
/**
* @ORM\ManyToMany(targetEntity="Role")
* @ORM\JoinTable(name="user_x_role",
* joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="role_id", referencedColumnName="id")}
* )
* @var ArrayCollection $roles
*/
protected $roles;
But foreign keys have ondelete=restrict and onupdate=restrict after:
doctrine:schema:update --force
How can I change these values to CASCADE?
You should try this, don’t forget to modify also the cascade on ORM level.