I have a static function in which I am passing some variables from the controller, In the function, I am doing some DB table joins and some other queries, the values I am passing is getting from the filters, If I am not selecting any filters I will get null values.
public static function Myfunction($var1,$var2,$var3)
{
...some database queries..
->joinLeft(some conditions)
->joinLeft(some conditions)
->where('table1.val1 = ?',$var1)
->where('table2.val2 = ?', $var2)
->where('table3.val3 =?' ,$var3);
return $data
}
Here If the values I am passing is null then I don't need to check the first condition, similarly in the case of 2nd and 3rd if the value is null then I don't need to check any conditions and have to fetch the whole value from the DB as per the query, somebody, please help me how to do that in Zend?