Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 public function __construct(Tag $tag, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $tag;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = $this->getEntityDTO();
     $this->setId();
     $this->setTime();
     $this->entityDTO->slug = Slug::get($this->entity->getName());
     $this->entityDTO->name = $this->entity->getName();
     $this->entityDTO->code = $this->entity->getCode();
     $this->entityDTO->description = $this->entity->getDescription();
     $this->entityDTO->defaultImage = $this->entity->getDefaultImage();
     $this->entityDTO->sortOrder = $this->entity->getSortOrder();
     $this->entityDTO->isVisible = $this->entity->isVisible();
     $this->entityDTO->isActive = $this->entity->isActive();
     $this->entityDTO->areAttachmentsEnabled = $this->entity->areAttachmentsEnabled();
 }
Ejemplo n.º 3
0
 public function getFilters()
 {
     return [new Twig_SimpleFilter('ceil', 'ceil'), new Twig_SimpleFilter('floor', 'floor'), new Twig_SimpleFilter('displayPrice', function ($price) {
         return '$' . number_format($price / 100, 2);
     }), new Twig_SimpleFilter('floatPrice', function ($price) {
         return number_format($price / 100, 2, null, '');
     }), new Twig_SimpleFilter('displayPromotionValue', function (AbstractPromotionDTO $promotion) {
         if ($promotion->type->isFixed || $promotion->type->isExact) {
             return '$' . number_format($promotion->value / 100, 2);
         } elseif ($promotion->type->isPercent) {
             return $promotion->value . '%';
         }
     }), new Twig_SimpleFilter('formatDate', function (DateTime $dateTime = null) {
         if ($dateTime === null) {
             return '';
         }
         $format = $this->dateFormat . ' ' . $this->timeFormat;
         $output = clone $dateTime;
         $output->setTimezone(new DateTimeZone($this->timezone));
         return $output->format($format);
     }), new Twig_SimpleFilter('slug', function ($string) {
         return Slug::get($string);
     })];
 }