$notification = $user->getNotificationSettings();
$em->remove($notification);
$groups = $user->getGroups();
foreach ($groups as $value) {
$em->remove($value);
}
$myShops = $user->getMyShops();
foreach ($myShops as $value) {
$em->remove($value);
}
$referrals = $user->getReferrals();
foreach ($referrals as $value) {
$em->remove($value);
}
$em->remove($user);
$em->flush();
//* @Entity */
class Group
{
/**
* @ManyToMany(targetEntity="User")
* @JoinTable(
* joinColumns={@JoinColumn(onDelete="CASCADE")},
* inverseJoinColumns={@JoinColumn(onDelete="CASCADE")}
* )
*/
private $users;
}