public function __construct(School $school, User $user) { $userYear = $user->getLastLogin()->format('Y'); $schoolId = $school->getId(); $this->schoolId = $schoolId; $this->userYear = $userYear; }
/** * Vérifie si le user est inscrit à la prochaine édition du pouce d'or auquel son école est inscrite * * @param User $user * @return bool */ public function isRegisterToNextRaceOfItsSchool(User $user) { try { $team = $this->em->getRepository('PouceTeamBundle:Team')->getLastTeam($user->getId())->getSingleResult(); } catch (NoResultException $e) { return false; } try { $nextEdition = $this->em->getRepository('PouceSiteBundle:Edition')->findNextEditionBySchool($user)->getSingleResult(); } catch (NoResultException $e) { return false; } if ($team->getEdition()->getId() == $nextEdition->getId()) { $answer = true; } else { $answer = false; } return $answer; }
/** * Vérifie si le user a un profil complet * * @param User $user * @return bool */ public function checkUserAdditionnalInformations(User $user) { $isUserUpdated = null !== $user->getFirstName() && null !== $user->getLastName() && null !== $user->getSex() && null !== $user->getPromotion() && null !== $user->getTelephone(); return $isUserUpdated; }