예제 #1
0
 public function guessValue($currentValue, \ReflectionClass $targetType = null)
 {
     if (is_object($currentValue) || !$targetType || !$targetType->isSubclassOf('Contao\\Doctrine\\ORM\\EntityInterface')) {
         return $currentValue;
     }
     $className = $targetType->getName();
     $repository = EntityHelper::getRepository($className);
     $primaryKey = EntityHelper::parseCombinedId($className, $currentValue);
     return $repository->find($primaryKey);
 }