/** * @param ChildBook $book The ChildBook object to remove. * @return $this|ChildPublisher The current object (for fluent API support) */ public function removeBook(ChildBook $book) { if ($this->getBooks()->contains($book)) { $pos = $this->collBooks->search($book); $this->collBooks->remove($pos); if (null === $this->booksScheduledForDeletion) { $this->booksScheduledForDeletion = clone $this->collBooks; $this->booksScheduledForDeletion->clear(); } $this->booksScheduledForDeletion[] = clone $book; $book->setPublisher(null); } return $this; }