use wcf\system\exception\SystemException;
use wcf\system\WCF;
use wcf\util\ClassUtil;
-use wcf\util\StringUtil;
/**
* Abstract class for a list of database objects.
*
* @author Marcel Werk
- * @copyright 2001-2012 WoltLab GmbH
+ * @copyright 2001-2014 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage data
/**
* result objects
- * @var array<wcf\data\DatabaseObject>
+ * @var array<\wcf\data\DatabaseObject>
*/
public $objects = array();
* sql limit
* @var integer
*/
- public $sqlLimit = 20;
+ public $sqlLimit = 0;
/**
* sql order by statement
public $sqlJoins = '';
/**
- * enables the automatic usage of the qualified shorthand
+ * enables the automatic usage of the qualified shorthand
* @var boolean
*/
public $useQualifiedShorthand = true;
/**
* sql conditions
- * @var wcf\system\database\util\PreparedStatementConditionBuilder
+ * @var \wcf\system\database\util\PreparedStatementConditionBuilder
*/
protected $conditionBuilder = null;
if (empty($this->className)) {
$className = get_called_class();
- if (StringUtil::substring($className, -4) == 'List') {
- $this->className = StringUtil::substring($className, 0, -4);
+ if (mb_substr($className, -4) == 'List') {
+ $this->className = mb_substr($className, 0, -4);
}
}
$sql = "SELECT COUNT(*) AS count
FROM ".$this->getDatabaseTableName()." ".$this->getDatabaseTableAlias()."
".$this->sqlConditionJoins."
- ".$this->getConditionBuilder()->__toString();
+ ".$this->getConditionBuilder();
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($this->getConditionBuilder()->getParameters());
$row = $statement->fetchArray();
$sql = "SELECT ".$this->getDatabaseTableAlias().".".$this->getDatabaseTableIndexName()." AS objectID
FROM ".$this->getDatabaseTableName()." ".$this->getDatabaseTableAlias()."
".$this->sqlConditionJoins."
- ".$this->getConditionBuilder()->__toString()."
+ ".$this->getConditionBuilder()."
".(!empty($this->sqlOrderBy) ? "ORDER BY ".$this->sqlOrderBy : '');
$statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute($this->getConditionBuilder()->getParameters());
".($this->useQualifiedShorthand ? $this->getDatabaseTableAlias().'.*' : '')."
FROM ".$this->getDatabaseTableName()." ".$this->getDatabaseTableAlias()."
".$this->sqlJoins."
- ".$this->getConditionBuilder()->__toString()."
+ ".$this->getConditionBuilder()."
".(!empty($this->sqlOrderBy) ? "ORDER BY ".$this->sqlOrderBy : '');
$statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute($this->getConditionBuilder()->getParameters());
* @param array<integer> $objectIDs
*/
public function setObjectIDs(array $objectIDs) {
- $this->objectIDs = $objectIDs;
+ $this->objectIDs = array_merge($objectIDs);
}
/**
* Returns the objects of the list.
*
- * @return array<wcf\data\DatabaseObject>
+ * @return array<\wcf\data\DatabaseObject>
*/
public function getObjects() {
return $this->objects;
/**
* Returns the condition builder object.
*
- * @return wcf\system\database\util\PreparedStatementConditionBuilder
+ * @return \wcf\system\database\util\PreparedStatementConditionBuilder
*/
public function getConditionBuilder() {
return $this->conditionBuilder;
}
/**
- * @see wcf\data\ITraversableObject::seekTo()
+ * @see \wcf\data\ITraversableObject::seekTo()
*/
public function seekTo($objectID) {
$this->index = array_search($objectID, $this->indexToObject);
}
/**
- * @see wcf\data\ITraversableObject::search()
+ * @see \wcf\data\ITraversableObject::search()
*/
public function search($objectID) {
try {