<?php

namespace Lc\ShopBundle\Services ;

use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\UnitInterface;

class UnitUtils
{
        protected $em ;
        protected $merchantUtils ;

        public function __construct(EntityManagerInterface $em)
        {
                $this->em = $em ;
        }

        public function getUnitsList()
        {
                $unitsList =array();
                $units = $this->em->getRepository(UnitInterface::class)->findAll();
                foreach ($units 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;
        }
}


