Exemplo n.º 1
0
 public function updatePerson($em, $entity)
 {
     if ($entity instanceof Cast || $entity instanceof Crew) {
         $id = $entity->getPersonId();
         $people = $this->tmdb->load($id);
         if (!$this->existPerson($id, $em)) {
             $person = new Person();
             $person->setId($people->getId())->setAdult($people->getAdult())->setAka($people->getAlsoKnownAs())->setBiography($people->getBiography())->setBirthday($people->getBirthday())->setDeathday($people->getDeathday())->setHomepage($people->getHomepage())->setName($people->getName())->setPlaceOfBirth($people->getPlaceOfBirth())->setProfilePath($people->getProfilePath());
             $uow = $em->getUnitOfWork();
             $cmf = $em->getMetadataFactory();
             $meta = $cmf->getMetadataFor(get_class($person));
             $em->persist($person);
             $uow->computeChangeSet($meta, $person);
         }
     }
 }