/** * * @param DataParam $params * @param array $years * @return ArrayIterator */ public function getValuesFilteringWithMultipleParams(DataParam $params, array $years) { if (is_array($params->getSubgroup())) { $subgroup = $params->getSubgroup(); $paramsForList1 = $params; $paramsForList1->setSubgroup($subgroup[0]); $listValues1 = $this->repository->getValuesWithMultipleParamsSelected($paramsForList1, $years); $paramsForList2 = $params; $paramsForList2->setSubgroup($subgroup[1]); $listValues2 = $this->repository->getValuesWithMultipleParamsSelected($paramsForList2, $years); $map = new HashMap(); $map->put(0, $listValues1); $map->put(1, $listValues2); return $map; } else { if ($params->theOptionAllHasBeenSelected()) { $listValues = $this->repository->getValuesWhenTheOptionAllWasSelected($params->getSubgroup(), $params->getVariety(), $params->getType(), $params->getOrigin(), $params->getDestiny(), $params->getFont(), $years); } else { $listValues = $this->repository->getValuesWithMultipleParamsSelected($params, $years); } return $listValues; } }
/** * * @param type $params * @param type $sql * @return PDOStatement */ private function query(DataParam $params, $sql) { $query = $this->session->prepare($sql); $query->bindParam(":subgroup", $params->getSubgroup()); $query->bindParam(":variety", $params->getVariety()); $query->bindParam(":type", $params->getType()); $query->bindParam(":origin", $params->getOrigin()); $query->bindParam(":destiny", $params->getDestiny()); $query->bindParam(":font", $params->getFont()); return $query; }