/** * Takes $account that is user attempting to delete phone number to the database * and id of phone number to delete. * If the user appears to be the owner of the phone number, delete the phone number. * Do nothing overwise. * @param \Application\Entity\Account $account * @param string $phoneNumberId */ public function destroy(\Application\Entity\Account $account, $phoneNumberId) { $phoneNumber = $this->retrieve($phoneNumberId); if ($account->getPerson()->getPhoneNumbers()->contains($phoneNumber)) { $this->objectManager->remove($phoneNumber); $this->objectManager->flush(); } }
/** * Takes $account that is user attempting to delete e-mail address to the database * and id of e-mail address to delete. * If the user appears to be the owner of the e-mail address, delete the e-mail address. * Do nothing overwise. * @param \Application\Entity\Account $account * @param string $emailAddressId */ public function destroy(\Application\Entity\Account $account, $emailAddressId) { $emailAddress = $this->retrieve($emailAddressId); if ($account->getPerson()->getEMailAddresses()->contains($emailAddress)) { $this->objectManager->remove($emailAddress); $this->objectManager->flush(); } }