public function query($sql)
{
// Get all parameters.
$params = func_get_args();
//array_shift($params); // first parameter of this function is query.
/**
* @author Adrian Liechti
* To make it Possible to give the Query-Method an Array.
*/
if (is_array($params[1])) {
$paramArray = $params[1];
array_unshift($paramArray, $params[0]);
$params = $paramArray;
}
But there are more problems with the pagination! The parameters are not used, because the pagination should extend the PHPDS_query-class but it doesn't extend it.
My workaround looks like this:
public function invoke($parameters = null)
{
$pagination = $this->factory('pagination');
$this->extraBuild($parameters);
if (!empty($this->where)) {
$this->sql .= "\n".'WHERE '.$this->where;
}
if (!empty($this->groupby)) {
$this->sql .= "\n".'GROUP BY '.$this->groupby;
}
Change the query-method in the pagination-class:
public function query($sql) shift($ params) ; // first parameter of this function is query. $params[ 1])) { unshift( $paramArray, $params[0]);
{
// Get all parameters.
$params = func_get_args();
//array_
/**
* @author Adrian Liechti
* To make it Possible to give the Query-Method an Array.
*/
if (is_array(
$paramArray = $params[1];
array_
$params = $paramArray;
}
$this- >searchFilter( ); finalQuery( $params) ;
return $this->
}
But there are more problems with the pagination! The parameters are not used, because the pagination should extend the PHPDS_query-class but it doesn't extend it.
My workaround looks like this:
public function invoke($parameters = null) factory( 'pagination' );
{
$pagination = $this->
$this- >extraBuild( $parameters) ; $this-> where)) { $this-> groupby) ) {
if (!empty(
$this->sql .= "\n".'WHERE '.$this->where;
}
if (!empty(
$this->sql .= "\n".'GROUP BY '.$this->groupby;
}
$get_results = $pagination- >query( $this-> sql, $parameters);
//.........
But with this workaround you have to remove the search-function, because the pagination cannot handle the WHERE and GROUP BY etc. separately.