public createNamesQuery ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | ||
리턴 | eZ\Publish\Core\Persistence\Database\SelectQuery |
public function createNamesQuery()
{
$query = $this->dbHandler->createSelectQuery();
$query->select($this->dbHandler->aliasedColumn($query, 'contentobject_id', 'ezcontentobject_name'), $this->dbHandler->aliasedColumn($query, 'content_version', 'ezcontentobject_name'), $this->dbHandler->aliasedColumn($query, 'name', 'ezcontentobject_name'), $this->dbHandler->aliasedColumn($query, 'content_translation', 'ezcontentobject_name'))->from($this->dbHandler->quoteTable('ezcontentobject_name'));
return $query;
}
/** * Load name data for set of content id's and corresponding version number. * * @param array[] $rows array of hashes with 'id' and 'version' to load names for * * @return array */ public function loadVersionedNameData($rows) { $query = $this->queryBuilder->createNamesQuery(); $conditions = array(); foreach ($rows as $row) { $conditions[] = $query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn('contentobject_id'), $query->bindValue($row['id'], null, \PDO::PARAM_INT)), $query->expr->eq($this->dbHandler->quoteColumn('content_version'), $query->bindValue($row['version'], null, \PDO::PARAM_INT))); } $query->where($query->expr->lOr($conditions)); $stmt = $query->prepare(); $stmt->execute(); return $stmt->fetchAll(\PDO::FETCH_ASSOC); }