public function __construct(Product $product, DTOBuilderFactoryInterface $dtoBuilderFactory) { $this->entity = $product; $this->dtoBuilderFactory = $dtoBuilderFactory; $this->initializeProductDTO(); $this->setId(); $this->setTime(); $this->entityDTO->slug = Slug::get($this->entity->getName()); $this->entityDTO->sku = $this->entity->getSku(); $this->entityDTO->name = $this->entity->getName(); $this->entityDTO->unitPrice = $this->entity->getUnitPrice(); $this->entityDTO->quantity = $this->entity->getQuantity(); $this->entityDTO->isInventoryRequired = $this->entity->isInventoryRequired(); $this->entityDTO->isPriceVisible = $this->entity->isPriceVisible(); $this->entityDTO->isVisible = $this->entity->isVisible(); $this->entityDTO->isActive = $this->entity->isActive(); $this->entityDTO->isTaxable = $this->entity->isTaxable(); $this->entityDTO->isShippable = $this->entity->isShippable(); $this->entityDTO->shippingWeight = $this->entity->getShippingWeight(); $this->entityDTO->description = $this->entity->getDescription(); $this->entityDTO->rating = $this->entity->getRating(); $this->entityDTO->defaultImage = $this->entity->getDefaultImage(); $this->entityDTO->isInStock = $this->entity->inStock(); $this->entityDTO->areAttachmentsEnabled = $this->entity->areAttachmentsEnabled(); }
public function areAttachmentsEnabled() { if ($this->product !== null) { return $this->product->areAttachmentsEnabled(); } return false; }
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; }
public function areAttachmentsEnabled() { return $this->product->areAttachmentsEnabled(); }