title: Foreign key and cascade problems on delete Symfony4/Doctrine
body: <p>I want to delete a property with my user but I have the following error : </p>
  
  <p>An exception occurred while executing 'DELETE FROM property WHERE id = ?' with params [1]:</p>
  
  <p>SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (<code>gestImmo</code>.<code>equipment</code>, CONSTRAINT <code>FK_D338D583517FE9FE</code> FOREIGN KEY (<code>equipment_id</code>) REFERENCES <code>property</code> (<code>id</code>))</p>
  
  <p>I googled it and (I think) it's a cascade problem. So I searched on forums but I didn't solved the problem. I asked for help to an experimented coworker but we didn't fix the mistake ... Hope you could help me.</p>
  
  <p>In my User entity there is :</p>
  
  <pre><code>     /**
       * @ORM\OneToMany(targetEntity="App\Entity\Property", mappedBy="userProperty")
       */
      private $properties;
  </code></pre>
  
  <p>In my property Entity there is :</p>
  
  <pre><code>     /**
       * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="properties")
       * @JoinColumn(name="id", referencedColumnName="id", onDelete="CASCADE")
       */
      private $userProperty;
  
      /**
       * @ORM\OneToMany(targetEntity="App\Entity\Equipment", mappedBy="equipment")
       * @JoinColumn(name="id", referencedColumnName="equipement_id", onDelete="CASCADE")
       */
      private $equipments;
  </code></pre>
  
  <p>and in my equipments entity there is :</p>
  
  <pre><code>     /**
       * @ORM\ManyToOne(targetEntity="App\Entity\Property", inversedBy="equipments")
       * @Assert\Type("string")
       * @var string
       */
      private $equipment;
  </code></pre>
  
  <p>Thanks for your help !</p>