/** * {@inheritDoc} */ public function setUp() { $this->serviceManager = Bootstrap::getServiceManager(); $this->doa = new Doa(); $this->doa->setId(1); $program = new Program(); $program->setId(1); $program->setProgram('Program'); $this->doa->setProgram($program); $organisation = new Organisation(); $organisation->setId(1); $organisation->setOrganisation("Organisation"); $this->doa->setOrganisation($organisation); $this->authorizeService = $this->serviceManager->get('BjyAuthorize\\Service\\Authorize'); if (!$this->authorizeService->getAcl()->hasResource($this->doa)) { $this->authorizeService->getAcl()->addResource($this->doa); $this->authorizeService->getAcl()->allow([], $this->doa, []); } /** * Add the resource on the fly */ if (!$this->authorizeService->getAcl()->hasResource(new Doa())) { $this->authorizeService->getAcl()->addResource(new Doa()); } $this->authorizeService->getAcl()->allow([], new Doa(), []); $this->doaLink = $this->serviceManager->get('viewhelpermanager')->get('programDoaLink'); /** * Bootstrap the application to have the other information available */ $application = $this->serviceManager->get('application'); $application->bootstrap(); }
/** * @param Contact $contact * * @return array */ public function findOrganisationForProfileEditByContact(Contact $contact) { $organisations = []; //Start with your own organisation if (!is_null($contact->getContactOrganisation())) { $organisations[$contact->getContactOrganisation()->getOrganisation()->getId()] = $contact->getContactOrganisation()->getOrganisation(); } foreach ($this->findOrganisationByEmailAddress($contact->getEmail()) as $organisation) { $organisations[$organisation->getId()] = $organisation; } asort($organisations); //Add an empty value $emptyOrganisation = new Entity\Organisation(); $emptyOrganisation->setId(0); $emptyOrganisation->setOrganisation('— None of the above'); $organisations[$emptyOrganisation->getId()] = $emptyOrganisation; return $organisations; }