/** * @return \Zend\Http\Response|ViewModel * * @throws \Doctrine\ORM\ORMException */ public function financialAction() { $affiliationService = $this->getAffiliationService()->setAffiliationId($this->getEvent()->getRouteMatch()->getParam('id')); if ($affiliationService->isEmpty()) { return $this->notFoundAction(); } /** @var ProjectService $projectService */ $projectService = $this->getProjectService()->setProject($affiliationService->getAffiliation()->getProject()); if ($projectService->isEmpty()) { return $this->notFoundAction(); } /** @var OrganisationService $organisationService */ $organisationService = $this->getOrganisationService()->setOrganisation($affiliationService->getAffiliation()->getOrganisation()); if ($organisationService->isEmpty()) { return $this->notFoundAction(); } $formData = ['preferredDelivery' => \Organisation\Entity\Financial::EMAIL_DELIVERY, 'omitContact' => \Organisation\Entity\Financial::OMIT_CONTACT]; $branch = null; $financialAddress = null; $organisationFinancial = null; if (!is_null($affiliationService->getAffiliation()->getFinancial())) { //We have a financial organisation, so populate the form with this data $organisationService = $this->getOrganisationService()->setOrganisation($affiliationService->getAffiliation()->getFinancial()->getOrganisation()); $organisationFinancial = $affiliationService->getAffiliation()->getFinancial()->getOrganisation()->getFinancial(); $branch = $affiliationService->getAffiliation()->getFinancial()->getBranch(); $formData['attention'] = $affiliationService->getAffiliation()->getFinancial()->getContact()->getDisplayName(); /** @var ContactService $contactService */ $contactService = $this->getContactService()->setContact($affiliationService->getAffiliation()->getFinancial()->getContact()); $formData['contact'] = $affiliationService->getAffiliation()->getFinancial()->getContact()->getId(); if (!is_null($financialAddress = $contactService->getFinancialAddress())) { $financialAddress = $contactService->getFinancialAddress()->getAddress(); $formData['address'] = $financialAddress->getAddress(); $formData['zipCode'] = $financialAddress->getZipCode(); $formData['city'] = $financialAddress->getCity(); $formData['country'] = $financialAddress->getCountry()->getId(); } } $formData['organisation'] = $organisationService->parseOrganisationWithBranch($branch); $formData['registeredCountry'] = $organisationService->getOrganisation()->getCountry()->getId(); if (!is_null($organisationFinancial)) { $organisationFinancial = $affiliationService->getAffiliation()->getOrganisation()->getFinancial(); $formData['preferredDelivery'] = $organisationFinancial->getEmail(); $formData['vat'] = $organisationFinancial->getVat(); $formData['omitContact'] = $organisationFinancial->getOmitContact(); } $form = new FinancialForm($affiliationService, $this->getGeneralService()); $form->setData($formData); if ($this->getRequest()->isPost() && $form->setData($_POST) && $form->isValid()) { $formData = $form->getData(); //We need to find the organisation, first by tring the VAT, then via the name and country and then just create it $organisation = null; //Check if an organisation with the given VAT is already found $organisationFinancial = $this->getOrganisationService()->findFinancialOrganisationWithVAT($formData['vat']); //If the organisation is found, it has by default an organiation if (!is_null($organisationFinancial)) { $organisation = $organisationFinancial->getOrganisation(); } //try to find the organisation based on te country and name if (is_null($organisation)) { $organisation = $this->getOrganisationService()->findOrganisationByNameCountry(trim($formData['organisation']), $this->getGeneralService()->findEntityById('Country', $formData['country'])); } /** * If the organisation is still not found, create it */ if (is_null($organisation)) { $organisation = new Organisation(); $organisation->setOrganisation($formData['organisation']); $organisation->setCountry($this->getGeneralService()->findEntityById('Country', $formData['country'])); /** * @var $organisationType Type */ $organisationType = $this->getOrganisationService()->getEntityManager()->getReference('Organisation\\Entity\\Type', 0); $organisation->setType($organisationType); } /** * * Update the affiliationFinancial */ $affiliationFinancial = $this->getAffiliationService()->getAffiliation()->getFinancial(); if (is_null($affiliationFinancial)) { $affiliationFinancial = new Financial(); $affiliationFinancial->setAffiliation($this->getAffiliationService()->getAffiliation()); } $affiliationFinancial->setContact($this->getContactService()->setContactId($formData['contact'])->getContact()); $affiliationFinancial->setOrganisation($organisation); $affiliationFinancial->setBranch(trim(substr($formData['organisation'], strlen($organisation->getOrganisation())))); $this->getAffiliationService()->updateEntity($affiliationFinancial); if (!is_null($affiliationService->getAffiliation()->getFinancial())) { $organisationFinancial = $affiliationService->getAffiliation()->getFinancial()->getOrganisation()->getFinancial(); } else { $organisationFinancial = $affiliationService->getAffiliation()->getOrganisation()->getFinancial(); } if (is_null($organisationFinancial)) { $organisationFinancial = new \Organisation\Entity\Financial(); } $organisationFinancial->setOrganisation($organisation); /** * The presence of a VAT number triggers the creation of a financial organisation */ if (!empty($formData['vat'])) { $organisationFinancial->setVat($formData['vat']); //Do an in-situ vat check $vies = new Vies(); try { $result = $vies->validateVat($organisationFinancial->getOrganisation()->getCountry()->getCd(), trim(str_replace($organisationFinancial->getOrganisation()->getCountry()->getCd(), '', $formData['vat']))); if ($result->isValid()) { $this->flashMessenger()->setNamespace('success')->addMessage(sprintf($this->translate("txt-vat-number-is-valid"), $affiliationService->getAffiliation())); //Update the financial $organisationFinancial->setVatStatus(\Organisation\Entity\Financial::VAT_STATUS_VALID); $organisationFinancial->setDateVat(new \DateTime()); } else { //Update the financial $organisationFinancial->setVatStatus(\Organisation\Entity\Financial::VAT_STATUS_INVALID); $organisationFinancial->setDateVat(new \DateTime()); $this->flashMessenger()->setNamespace('error')->addMessage(sprintf($this->translate("txt-vat-number-is-invalid"), $affiliationService->getAffiliation())); } } catch (\Exception $e) { $this->flashMessenger()->setNamespace('danger')->addMessage(sprintf($this->translate("txt-vat-information-could-not-be-verified"), $affiliationService->getAffiliation())); } } else { $organisationFinancial->setVat(null); } $organisationFinancial->setEmail($formData['preferredDelivery']); $organisationFinancial->setOmitContact($formData['omitContact']); $this->getOrganisationService()->updateEntity($organisationFinancial); /* * save the financial address */ $contactService = clone $this->getContactService()->setContact($affiliationFinancial->getContact()); if (!is_null($contactService->getFinancialAddress())) { $financialAddress = $contactService->getFinancialAddress()->getAddress(); } else { $financialAddress = new Address(); $financialAddress->setContact($affiliationService->getAffiliation()->getFinancial()->getContact()); /** * @var $addressType AddressType */ $addressType = $this->getContactService()->getEntityManager()->getReference('Contact\\Entity\\AddressType', AddressType::ADDRESS_TYPE_FINANCIAL); $financialAddress->setType($addressType); } $financialAddress->setAddress($formData['address']); $financialAddress->setZipCode($formData['zipCode']); $financialAddress->setCity($formData['city']); /** * @var Country $country */ $country = $this->getContactService()->getEntityManager()->getReference('General\\Entity\\Country', $formData['country']); $financialAddress->setCountry($country); $this->getContactService()->updateEntity($financialAddress); $this->flashMessenger()->setNamespace('success')->addMessage(sprintf($this->translate("txt-affiliation-%s-has-successfully-been-updated"), $affiliationService->getAffiliation())); return $this->redirect()->toRoute('community/affiliation/affiliation', ['id' => $affiliationService->getAffiliation()->getId()], ['fragment' => 'invoicing']); } return new ViewModel(['affiliationService' => $affiliationService, 'projectService' => $projectService, 'form' => $form]); }
/** * @return \Zend\Http\Response|ViewModel * @throws \Doctrine\ORM\ORMException */ public function financialAction() { $affiliationService = $this->getAffiliationService()->setAffiliationId($this->getEvent()->getRouteMatch()->getParam('id')); if ($affiliationService->isEmpty()) { return $this->notFoundAction(); } $projectService = $this->getProjectService()->setProject($affiliationService->getAffiliation()->getProject()); if ($projectService->isEmpty()) { return $this->notFoundAction(); } $organisationService = $this->getOrganisationService()->setOrganisation($affiliationService->getAffiliation()->getOrganisation()); if ($organisationService->isEmpty()) { return $this->notFoundAction(); } $formData = []; $branch = null; $financialAddress = null; if (!is_null($affiliationService->getAffiliation()->getFinancial())) { $branch = $affiliationService->getAffiliation()->getFinancial()->getBranch(); $formData['attention'] = $affiliationService->getAffiliation()->getFinancial()->getContact()->getDisplayName(); $contactService = clone $this->getContactService()->setContact($affiliationService->getAffiliation()->getFinancial()->getContact()); $formData['contact'] = $affiliationService->getAffiliation()->getFinancial()->getContact()->getId(); if (!is_null($financialAddress = $contactService->getFinancialAddress())) { $financialAddress = $contactService->getFinancialAddress()->getAddress(); $formData['address'] = $financialAddress->getAddress(); $formData['zipCode'] = $financialAddress->getZipCode(); $formData['city'] = $financialAddress->getCity(); $formData['country'] = $financialAddress->getCountry()->getId(); } } $formData['organisation'] = $organisationService->parseOrganisationWithBranch($branch); $formData['registeredCountry'] = $organisationService->getOrganisation()->getCountry()->getId(); if (!is_null($organisationFinancial = $affiliationService->getAffiliation()->getOrganisation()->getFinancial())) { $formData['preferredDelivery'] = $organisationFinancial->getEmail(); $formData['vat'] = $organisationFinancial->getVat(); $formData['omitContact'] = $organisationFinancial->getOmitContact(); } $form = new FinancialForm($affiliationService, $this->getGeneralService()); $form->setData($formData); if ($this->getRequest()->isPost() && $form->setData($_POST) && $form->isValid()) { $formData = $form->getData(); /** * This form is a aggregation of multiple form elements, so we treat it step by step */ /** * If the organisation or country has changed or is not set, find the new */ if ($formData['organisation'] !== $organisationService->parseOrganisationWithBranch($branch) || is_null($financialAddress) || intval($formData['country']) !== $financialAddress->getCountry()->getId() || intval($formData['contact']) !== $financialAddress->getContact()->getId()) { /** * The organisation, or country has changed, so try to find this country in the database */ $organisation = $this->getOrganisationService()->findOrganisationByNameCountry(trim($formData['organisation']), $this->getGeneralService()->findEntityById('Country', $formData['country'])); /** * If the organisation is not found, create it */ if (is_null($organisation)) { $organisation = new Organisation(); $organisation->setOrganisation($formData['organisation']); $organisation->setCountry($this->getGeneralService()->findEntityById('Country', $formData['country'])); /** * @var $organisationType OrganisationType */ $organisationType = $this->getOrganisationService()->getEntityManager()->getReference('Organisation\\Entity\\Type', 0); $organisation->setType($organisationType); } $affiliationFinancial = $this->getAffiliationService()->getAffiliation()->getFinancial(); if (is_null($affiliationFinancial)) { $affiliationFinancial = new Financial(); $affiliationFinancial->setAffiliation($this->getAffiliationService()->getAffiliation()); } $affiliationFinancial->setContact($this->getContactService()->setContactId($formData['contact'])->getContact()); $affiliationFinancial->setOrganisation($organisation); $affiliationFinancial->setBranch(trim(substr($formData['organisation'], strlen($organisation->getOrganisation())))); $this->getAffiliationService()->updateEntity($affiliationFinancial); } else { $affiliationFinancial = $this->getAffiliationService()->getAffiliation()->getFinancial(); } /** * The presence of a VAT number triggers the creation of a financial organisation */ if (!empty($formData['vat'])) { if (is_null($affiliationService->getAffiliation()->getOrganisation()->getFinancial())) { $organisationFinancial = new \Organisation\Entity\Financial(); } else { $organisationFinancial = $affiliationService->getAffiliation()->getOrganisation()->getFinancial(); } $organisationFinancial->setOrganisation($affiliationService->getAffiliation()->getOrganisation()); $organisationFinancial->setVat($formData['vat']); $organisationFinancial->setEmail($formData['preferredDelivery']); $organisationFinancial->setOmitContact($formData['omitContact']); $this->getOrganisationService()->updateEntity($organisationFinancial); } /** * save the financial address */ $contactService = clone $this->getContactService()->setContact($affiliationFinancial->getContact()); if (!is_null($contactService->getFinancialAddress())) { $financialAddress = $contactService->getFinancialAddress()->getAddress(); } else { $financialAddress = new Address(); $financialAddress->setContact($affiliationService->getAffiliation()->getFinancial()->getContact()); /** * @var $addressType AddressType */ $addressType = $this->getContactService()->getEntityManager()->getReference('Contact\\Entity\\AddressType', AddressType::ADDRESS_TYPE_FINANCIAL); $financialAddress->setType($addressType); } $financialAddress->setAddress($formData['address']); $financialAddress->setZipCode($formData['zipCode']); $financialAddress->setCity($formData['city']); /** * @var $country Country */ $country = $this->getContactService()->getEntityManager()->getReference('General\\Entity\\Country', $formData['country']); $financialAddress->setCountry($country); $this->getContactService()->updateEntity($financialAddress); $this->flashMessenger()->setNamespace('success')->addMessage(sprintf(_("txt-affiliation-%s-has-successfully-been-updated"), $affiliationService->getAffiliation())); return $this->redirect()->toRoute('community/affiliation/affiliation', ['id' => $affiliationService->getAffiliation()->getId()]); } return new ViewModel(['affiliationService' => $affiliationService, 'projectService' => $projectService, 'form' => $form]); }
/** * Body function, creating the contactObjects. */ private function prepareContent() { foreach ($this->content as $key => $content) { //See first if the contact can be found $contact = $this->getContactService()->findContactByEmail($content[$this->headerKeys['email']]); if (!is_null($contact)) { $contact->key = $key; $this->contacts[] = $contact; continue; } /** * 'organisation_id' => int 0 * 'organisation' => int 1 * 'firstname' => int 2 * 'middlename' => int 3 * 'lastname' => int 4 * 'position' => int 5 * 'email' => int 6 * 'phone' => int 7 * 'country' => int 8 * 'gender' => int 8 * 'title' => int 8 */ //Contact is not found $contact = new Contact(); $contact->key = $key; $contact->setFirstName($content[$this->headerKeys['firstname']]); $contact->setMiddleName($content[$this->headerKeys['middlename']]); $contact->setLastName($content[$this->headerKeys['lastname']]); $contact->setEmail($content[$this->headerKeys['email']]); $gender = null; $title = null; if (isset($this->headerKeys['gender']) && !empty($content[$this->headerKeys['gender']])) { $gender = $contact->setGender($this->getGeneralService()->findGenderByGender($content[$this->headerKeys['gender']])); } if (!is_null($gender)) { $contact->setGender($gender); } else { $contact->setGender($this->getGeneralService()->findEntityById('gender', Gender::GENDER_UNKNOWN)); } if (isset($this->headerKeys['title']) && !empty($content[$this->headerKeys['title']])) { $title = $contact->setTitle($this->getGeneralService()->findTitleByTitle($content[$this->headerKeys['title']])); } if (!is_null($title)) { $contact->setTitle($title); } else { $contact->setTitle($this->getGeneralService()->findEntityById('title', Title::TITLE_UNKNOWN)); } $contact->setPosition($content[$this->headerKeys['position']]); //If found, set the phone number if (isset($this->headerKeys['phone']) && !empty($content[$this->headerKeys['phone']])) { $phone = new Phone(); $phoneType = $this->getContactService()->findEntityById('phoneType', PhoneType::PHONE_TYPE_DIRECT); $phone->setType($phoneType); $phone->setPhone($content[$this->headerKeys['phone']]); $phone->setContact($contact); $phones = new ArrayCollection(); $phones->add($phone); $contact->setPhone($phones); } //Try to find the country $country = $this->getGeneralService()->findCountryByName($content[$this->headerKeys['country']]); //Try to find the organisation $organisationName = $content[$this->headerKeys['organisation']]; $organisation = null; if (isset($this->headerKeys['organisation_id']) && !empty($content[$this->headerKeys['organisation_id']])) { $organisation = $this->getOrganisationService()->setOrganisationId($content[$this->headerKeys['organisation_id']])->getOrganisation(); } if (is_null($organisation) && !is_null($country)) { $organisation = $this->getOrganisationService()->findOrganisationByNameCountry($organisationName, $country); } //If the organisation does not exist, create it if (is_null($organisation) && !is_null($country)) { $organisation = new Organisation(); $organisation->setOrganisation($organisationName); $organisation->setCountry($country); //Add the type $organisationType = $this->getOrganisationService()->findEntityById('type', Type::TYPE_UNKNOWN); $organisation->setType($organisationType); //Add the domain $validate = new EmailAddress(); $validate->isValid($content[$this->headerKeys['email']]); $organisationWebElements = new ArrayCollection(); $organisationWeb = new Web(); $organisationWeb->setWeb($validate->hostname); $organisationWeb->setMain(Web::MAIN); $organisationWeb->setOrganisation($organisation); $organisationWebElements->add($organisationWeb); if (isset($this->headerKeys['website']) && !is_null($content[$this->headerKeys['website']])) { //Strip the http:// and https:// $website = str_replace('http://', '', $content[$this->headerKeys['website']]); $website = str_replace('https://', '', $website); $organisationWebsite = new Web(); $organisationWebsite->setMain(Web::MAIN); $organisationWebsite->setWeb($website); $organisationWebsite->setOrganisation($organisation); $organisationWebElements->add($organisationWebsite); } $organisation->setWeb($organisationWebElements); } /** * If an organisation is found, add it to the contact */ if (!is_null($organisation)) { $contactOrganisation = new ContactOrganisation(); $contactOrganisation->setOrganisation($organisation); $contactOrganisation->setContact($contact); $contact->setContactOrganisation($contactOrganisation); } /** Add the contact to the contacts array */ $this->contacts[] = $contact; } }
/** * We use this function to update the contactOrganisation of a user. * As input we use the corresponding contact entity and the array containing the * contactOrganisation information. * * $contactOrganisation['organisation_id'] > id of the chosen organisation * $contactOrganisation['branch'] > value of the branch (if an organisation_id is chosen) * $contactOrganisation['organisation'] > Name of the organisation * $contactOrganisation['country'] > CountryId * * @param Contact $contact * @param array $contactOrganisation */ public function updateContactOrganisation(Contact $contact, array $contactOrganisation) { /** * Find the current contactOrganisation, or create a new one if this empty (in case of a new contact) */ $currentContactOrganisation = $contact->getContactOrganisation(); if (is_null($currentContactOrganisation)) { $currentContactOrganisation = new ContactOrganisation(); $currentContactOrganisation->setContact($contact); } /** * The trigger for this update is the presence of a $contactOrganisation['organisation_id']. * If this value != 0, a choice has been made from the dropdown and we will then take the branch as default */ if (isset($contactOrganisation['organisation_id']) && $contactOrganisation['organisation_id'] != '0') { $organisation = $this->getOrganisationService()->findEntityById('organisation', (int) $contactOrganisation['organisation_id']); $currentContactOrganisation->setOrganisation($organisation); //Take te branch form the form element ($contactOrganisation['branch']) if (!empty($contactOrganisation['branch'])) { $currentContactOrganisation->setBranch($contactOrganisation['branch']); } else { $currentContactOrganisation->setBranch(null); } } else { /** * No organisation is chosen (the option 'none of the above' was taken, so create the organisation */ /** * Don't do anything when the organisationName = empty */ if (empty($contactOrganisation['organisation'])) { return; } $country = $this->getGeneralService()->findEntityById('country', (int) $contactOrganisation['country']); /* * Look for the organisation based on the name (without branch) and country + email */ $organisation = $this->getOrganisationService()->findOrganisationByNameCountryAndEmailAddress($contactOrganisation['organisation'], $country, $contact->getEmail()); $organisationFound = false; /* * We did not find an organisation, so we need to create it */ if (sizeof($organisation) === 0) { $organisation = new Organisation(); $organisation->setOrganisation($contactOrganisation['organisation']); $organisation->setCountry($country); $organisation->setType($this->organisationService->findEntityById('Type', 0)); //Unknown /* * Add the domain in the saved domains for this new company * Use the ZF2 EmailAddress validator to strip the hostname out of the EmailAddress */ $validateEmail = new EmailAddress(); $validateEmail->isValid($contact->getEmail()); $organisationWeb = new Web(); $organisationWeb->setOrganisation($organisation); $organisationWeb->setWeb($validateEmail->hostname); $organisationWeb->setMain(Web::MAIN); //Skip hostnames like yahoo, gmail and hotmail, outlook if (!in_array($organisation->getWeb(), ['gmail.com', 'hotmail.com', 'outlook.com', 'yahoo.com'])) { $this->getOrganisationService()->newEntity($organisationWeb); } $currentContactOrganisation->setOrganisation($organisation); } else { $foundOrganisation = null; /* * Go over the found organisation to match the branching */ foreach ($organisation as $foundOrganisation) { /* * Stop when we have found an exact match and reset the branch if set */ if ($foundOrganisation->getOrganisation() === $contactOrganisation['organisation'] && $country->getId() === $foundOrganisation->getCountry()->getId()) { $currentContactOrganisation->setOrganisation($foundOrganisation); $currentContactOrganisation->setBranch(null); break; } if (!$organisationFound) { //Create only a branch when the name is found and the given names do not match in length if (strlen($foundOrganisation->getOrganisation()) < strlen($contactOrganisation['organisation']) - strlen($currentContactOrganisation->getBranch())) { $currentContactOrganisation->setBranch(str_replace($contactOrganisation['organisation'], '~', $foundOrganisation->getOrganisation())); } else { //Reset the branch otherwise $currentContactOrganisation->setBranch(null); } /* * We have found a match of the organisation in the string and */ $organisationFound = true; } } $currentContactOrganisation->setOrganisation($foundOrganisation); } } $this->updateEntity($currentContactOrganisation); }
/** * We use this function to update the contactOrganisation of a user. * As input we use the corresponding contact entity and the array containing the * contactOrganisation information * * $contactOrganisation['organisation'] > Name of the organisation * $contactOrganisation['country'] > CountryId * * @param Contact $contact * @param array $contactOrganisation * * @return void */ public function updateContactOrganisation(Contact $contact, array $contactOrganisation) { /** * Don't do anything when the organisationName = empty */ if (empty($contactOrganisation['organisation'])) { return; } $country = $this->getGeneralService()->findEntityById('country', (int) $contactOrganisation['country']); $currentContactOrganisation = $contact->getContactOrganisation(); if (is_null($currentContactOrganisation)) { $currentContactOrganisation = new ContactOrganisation(); $currentContactOrganisation->setContact($contact); } /** * Look for the organisation based on the name (without branch) and country + email */ $organisation = $this->getOrganisationService()->findOrganisationByNameCountryAndEmailAddress($contactOrganisation['organisation'], $country, $contact->getEmail()); $organisationFound = false; /** * We did not find an organisation, so we need to create it */ if (sizeof($organisation) === 0) { $organisation = new Organisation(); $organisation->setOrganisation($contactOrganisation['organisation']); $organisation->setCountry($country); $organisation->setType($this->organisationService->findEntityById('Type', 0)); //Unknown /** * Add the domain in the saved domains for this new company * Use the ZF2 EmailAddress validator to strip the hostname out of the EmailAddress */ $validateEmail = new EmailAddress(); $validateEmail->isValid($contact->getEmail()); $organisationWeb = new Web(); $organisationWeb->setOrganisation($organisation); $organisationWeb->setWeb($validateEmail->hostname); $organisationWeb->setMain(Web::MAIN); $this->getOrganisationService()->newEntity($organisationWeb); $currentContactOrganisation->setOrganisation($organisation); } else { $foundOrganisation = null; /** * Go over the found organisation to match the branching */ foreach ($organisation as $foundOrganisation) { /** * Stop when we have found an exact match and reset the branch if set */ if ($foundOrganisation->getOrganisation() === $contactOrganisation['organisation'] && $country->getId() === $foundOrganisation->getCountry()->getId()) { $currentContactOrganisation->setOrganisation($foundOrganisation); $currentContactOrganisation->setBranch(null); break; } if (!$organisationFound) { //Create only a branch when the name is found and the given names do not match in length if (strlen($foundOrganisation->getOrganisation()) < strlen($contactOrganisation['organisation']) - strlen($currentContactOrganisation->getBranch())) { $currentContactOrganisation->setBranch(str_replace($contactOrganisation['organisation'], '~', $foundOrganisation->getOrganisation())); } /** * We have found a match of the organisation in the string and */ $organisationFound = true; } } $currentContactOrganisation->setOrganisation($foundOrganisation); } $this->updateEntity($currentContactOrganisation); }