Newscoop\Entity\Article::getAttachments PHP Method

getAttachments() public method

Getter for attachments.
public getAttachments ( ) : ArrayCollection
return Doctrine\Common\Collections\ArrayCollection
    public function getAttachments()
    {
        if (count($this->attachments) == 0) {
            return;
        }
        return $this->attachments;
    }

Usage Example

 public function removeAttachmentFormArticle(Article $article, Attachment $attachment)
 {
     $article->getAttachments()->removeElement($attachment);
     $this->em->flush();
 }