Exemple #1
0
 public function destroy(Person $source, $idOfContact)
 {
     $contact = $this->retrieve($idOfContact);
     if ($source->getContacts()->contains($contact)) {
         $this->objectManager->remove($contact);
         /*
          * Note: Reflected contact might not be needed for other types of contacts.
          * TODO Implement DQL query for handling deletion of bidirectional contacts.
          */
         foreach ($contact->getTarget()->getContacts() as $reflectedContact) {
             if ($reflectedContact->getTarget()->getId() == $source->getId()) {
                 $this->objectManager->remove($reflectedContact);
             }
         }
         $this->objectManager->flush();
     }
 }
 /**
  * {@inheritDoc}
  */
 public function getContacts()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getContacts', array());
     return parent::getContacts();
 }