您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

UnitStore.php 1.4KB

3 年前
3 年前
3 年前
3 年前
3 年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Config;
  3. use Lc\SovBundle\Repository\AbstractStore;
  4. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  5. class UnitStore extends AbstractStore
  6. {
  7. protected UnitRepositoryQuery $query;
  8. public function __construct(UnitRepositoryQuery $query)
  9. {
  10. $this->query = $query;
  11. }
  12. public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  13. {
  14. $query->orderBy('id');
  15. return $query;
  16. }
  17. public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  18. {
  19. return $query;
  20. }
  21. public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  22. {
  23. return $query;
  24. }
  25. public function getAsArray($query = null)
  26. {
  27. $query = $this->createDefaultQuery($query);
  28. foreach ($query->find() as $unit) {
  29. $unitsList[$unit->getId()]['unit'] = $unit->getUnit();
  30. $unitsList[$unit->getId()]['wordingUnit'] = $unit->getWordingUnit();
  31. $unitsList[$unit->getId()]['wording'] = $unit->getWording();
  32. $unitsList[$unit->getId()]['wordingShort'] = $unit->getWordingShort();
  33. $unitsList[$unit->getId()]['coefficient'] = $unit->getCoefficient();
  34. $unitsList[$unit->getId()]['unitReference'] = $unit->getUnitReference()->getId();
  35. }
  36. return $unitsList;
  37. }
  38. }