/**
  * Loads data that related to $toContentId
  *
  * @param int $toContentId
  * @param int $relationType
  *
  * @return mixed[][] Content data, array structured like {@see \eZ\Publish\Core\Persistence\Legacy\Content\Gateway::load()}
  */
 public function loadReverseRelations($toContentId, $relationType = null)
 {
     $query = $this->queryBuilder->createRelationFindQuery();
     $query->where($query->expr->eq($this->dbHandler->quoteColumn('to_contentobject_id', 'ezcontentobject_link'), $query->bindValue($toContentId, null, \PDO::PARAM_INT)));
     // ezcontentobject join
     $query->from($this->dbHandler->quoteTable('ezcontentobject'))->where($query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn('id', 'ezcontentobject'), $this->dbHandler->quoteColumn('from_contentobject_id', 'ezcontentobject_link')), $query->expr->eq($this->dbHandler->quoteColumn('current_version', 'ezcontentobject'), $this->dbHandler->quoteColumn('from_contentobject_version', 'ezcontentobject_link'))));
     // relation type
     if (isset($relationType)) {
         $query->where($query->expr->gt($query->expr->bitAnd($this->dbHandler->quoteColumn('relation_type', 'ezcontentobject_link'), $query->bindValue($relationType, null, \PDO::PARAM_INT)), 0));
     }
     $statement = $query->prepare();
     $statement->execute();
     return $statement->fetchAll(\PDO::FETCH_ASSOC);
 }
 /**
  * Loads the actual content based on the provided IDs
  *
  * @param array $contentIds
  * @param mixed $translations
  *
  * @return mixed[]
  */
 protected function loadContent(array $contentIds, $translations)
 {
     $loadQuery = $this->queryBuilder->createFindQuery($translations);
     $loadQuery->where($loadQuery->expr->eq('ezcontentobject_version.status', VersionInfo::STATUS_PUBLISHED), $loadQuery->expr->in($this->handler->quoteColumn('id', 'ezcontentobject'), $contentIds));
     $statement = $loadQuery->prepare();
     $statement->execute();
     $rows = $statement->fetchAll(\PDO::FETCH_ASSOC);
     // Sort array, as defined in the $contentIds array
     $contentIdOrder = array_flip($contentIds);
     usort($rows, function ($current, $next) use($contentIdOrder) {
         return $contentIdOrder[$current['ezcontentobject_id']] - $contentIdOrder[$next['ezcontentobject_id']];
     });
     foreach ($rows as &$row) {
         $row['ezcontentobject_always_available'] = $this->languageMaskGenerator->isAlwaysAvailable($row['ezcontentobject_language_mask']);
         $row['ezcontentobject_main_language_code'] = $this->languageHandler->load($row['ezcontentobject_initial_language_id'])->languageCode;
         $row['ezcontentobject_version_languages'] = $this->languageMaskGenerator->extractLanguageIdsFromMask($row['ezcontentobject_version_language_mask']);
         $row['ezcontentobject_version_initial_language_code'] = $this->languageHandler->load($row['ezcontentobject_version_initial_language_id'])->languageCode;
     }
     return $rows;
 }