public function removeAttributes(User $user, array $attributes) { foreach ($attributes as $attribute) { if ($entity = $user->removeAttribute($attribute)) { $this->em->remove($entity); } } $this->em->flush(); }