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\Order\OrderStatus;
-
- use domain\_\AbstractRepository;
- use yii\base\ErrorException;
-
- class OrderStatusRepository extends AbstractRepository
- {
- protected OrderStatusDefinition $orderStatusDefinition;
-
- public function loadDependencies(): void
- {
- $this->orderStatusDefinition = $this->loadService(OrderStatusDefinition::class);
- }
-
- public function getDefaultOptionsSearch(): array
- {
- return [];
- }
-
- public function getOrderStatusByAlias(string $alias): OrderStatus
- {
- $orderStatusArray = $this->orderStatusDefinition->getOrderStatusList();
-
- if(isset($orderStatusArray[$alias])) {
- return OrderStatusBuilder::getInstance()->instanciateOrderStatus(
- $alias,
- $orderStatusArray[$alias]['name']
- );
- }
- else {
- throw new ErrorException('Statut de commande introuvable : '.$alias);
- }
- }
- }
|