Nelze vybrat více než 25 témat
Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
|
- <?php
-
- namespace domain\Product\RotatingProduct;
-
- use domain\_\AbstractBuilder;
- use domain\_\StatusInterface;
- use domain\Product\Rotating\Rotating;
-
- class RotatingProductBuilder extends AbstractBuilder
- {
- protected RotatingProductRepository $rotatingProductRepository;
-
- public function loadDependencies(): void
- {
- $this->rotatingProductRepository = $this->loadService(RotatingProductRepository::class);
- }
-
- public function instanciateRotatingProduct(Rotating $rotating): RotatingProduct
- {
- $rotatingProduct = new RotatingProduct();
- $rotatingProduct
- ->setRotating($rotating)
- ->setStatus(StatusInterface::STATUS_ONLINE);
-
- return $rotatingProduct;
- }
-
- public function initRotatingProductPosition(RotatingProduct $rotatingProduct): RotatingProduct
- {
- $lastRotatingProduct = $this->rotatingProductRepository->findOneLastRotatingProduct($rotatingProduct->getRotating());
- $rotatingProduct->setPosition($lastRotatingProduct->getPosition() + 1);
- return $rotatingProduct;
- }
- }
|