コード例 #1
0
 /**
  * @param string $name
  * @return UnitInterface
  */
 private function getUnitFromListByName($name)
 {
     /** @var UnitInterface[] $items */
     $items = array_filter($this->unitRepository->findAll(), function (UnitInterface $unit) use($name) {
         return $unit->getName() == $name;
     });
     $id = null;
     if (count($items)) {
         $id = array_values($items)[0]->getId();
     }
     return $this->unitRepository->findById($id);
 }
コード例 #2
0
 public function execute()
 {
     $units = $this->unitRepository->findAll();
     $items = $this->fetchList($units);
     $this->unitListFetched($items);
 }