Sulu\Bundle\ContactBundle\Entity\Contact::removeNote PHP Метод

removeNote() публичный Метод

public removeNote ( Note $note )
$note Note
    public function removeNote(Note $note)
    {
        $this->notes->removeElement($note);
    }

Usage Example

Пример #1
0
 /**
  * Process all notes from request.
  *
  * @param Contact $contact The contact on which is worked
  * @param $notes
  *
  * @return bool True if the processing was successful, otherwise false
  */
 public function processNotes($contact, $notes)
 {
     $get = function ($note) {
         return $note->getId();
     };
     $delete = function ($note) use($contact) {
         $contact->removeNote($note);
         return true;
     };
     $update = function ($note, $matchedEntry) {
         return $this->updateNote($note, $matchedEntry);
     };
     $add = function ($note) use($contact) {
         return $this->addNote($contact, $note);
     };
     $entities = $contact->getNotes();
     $result = $this->processSubEntities($entities, $notes, $get, $add, $update, $delete);
     $this->resetIndexOfSubentites($entities);
     return $result;
 }