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

36 行
1.1KB

  1. <?php
  2. namespace Lc\ShopBundle\Services ;
  3. use Doctrine\ORM\EntityManagerInterface;
  4. use Lc\ShopBundle\Context\UnitInterface;
  5. class UnitUtils
  6. {
  7. protected $em ;
  8. protected $merchantUtils ;
  9. public function __construct(EntityManagerInterface $em)
  10. {
  11. $this->em = $em ;
  12. }
  13. public function getUnitsList()
  14. {
  15. $unitsList =array();
  16. $units = $this->em->getRepository(UnitInterface::class)->findAll();
  17. foreach ($units as $unit){
  18. $unitsList[$unit->getId()]['unit'] = $unit->getUnit();
  19. $unitsList[$unit->getId()]['wordingUnit'] = $unit->getWordingUnit();
  20. $unitsList[$unit->getId()]['wording'] = $unit->getWording();
  21. $unitsList[$unit->getId()]['wordingShort'] = $unit->getWordingShort();
  22. $unitsList[$unit->getId()]['coefficient'] = $unit->getCoefficient();
  23. $unitsList[$unit->getId()]['unitReference'] = $unit->getUnitReference()->getId();
  24. }
  25. return $unitsList;
  26. }
  27. }