You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- <?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;
- }
- }
|