1

I've been trying to use onDelete="SET NULL" with one of my entities, but it returns this error:

[Creation Error] The annotation @ORM\OneToMany declared on property AppBundle\Entity\Genre::$movie does not have a property named "onDelete". Available properties: mappedBy, targetEntity, cascade, fetch, orphanRemoval, indexBy

Entity looks like this:

/**
 * Movie array
 *
 * @ORM\OneToMany(
 *      targetEntity="AppBundle\Entity\Movie",
 *    mappedBy="genres",
 *      onDelete="SET NULL")
 * 
 */
protected $movie;

What am I doing wrong?

Nunuz
  • 47
  • 7
  • This link will help you - http://stackoverflow.com/questions/6328535/on-delete-cascade-with-doctrine2 – Kapil Jun 28 '16 at 10:37

1 Answers1

2

You should use "onDelete" property on ORM\JoinColumn and not on relation. error saying its not property of relation. try something like:

@ORM\JoinColumn(name="moviee_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")

Replace your field name per your need

Rupal Javiya
  • 591
  • 5
  • 14