Nevar pievienot vairāk kā 25 tēmas
Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Config;
-
- use Lc\SovBundle\Repository\AbstractStore;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class UnitStore extends AbstractStore
- {
- protected UnitRepositoryQuery $query;
-
- public function __construct(UnitRepositoryQuery $query)
- {
- $this->query = $query;
- }
-
- public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $query->orderBy('id');
- return $query;
- }
-
- public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
- public function getAsArray($query = null)
- {
- $query = $this->createDefaultQuery($query);
-
- foreach ($query->find() as $unit) {
- $unitsList[$unit->getId()]['unit'] = $unit->getUnit();
- $unitsList[$unit->getId()]['wordingUnit'] = $unit->getWordingUnit();
- $unitsList[$unit->getId()]['wording'] = $unit->getWording();
- $unitsList[$unit->getId()]['wordingShort'] = $unit->getWordingShort();
- $unitsList[$unit->getId()]['coefficient'] = $unit->getCoefficient();
- $unitsList[$unit->getId()]['unitReference'] = $unit->getUnitReference()->getId();
- }
-
- return $unitsList;
- }
- }
|