ikucheriavenko
8/7/2017 - 9:15 PM

OnDelete=CASCADE; in this example only brands_notifications table will be clean from notification. Since from DB side we have 3 tables. It

OnDelete=CASCADE;

in this example only brands_notifications table will be clean from notification. Since from DB side we have 3 tables. It's impossible to change also notification table. so this REFERENTIAL ACTION influences only described table

class Brand
{



    /**
     * One Brand have Many Notifications - Unidirectional
     *
     * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Notification", cascade={"persist", "remove"}, orphanRemoval=true)
     * @ORM\JoinTable(name="brands_notifications",
     *      joinColumns={@ORM\JoinColumn(onDelete="CASCADE", name="brand_id", referencedColumnName="id")},
     *      inverseJoinColumns={@ORM\JoinColumn(onDelete="CASCADE", name="notification_id", referencedColumnName="id", unique=true)}
     *      )
     */
    private $notifications;



}