← Back to team overview

phpdevshell team mailing list archive

[Bug 934104] Re: parameters passed to pagination, gives htmlentities error

 

Change the query-method in the pagination-class:

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;
	}
	
	$this->searchFilter();
	return $this->finalQuery($params);
}


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;
		}

		$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.

-- 
You received this bug notification because you are a member of
PHPDevShell, which is subscribed to PHPDevShell.
https://bugs.launchpad.net/bugs/934104

Title:
  parameters passed to pagination, gives htmlentities error

Status in Open Source PHP RAD Framework with UI.:
  New

Bug description:
  Some interresting error is happening, when i add the parameters array
  to the pagination.

  Error:
  htmlentities() expects parameter 1 to be string, array given

  The array is like this:
  $parameters = array(
  	'userId' => $this->configuration['user_id'],
  	'removed' => 0,
  	'expiresAfter' => '2012-02-17 12:00:00'
  );

  The errorpage and the qeryfile are attached

To manage notifications about this bug go to:
https://bugs.launchpad.net/phpdevshell/+bug/934104/+subscriptions


References