protected function getExistingRelations($entity)
{
$query = $this->em->createQueryBuilder()->select('*')->from($this->mapping['target'])->where('from_id = :from_id')->andWhere('from_contenttype = :from_contenttype')->andWhere('to_contenttype = :to_contenttype')->setParameters(['from_id' => $entity->id, 'from_contenttype' => $entity->getContenttype(), 'to_contenttype' => $this->mapping['fieldname']]);
$result = $query->execute()->fetchAll();
return $result ?: [];
}