getFirstname())) . ' ' . strtoupper($user->getLastname()); } // isUserInGroupVip public function isInGroupUserVip(UserInterface $user) { return $this->isInGroupByDevAlias($user, 'vip') ; } // isUserInGroup public function isInGroupUser(UserInterface $user, GroupUserInterface $groupUser) { return $this->isInGroupByDevAlias($user, $groupUser->getDevAlias()); } // isUserInGroupByDevAlias public function isInGroupByDevAlias(UserInterface $user, string $groupUserDevAlias) { $groupUsers = $user->getGroupUsers(); foreach($groupUsers as $groupUser) { if($groupUser->getDevAlias() == $groupUserDevAlias) { return true; } } return false; } public function isSubscribedToNewsletter(UserInterface $user, NewsletterInterface $newsletter) { return $user->getNewsletters()->contains($newsletter); } public function getAge(UserInterface $user): ?int { if($user->getBirthdate()) { $now = new \DateTime(); $interval = $now->diff($user->getBirthdate()); return $interval->y; }else{ return null; } } public static function getGenderChoices(){ return[ '0', '1' ]; } }