public function __construct(User $user, Product $product, Attachment $attachment, UuidInterface $id = null)
 {
     if (!$product->areAttachmentsEnabled()) {
         throw AttachmentException::notAllowed();
     }
     $this->setId($id);
     $this->setCreated();
     $this->user = $user;
     $this->product = $product;
     $this->attachment = $attachment;
 }
Exemplo n.º 2
0
 public function addAttachment(Attachment $attachment)
 {
     if (!$this->areAttachmentsEnabled()) {
         throw AttachmentException::notAllowed();
     }
     $this->attachments->add($attachment);
 }