createQuery("a")->where("a.parent_id = ".$id)->execute(); $arg = array_merge($arg,array('equipment_id = '.$id)); if(!empty($e)): foreach($e as $i): if($i->parent_id != ""){ $arg = $this->getOthers($i->getId(),$arg); } $arg[] = "equipment_id =".$i->getId(); endforeach; endif; return $arg; } public function getFiltrSql($fitr,$allou){ $strWhere = array(); if(!empty($fitr['created_at']['text'])){ $date = explode(" - ",$fitr['created_at']['text']); $dateFrom = $this->changeDate($date[0]); $dateTo = $this->changeDate($date[1]); $strWhere[] =" created_at >= '".date("Y-m-d",strtotime($dateFrom))." 00:00:00'"; if(!stristr($dateTo,$dateFrom)) $strWhere[] =" created_at <= '".date("Y-m-d",strtotime($dateTo))." 23:59:59' "; } if(!empty($fitr['person_name']['text'])) $strWhere [] = " person_name LIKE '%".$fitr['person_name']['text']."%'"; if(!empty($fitr['equipment_id']) && $fitr['equipment_id']!=0){ if(array_search($fitr['equipment_id'],$allou)) $strWhere[] = implode(" OR ",$this->getOthers($fitr['equipment_id'],array())); } if(count($strWhere)>0){ return $this->createQuery() ->where(implode(" AND ",$strWhere)); } if(count($strWhere)==0){ return $this->createQuery(); } } public function getDatas($allo){ $check = Doctrine_Query::create() ->select("u.*") ->from("Request u") ->where(implode(" OR ",$allo)); return $check; } }