Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

AccessoryRepository.php 934B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace domain\Product\Accessory;
  3. use domain\_\AbstractRepository;
  4. use domain\_\RepositoryQueryInterface;
  5. use yii\db\ActiveQuery;
  6. class AccessoryRepository extends AbstractRepository
  7. {
  8. protected AccessoryRepositoryQuery $query;
  9. public function loadDependencies(): void
  10. {
  11. $this->loadQuery(AccessoryRepositoryQuery::class);
  12. }
  13. public function getDefaultOptionsSearch(): array
  14. {
  15. return [
  16. self::WITH => [],
  17. self::JOIN_WITH => [],
  18. self::ORDER_BY => 'accessory.name ASC',
  19. self::ATTRIBUTE_ID_PRODUCER => 'accessory.id_producer'
  20. ];
  21. }
  22. public function queryAccessories(): RepositoryQueryInterface
  23. {
  24. return $this->createDefaultQuery();
  25. }
  26. public function findOneAccessoryById(int $id): ?Accessory
  27. {
  28. return $this->createDefaultQuery()
  29. ->filterById($id)
  30. ->findOne();
  31. }
  32. }