/**
* Helper for {@see listVersions()} and {@see listVersionsForUser()} that filters duplicates
* that are the result of the cartesian product performed by createVersionInfoFindQuery().
*
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
*
* @return string[][]
*/
private function listVersionsHelper(SelectQuery $query)
{
$query->orderBy($this->dbHandler->quoteColumn('id', 'ezcontentobject_version'));
$statement = $query->prepare();
$statement->execute();
$results = array();
$previousId = null;
foreach ($statement->fetchAll(\PDO::FETCH_ASSOC) as $row) {
if ($row['ezcontentobject_version_id'] == $previousId) {
continue;
}
$previousId = $row['ezcontentobject_version_id'];
$results[] = $row;
}
return $results;
}