/** * @param EntityFinder $finder * @param array $data */ public static function toEntity($finder, $data) { if ($finder->getFetchStyle() === Connection::FETCH) { return self::rowToEntity($finder, $data); } $entityArray = array(); foreach ($data as $i => $row) { $entityArray[] = self::rowToEntity($finder, $row); } return $entityArray; }
/** * @param EntityFinder $finder * @return mixed */ public function findEntity($finder) { $finder->finish(); $queryData = $this->getConnection()->exec($finder->getQuery()->get(), $finder->getData(), $finder->getFetchStyle()); return Mapper::toEntity($finder, $queryData); }