コード例 #1
0
ファイル: IlmSessionTest.php プロジェクト: stopfstedt/ilios
 /**
  * Ensure we can set a float for hours
  */
 public function testHourValidation()
 {
     $this->object->setSession(new Session());
     $this->object->setHours(55);
     $this->object->setDueDate(new \DateTime());
     $this->object->setHours(1.33);
     $this->validate(0);
 }
コード例 #2
0
ファイル: IlmSessionTest.php プロジェクト: Okami-/ilios
 public function testNotBlankValidation()
 {
     $notBlank = array('session', 'hours', 'dueDate');
     $this->validateNotBlanks($notBlank);
     $this->object->setSession(new Session());
     $this->object->setHours(55);
     $this->object->setDueDate(new \DateTime());
     $this->validate(0);
 }
コード例 #3
0
 public function load(ObjectManager $manager)
 {
     $data = $this->container->get('ilioscore.dataloader.ilmSession')->getAll();
     foreach ($data as $arr) {
         $entity = new IlmSession();
         $entity->setId($arr['id']);
         $entity->setHours($arr['hours']);
         $entity->setDueDate(new \DateTime($arr['dueDate']));
         $entity->setSession($this->getReference('sessions' . $arr['session']));
         foreach ($arr['instructors'] as $id) {
             $entity->addInstructor($this->getReference('users' . $id));
         }
         foreach ($arr['instructorGroups'] as $id) {
             $entity->addInstructorGroup($this->getReference('instructorGroups' . $id));
         }
         foreach ($arr['learnerGroups'] as $id) {
             $entity->addLearnerGroup($this->getReference('learnerGroups' . $id));
         }
         foreach ($arr['learners'] as $id) {
             $entity->addLearner($this->getReference('users' . $id));
         }
         $manager->persist($entity);
         $this->addReference('ilmSessions' . $arr['id'], $entity);
     }
     $manager->flush();
 }