Say I have the following classes:
class Store
{
/**
* @ManyToMany(targetEntity="PaymentMethod")
*/
protected $paymentMethods;
}
class PaymentMethod
{
}
When we delete (or just disable, without actually removing from the database) a PaymentMethod
, we'd like that this paymentMethod
gets removed from all the Store::$paymentMethods
collections.
Up to now, we've been using raw SQL queries on the junction table for this:
DELETE FROM StorePaymentMethod WHERE paymentMethodId = ?
Is there a way to do that in Doctrine, preferably in DQL?