/** * @param ChildComment $comment The ChildComment object to remove. * @return $this|ChildNote The current object (for fluent API support) */ public function removeComment(ChildComment $comment) { if ($this->getComments()->contains($comment)) { $pos = $this->collComments->search($comment); $this->collComments->remove($pos); if (null === $this->commentsScheduledForDeletion) { $this->commentsScheduledForDeletion = clone $this->collComments; $this->commentsScheduledForDeletion->clear(); } $this->commentsScheduledForDeletion[] = clone $comment; $comment->setNote(null); } return $this; }