/**
  * @param Student $object Student
  */
 public function prePersist($object)
 {
     /** @var User $user */
     $user = $this->getConfigurationPool()->getContainer()->get('security.token_storage')->getToken()->getUser();
     $roles = $user->getRoles();
     if (in_array('ROLE_SUPER_ADMIN', $roles)) {
         $object->setSchool($object->getTeam()->getGroup()->getTeacher()->getSchool());
     } else {
         $object->setSchool($user->getSchool());
     }
 }
 /**
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  *
  * @param ObjectManager $manager Object manager
  *
  * @return null
  */
 public function load(ObjectManager $manager)
 {
     $lorem = 'Lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat';
     $nameList = explode(' ', $lorem);
     $teamCpt = 1;
     for ($i = 1; $i <= 24; $i++) {
         $student = new Student();
         $lastName = $nameList[array_rand($nameList)];
         $firstName = $nameList[array_rand($nameList)];
         $student->setFirstName($firstName);
         $student->setLastName($lastName);
         /** @var Team $team */
         $team = $this->getReference('team' . $teamCpt);
         $student->setTeam($team);
         $student->setSchool($team->getGroup()->getTeacher()->getSchool());
         $manager->persist($student);
         $this->addReference('student' . $i, $student);
         if ($i % 2 == 0) {
             $teamCpt++;
         }
     }
     $manager->flush();
 }