public function testNotNullValidation() { $notNull = array('school'); $this->object->setName('10lenMAX'); $this->object->setAamcCode('ddd'); $this->object->setAddressStreet('1123 A'); $this->object->setAddressCity('Irvine'); $this->object->setAddressStateOrProvince('CA'); $this->object->setAddressZipcode('99999'); $this->object->setAddressCountryCode('US'); $this->validateNotNulls($notNull); $this->object->setSchool(m::mock('Ilios\\CoreBundle\\Entity\\SchoolInterface')); $this->validate(0); }
public function load(ObjectManager $manager) { $data = $this->container->get('ilioscore.dataloader.curriculumInventoryInstitution')->getAll(); foreach ($data as $arr) { $entity = new CurriculumInventoryInstitution(); if (!empty($arr['school'])) { $entity->setSchool($this->getReference('schools' . $arr['school'])); } $entity->setId($arr['id']); $entity->setName($arr['name']); $entity->setAamcCode($arr['aamcCode']); $entity->setAddressStreet($arr['addressStreet']); $entity->setAddressCity($arr['addressCity']); $entity->setAddressStateOrProvince($arr['addressStateOrProvince']); $entity->setAddressZipCode($arr['addressZipCode']); $entity->setAddressCountryCode($arr['addressCountryCode']); $manager->persist($entity); $this->addReference('curriculumInventoryInstitutions' . $arr['name'], $entity); } $manager->flush(); }