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.

25 lines
675B

  1. <?php
  2. namespace domain\Product\Accessory;
  3. use domain\_\AbstractManager;
  4. use domain\Producer\Producer\Producer;
  5. class AccessoryManager extends AbstractManager
  6. {
  7. protected AccessoryBuilder $accessoryBuilder;
  8. public function loadDependencies(): void
  9. {
  10. $this->accessoryBuilder = $this->loadService(AccessoryBuilder::class);
  11. }
  12. public function createAccessory(Producer $producer, string $name, ?int $quantity): Accessory
  13. {
  14. $accessory = $this->accessoryBuilder->instanciateAccessory($producer);
  15. $accessory->setName($name);
  16. $accessory->setQuantity($quantity);
  17. $accessory->save();
  18. return $accessory;
  19. }
  20. }