ResultSetMapping
in package
A ResultSetMapping describes how a result set of an SQL query maps to a Doctrine result.
IMPORTANT NOTE: The properties of this class are only public for fast internal READ access and to (drastically) reduce the size of serialized instances for more effective caching due to better (un-)serialization performance.
Users should use the public methods.
Tags
Table of Contents
Properties
- $discriminatorParameters : mixed
- Contains query parameter names to be resolved as discriminator values
- $isIdentifierColumn : mixed
- This is necessary to hydrate derivate foreign keys correctly.
- $metadataParameterMapping : mixed
- Maps metadata parameter names to the metadata attribute.
- $newObjectMappings : mixed
- Maps column names in the result set to field names for each new object expression.
Methods
- addEntityResult() : $this
- Adds an entity result to this ResultSetMapping.
- addEnumResult() : $this
- Adds a scalar result mapping.
- addFieldResult() : $this
- Adds a field to the result that belongs to an entity or joined entity.
- addIndexBy() : $this
- Sets a field to use for indexing an entity result or joined entity result.
- addIndexByColumn() : $this
- Sets a column to use for indexing an entity or joined entity result by the given alias name.
- addIndexByScalar() : $this
- Sets to index by a scalar result column name.
- addJoinedEntityResult() : $this
- Adds a joined entity result.
- addMetadataParameterMapping() : void
- Adds a metadata parameter mappings.
- addMetaResult() : $this
- Adds a meta column (foreign key or discriminator column) to the result set.
- addScalarResult() : $this
- Adds a scalar result mapping.
- getAliasMap() : mixed
- getClassName() : class-string
- Gets the name of the class of an entity result or joined entity result, identified by the given unique alias.
- getDeclaringClass() : class-string
- Gets the name of the class that owns a field mapping for the specified column.
- getEntityAlias() : string
- Gets the alias of the class that owns a field mapping for the specified column.
- getEntityResultCount() : int
- Gets the number of different entities that appear in the mapped result.
- getFieldName() : string
- Gets the field name for a column name.
- getParentAlias() : string
- Gets the parent alias of the given alias.
- getRelation() : string
- getScalarAlias() : string|int
- Gets the field alias for a column that is mapped as a scalar value.
- hasIndexBy() : bool
- Checks whether an entity result or joined entity result with a given alias has a field set for indexing.
- hasParentAlias() : bool
- Checks whether the given alias has a parent alias.
- isFieldResult() : bool
- Checks whether the column with the given name is mapped as a field result as part of an entity result or joined entity result.
- isMixedResult() : bool
- Checks whether this ResultSetMapping defines a mixed result.
- isRelation() : bool
- isScalarResult() : bool
- Checks whether a column with a given name is mapped as a scalar result.
- setDiscriminatorColumn() : $this
- Sets a discriminator column for an entity result or joined entity result.
Properties
$discriminatorParameters
Contains query parameter names to be resolved as discriminator values
public
mixed
$discriminatorParameters
= []
Tags
$isIdentifierColumn
This is necessary to hydrate derivate foreign keys correctly.
public
mixed
$isIdentifierColumn
= []
Tags
$metadataParameterMapping
Maps metadata parameter names to the metadata attribute.
public
mixed
$metadataParameterMapping
= []
Tags
$newObjectMappings
Maps column names in the result set to field names for each new object expression.
public
mixed
$newObjectMappings
= []
Tags
Methods
addEntityResult()
Adds an entity result to this ResultSetMapping.
public
addEntityResult(string $class, string $alias[, string|null $resultAlias = null ]) : $this
Parameters
- $class : string
-
The class name of the entity.
- $alias : string
-
The alias for the class. The alias must be unique among all entity results or joined entity results within this ResultSetMapping.
- $resultAlias : string|null = null
-
The result alias with which the entity result should be placed in the result structure.
Tags
Return values
$thisaddEnumResult()
Adds a scalar result mapping.
public
addEnumResult(string $columnName, string $enumType) : $this
Parameters
- $columnName : string
-
The name of the column in the SQL result set.
- $enumType : string
-
The enum type
Return values
$thisaddFieldResult()
Adds a field to the result that belongs to an entity or joined entity.
public
addFieldResult(string $alias, string $columnName, string $fieldName[, string|null $declaringClass = null ]) : $this
Parameters
- $alias : string
-
The alias of the root entity or joined entity to which the field belongs.
- $columnName : string
-
The name of the column in the SQL result set.
- $fieldName : string
-
The name of the field on the declaring class.
- $declaringClass : string|null = null
-
The name of the class that declares/owns the specified field. When $alias refers to a superclass in a mapped hierarchy but the field $fieldName is defined on a subclass, specify that here. If not specified, the field is assumed to belong to the class designated by $alias.
Tags
Return values
$thisaddIndexBy()
Sets a field to use for indexing an entity result or joined entity result.
public
addIndexBy(string $alias, string $fieldName) : $this
Parameters
- $alias : string
-
The alias of an entity result or joined entity result.
- $fieldName : string
-
The name of the field to use for indexing.
Return values
$thisaddIndexByColumn()
Sets a column to use for indexing an entity or joined entity result by the given alias name.
public
addIndexByColumn(string $alias, string $resultColumnName) : $this
Parameters
- $alias : string
- $resultColumnName : string
Return values
$thisaddIndexByScalar()
Sets to index by a scalar result column name.
public
addIndexByScalar(string $resultColumnName) : $this
Parameters
- $resultColumnName : string
Return values
$thisaddJoinedEntityResult()
Adds a joined entity result.
public
addJoinedEntityResult(string $class, string $alias, string $parentAlias, string $relation) : $this
Parameters
- $class : string
-
The class name of the joined entity.
- $alias : string
-
The unique alias to use for the joined entity.
- $parentAlias : string
-
The alias of the entity result that is the parent of this joined result.
- $relation : string
-
The association field that connects the parent entity result with the joined entity result.
Tags
Return values
$thisaddMetadataParameterMapping()
Adds a metadata parameter mappings.
public
addMetadataParameterMapping(string|int $parameter, string $attribute) : void
Parameters
- $parameter : string|int
-
The parameter name in the SQL result set.
- $attribute : string
-
The metadata attribute.
addMetaResult()
Adds a meta column (foreign key or discriminator column) to the result set.
public
addMetaResult(string $alias, string $columnName, string $fieldName[, bool $isIdentifierColumn = false ][, string|null $type = null ]) : $this
Parameters
- $alias : string
-
The result alias with which the meta result should be placed in the result structure.
- $columnName : string
-
The name of the column in the SQL result set.
- $fieldName : string
-
The name of the field on the declaring class.
- $isIdentifierColumn : bool = false
- $type : string|null = null
-
The column type
Tags
Return values
$thisaddScalarResult()
Adds a scalar result mapping.
public
addScalarResult(string $columnName, string|int $alias[, string $type = 'string' ]) : $this
Parameters
- $columnName : string
-
The name of the column in the SQL result set.
- $alias : string|int
-
The result alias with which the scalar result should be placed in the result structure.
- $type : string = 'string'
-
The column type
Tags
Return values
$thisgetAliasMap()
public
getAliasMap() : mixed
Tags
getClassName()
Gets the name of the class of an entity result or joined entity result, identified by the given unique alias.
public
getClassName(string $alias) : class-string
Parameters
- $alias : string
Return values
class-stringgetDeclaringClass()
Gets the name of the class that owns a field mapping for the specified column.
public
getDeclaringClass(string $columnName) : class-string
Parameters
- $columnName : string
Return values
class-stringgetEntityAlias()
Gets the alias of the class that owns a field mapping for the specified column.
public
getEntityAlias(string $columnName) : string
Parameters
- $columnName : string
Return values
stringgetEntityResultCount()
Gets the number of different entities that appear in the mapped result.
public
getEntityResultCount() : int
Tags
Return values
intgetFieldName()
Gets the field name for a column name.
public
getFieldName(string $columnName) : string
Parameters
- $columnName : string
Return values
stringgetParentAlias()
Gets the parent alias of the given alias.
public
getParentAlias(string $alias) : string
Parameters
- $alias : string
Return values
stringgetRelation()
public
getRelation(string $alias) : string
Parameters
- $alias : string
Return values
stringgetScalarAlias()
Gets the field alias for a column that is mapped as a scalar value.
public
getScalarAlias(string $columnName) : string|int
Parameters
- $columnName : string
-
The name of the column in the SQL result set.
Return values
string|inthasIndexBy()
Checks whether an entity result or joined entity result with a given alias has a field set for indexing.
public
hasIndexBy(string $alias) : bool
Parameters
- $alias : string
Tags
Return values
boolhasParentAlias()
Checks whether the given alias has a parent alias.
public
hasParentAlias(string $alias) : bool
Parameters
- $alias : string
Return values
boolisFieldResult()
Checks whether the column with the given name is mapped as a field result as part of an entity result or joined entity result.
public
isFieldResult(string $columnName) : bool
Parameters
- $columnName : string
-
The name of the column in the SQL result set.
Tags
Return values
boolisMixedResult()
Checks whether this ResultSetMapping defines a mixed result.
public
isMixedResult() : bool
Mixed results can only occur in object and array (graph) hydration. In such a case a mixed result means that scalar values are mixed with objects/array in the result.
Return values
boolisRelation()
public
isRelation(string $alias) : bool
Parameters
- $alias : string
Return values
boolisScalarResult()
Checks whether a column with a given name is mapped as a scalar result.
public
isScalarResult(string $columnName) : bool
Parameters
- $columnName : string
-
The name of the column in the SQL result set.
Tags
Return values
boolsetDiscriminatorColumn()
Sets a discriminator column for an entity result or joined entity result.
public
setDiscriminatorColumn(string $alias, string $discrColumn) : $this
The discriminator column will be used to determine the concrete class name to instantiate.
Parameters
- $alias : string
-
The alias of the entity result or joined entity result the discriminator column should be used for.
- $discrColumn : string
-
The name of the discriminator column in the SQL result set.