Doctrine 2 OneToMany Cascade SET NULL
Solution 1:
You should add the option onDelete="SET NULL"
in the annotation of your entity Publication like this:
class Publication
{
/**
* @ORM\ManyToOne(targetEntity="Teacher", inversedBy="publications")
* @ORM\JoinColumn(name="teacher_id", referencedColumnName="id", onDelete="SET NULL")
*/
protected $teacher;
}
Cheers!