refactory ResultSetMappingBuilder#addNamedNativeQueryMapping into small submethods
This commit is contained in:
parent
8c407af1fc
commit
fdc9fdae3e
@ -109,7 +109,7 @@ class ResultSetMappingBuilder extends ResultSetMapping
|
||||
|
||||
|
||||
/**
|
||||
* Adds a the mappings of the results of native SQL queries to the result set.
|
||||
* Adds the mappings of the results of native SQL queries to the result set.
|
||||
*
|
||||
* @param ClassMetadataInfo $class
|
||||
* @param array $queryMapping
|
||||
@ -118,7 +118,23 @@ class ResultSetMappingBuilder extends ResultSetMapping
|
||||
public function addNamedNativeQueryMapping(ClassMetadataInfo $class, array $queryMapping)
|
||||
{
|
||||
if (isset($queryMapping['resultClass'])) {
|
||||
$classMetadata = $this->em->getClassMetadata($queryMapping['resultClass']);
|
||||
return $this->addNamedNativeQueryResultClassMapping($class, $queryMapping['resultClass']);
|
||||
}
|
||||
|
||||
return $this->addNamedNativeQueryResultSetMapping($class, $queryMapping['resultSetMapping']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the class mapping of the results of native SQL queries to the result set.
|
||||
*
|
||||
* @param ClassMetadataInfo $class
|
||||
* @param string $resultClassName
|
||||
* @return ResultSetMappingBuilder
|
||||
*/
|
||||
public function addNamedNativeQueryResultClassMapping(ClassMetadataInfo $class, $resultClassName)
|
||||
{
|
||||
|
||||
$classMetadata = $this->em->getClassMetadata($resultClassName);
|
||||
$shortName = $classMetadata->reflClass->getShortName();
|
||||
$alias = strtolower($shortName[0]).'0';
|
||||
|
||||
@ -147,7 +163,16 @@ class ResultSetMappingBuilder extends ResultSetMapping
|
||||
return $this;
|
||||
}
|
||||
|
||||
$resultMapping = $class->getSqlResultSetMapping($queryMapping['resultSetMapping']);
|
||||
/**
|
||||
* Adds the result set mapping of the results of native SQL queries to the result set.
|
||||
*
|
||||
* @param ClassMetadataInfo $class
|
||||
* @param string $resultSetMappingName
|
||||
* @return ResultSetMappingBuilder
|
||||
*/
|
||||
public function addNamedNativeQueryResultSetMapping(ClassMetadataInfo $class, $resultSetMappingName)
|
||||
{
|
||||
$resultMapping = $class->getSqlResultSetMapping($resultSetMappingName);
|
||||
if (isset($resultMapping['entities'])) {
|
||||
foreach ($resultMapping['entities'] as $key => $entityMapping) {
|
||||
$classMetadata = $this->em->getClassMetadata($entityMapping['entityClass']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user