Пример #1
0
 /**
  * @return OrganisationService
  */
 public function getOrganisationService()
 {
     if (is_null($this->organisationService)) {
         $this->organisationService = new OrganisationService();
         $organisation = new Organisation();
         $this->organisationService->setOrganisation($organisation);
     }
     return $this->organisationService;
 }
Пример #2
0
 /**
  * @param Contact $object
  *
  * @return array
  */
 public function extract($object)
 {
     $this->prepare($object);
     $values = $this->extractByValue($object);
     unset($values['phone']);
     foreach ($object->getPhone() as $phone) {
         $values['phone'][$phone->getType()->getId()]['phone'] = $phone->getPhone();
     }
     unset($values['address']);
     foreach ($object->getAddress() as $address) {
         if ($address->getType()->getId() === AddressType::ADDRESS_TYPE_MAIL) {
             $values['address']['address'] = $address->getAddress();
             $values['address']['zipCode'] = $address->getZipCode();
             $values['address']['city'] = $address->getCity();
             $values['address']['country'] = $address->getCountry();
         }
     }
     unset($values['community']);
     foreach ($object->getCommunity() as $community) {
         $values['community'][$community->getType()->getId()]['community'] = $community->getCommunity();
     }
     unset($values['profile']);
     $values['profile']['visible'] = !is_null($object->getProfile()) ? $object->getProfile()->getVisible() : null;
     $values['profile']['description'] = !is_null($object->getProfile()) ? $object->getProfile()->getDescription() : null;
     /**
      * Set the contact organisation
      */
     $contactService = new ContactService();
     $contactService->setContact($object);
     if (!is_null($object->getContactOrganisation())) {
         $organisationService = new OrganisationService();
         $organisationService->setOrganisation($object->getContactOrganisation()->getOrganisation());
         $values['contact_organisation']['organisation'] = $organisationService->parseOrganisationWithBranch($contactService->getContact()->getContactOrganisation()->getBranch());
         if (!is_null($object->getContactOrganisation())) {
             $values['contact_organisation']['country'] = $object->getContactOrganisation()->getOrganisation()->getCountry()->getId();
         }
     }
     return $values;
 }