public function listTrashed($offset, $limit, array $sort = null)
{
$query = $this->handler->createSelectQuery();
$query->select('*')->from($this->handler->quoteTable('ezcontentobject_trash'));
$sort = $sort ?: array();
foreach ($sort as $condition) {
$sortDirection = $condition->direction === Query::SORT_ASC ? SelectQuery::ASC : SelectQuery::DESC;
switch (true) {
case $condition instanceof SortClause\Location\Depth:
$query->orderBy('depth', $sortDirection);
break;
case $condition instanceof SortClause\Location\Path:
$query->orderBy('path_string', $sortDirection);
break;
case $condition instanceof SortClause\Location\Priority:
$query->orderBy('priority', $sortDirection);
break;
default:
// Only handle location related sort clauses. The others
// require data aggregation which is not sensible here.
// Since also criteria are yet ignored, because they are
// simply not used yet in eZ Publish, we skip that for now.
throw new RuntimeException('Unhandled sort clause: ' . get_class($condition));
}
}
if ($limit !== null) {
$query->limit($limit, $offset);
}
$statement = $query->prepare();
$statement->execute();
$rows = array();
while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
$rows[] = $row;
}
return $rows;
}