Example #1
0
 /**
  * @param  ChildNews $news The ChildNews object to remove.
  * @return $this|ChildFile The current object (for fluent API support)
  */
 public function removeNews(ChildNews $news)
 {
     if ($this->getNews()->contains($news)) {
         $pos = $this->collNews->search($news);
         $this->collNews->remove($pos);
         if (null === $this->newsScheduledForDeletion) {
             $this->newsScheduledForDeletion = clone $this->collNews;
             $this->newsScheduledForDeletion->clear();
         }
         $this->newsScheduledForDeletion[] = $news;
         $news->setFile(null);
     }
     return $this;
 }