I have a table in MySQL which have a ManyToMany field and I want truncate the table, but when I try it, I obtain the following error:
ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint ...
I'm using Symfony with Doctrine but if it is possible, I'm interested in learn how to do it through console
class Project {
/**
* @ORM\ManyToMany(targetEntity="Shipping", mappedBy="projects")
**/
private $employee;
}
class Employee{
/**
* @ORM\ManyToMany(targetEntity="Product", inversedBy="employee")
* @ORM\JoinTable(name="middle_table")
**/
protected $projects;
}