#1178 - moved private method to the bottom of the class
This commit is contained in:
parent
edf054cd0c
commit
584839d38a
@ -35,42 +35,6 @@ use Doctrine\ORM\Query\QueryException;
|
||||
*/
|
||||
class PersisterHelper
|
||||
{
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @param EntityManagerInterface $em
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getValue($value, EntityManagerInterface $em)
|
||||
{
|
||||
if ( ! is_array($value)) {
|
||||
return self::getIndividualValue($value, $em);
|
||||
}
|
||||
|
||||
$newValue = array();
|
||||
|
||||
foreach ($value as $fieldName => $fieldValue) {
|
||||
$newValue[$fieldName] = self::getIndividualValue($fieldValue, $em);
|
||||
}
|
||||
|
||||
return $newValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @param EntityManagerInterface $em
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private static function getIndividualValue($value, EntityManagerInterface $em)
|
||||
{
|
||||
if ( ! is_object($value) || ! $em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($value))) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $em->getUnitOfWork()->getSingleIdentifierValue($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fieldName
|
||||
* @param ClassMetadata $class
|
||||
@ -169,4 +133,40 @@ class PersisterHelper
|
||||
$class->getName()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @param EntityManagerInterface $em
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getValue($value, EntityManagerInterface $em)
|
||||
{
|
||||
if ( ! is_array($value)) {
|
||||
return self::getIndividualValue($value, $em);
|
||||
}
|
||||
|
||||
$newValue = array();
|
||||
|
||||
foreach ($value as $fieldName => $fieldValue) {
|
||||
$newValue[$fieldName] = self::getIndividualValue($fieldValue, $em);
|
||||
}
|
||||
|
||||
return $newValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @param EntityManagerInterface $em
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private static function getIndividualValue($value, EntityManagerInterface $em)
|
||||
{
|
||||
if ( ! is_object($value) || ! $em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($value))) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $em->getUnitOfWork()->getSingleIdentifierValue($value);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user