|
- <?php
-
- namespace domain\Product\Accessory;
-
- use domain\_\AbstractManager;
- use domain\Producer\Producer\Producer;
-
- class AccessoryManager extends AbstractManager
- {
- protected AccessoryBuilder $accessoryBuilder;
-
- public function loadDependencies(): void
- {
- $this->accessoryBuilder = $this->loadService(AccessoryBuilder::class);
- }
-
- public function createAccessory(Producer $producer, string $name, ?int $quantity): Accessory
- {
- $accessory = $this->accessoryBuilder->instanciateAccessory($producer);
- $accessory->setName($name);
- $accessory->setQuantity($quantity);
- $accessory->save();
- return $accessory;
- }
- }
|