private function getAnimal($entity) { $animal = null; if (method_exists($entity, 'getAnimal')) { $animal = $entity->getAnimal(); } elseif (method_exists($entity, 'getOldAnimal')) { $animal = $entity->getOldAnimal(); } elseif ($entity instanceof \DLigo\Animaltool\Domain\Model\Owner) { $animal = $this->animalRepository->findByOwner($entity)->getFirst(); if (empty($animal)) { $id = $this->persistenceManager->getIdentifierByObject($entity); if (isset($this->owners[$id])) { $animal = $this->owners[$id]; } } } elseif ($entity instanceof \TYPO3\Flow\Resource\Resource) { $animal = $this->animalRepository->findByPhoto($entity)->getFirst(); if (empty($animal)) { $id = $this->persistenceManager->getIdentifierByObject($entity); if (isset($this->photos[$id])) { $animal = $this->photos[$id]; } } } elseif ($entity instanceof \TYPO3\Flow\Resource\ResourcePointer) { $animal = $this->animalRepository->findByPhotoPointer($entity)->getFirst(); if (empty($animal)) { $id = $this->persistenceManager->getIdentifierByObject($entity); if (isset($this->photospointer[$id])) { $animal = $this->photospointer[$id]; } } } elseif ($entity instanceof \DLigo\Animaltool\Domain\Model\Animal) { $animal = $entity; } if (!empty($animal)) { return $animal; } return ''; }