예제 #1
0
 /**
  * @param Contact $entity
  */
 protected function processSingleRelations(Contact $entity)
 {
     // update source
     $source = $entity->getSource();
     if ($source) {
         $entity->setSource($this->findExistingEntity($source));
     }
     // update method
     $method = $entity->getMethod();
     if ($method) {
         $entity->setMethod($this->findExistingEntity($method));
     }
     // update assigned to
     $assignedTo = $entity->getAssignedTo();
     if ($assignedTo) {
         $entity->setAssignedTo($this->findExistingEntity($assignedTo));
     }
     // clear reports to
     $entity->setReportsTo(null);
     // update created by
     $createdBy = $entity->getCreatedBy();
     if ($createdBy) {
         $entity->setCreatedBy($this->findExistingEntity($createdBy));
     }
     // update updated by
     $updatedBy = $entity->getUpdatedBy();
     if ($updatedBy) {
         $entity->setUpdatedBy($this->findExistingEntity($updatedBy));
     }
 }
예제 #2
0
 /**
  * @param Contact $contact
  * @param EntityManager $entityManager
  */
 protected function setCreatedProperties(Contact $contact, EntityManager $entityManager)
 {
     if (!$contact->getCreatedAt()) {
         $contact->setCreatedAt(new \DateTime('now', new \DateTimeZone('UTC')));
     }
     if (!$contact->getCreatedBy()) {
         $contact->setCreatedBy($this->getUser($entityManager));
     }
 }