/**
* 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')), $query->expr->eq($this->dbHandler->quoteColumn('status', 'ezcontentobject'), $query->bindValue(1, null, \PDO::PARAM_INT))));
// 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);
}