Пример #1
0
 /**
  * @covers \Ilios\CoreBundle\Entity\MeshTerm::stampUpdate
  */
 public function testStampUpdate()
 {
     $now = new \DateTime();
     $this->object->stampUpdate();
     $updatedAt = $this->object->getUpdatedAt();
     $this->assertTrue($updatedAt instanceof \DateTime);
     $diff = $now->diff($updatedAt);
     $this->assertTrue($diff->s < 2);
 }
Пример #2
0
 public function load(ObjectManager $manager)
 {
     $data = $this->container->get('ilioscore.dataloader.meshTerm')->getAll();
     foreach ($data as $arr) {
         $entity = new MeshTerm();
         $entity->setId($arr['id']);
         $entity->setMeshTermUid($arr['meshTermUid']);
         $entity->setName($arr['name']);
         $entity->setLexicalTag($arr['lexicalTag']);
         $entity->setConceptPreferred($arr['conceptPreferred']);
         $entity->setRecordPreferred($arr['recordPreferred']);
         $entity->setPermuted($arr['permuted']);
         $entity->setPrintable($arr['printable']);
         foreach ($arr['concepts'] as $id) {
             $entity->addConcept($this->getReference('meshConcepts' . $id));
         }
         $this->addReference('meshTerms' . $arr['id'], $entity);
         $manager->persist($entity);
     }
     $manager->flush();
 }