class ResultSetMapping (View source)

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.

Properties

boolean $isMixed Whether the result is mixed (contains scalar values together with field values).
boolean $isSelect Whether the result is a select statement.
array $aliasMap Maps alias names to class names.
array $relationMap Maps alias names to related association field names.
array $parentAliasMap Maps alias names to parent alias names.
array $fieldMappings Maps column names in the result set to field names for each class.
array $scalarMappings Maps column names in the result set to the alias/field name to use in the mapped result.
array $typeMappings Maps column names in the result set to the alias/field type to use in the mapped result.
array $entityMappings Maps entities in the result set to the alias name to use in the mapped result.
array $metaMappings Maps column names of meta columns (foreign keys, discriminator columns, .
array $columnOwnerMap Maps column names in the result set to the alias they belong to.
array $discriminatorColumns List of columns in the result set that are used as discriminator columns.
array $indexByMap Maps alias names to field names that should be used for indexing.
array $declaringClasses Map from column names to class names that declare the field the column is mapped to.
array $isIdentifierColumn This is necessary to hydrate derivate foreign keys correctly.
array $newObjectMappings Maps column names in the result set to field names for each new object expression.
array $metadataParameterMapping Maps metadata parameter names to the metadata attribute.
array $discriminatorParameters Contains query parameter names to be resolved as discriminator values

Methods

addEntityResult(string $class, string $alias, string|null $resultAlias = null)

Adds an entity result to this ResultSetMapping.

setDiscriminatorColumn(string $alias, string $discrColumn)

Sets a discriminator column for an entity result or joined entity result.

addIndexBy(string $alias, string $fieldName)

Sets a field to use for indexing an entity result or joined entity result.

addIndexByScalar(string $resultColumnName)

Sets to index by a scalar result column name.

addIndexByColumn(string $alias, string $resultColumnName)

Sets a column to use for indexing an entity or joined entity result by the given alias name.

boolean
hasIndexBy(string $alias)

Checks whether an entity result or joined entity result with a given alias has a field set for indexing.

boolean
isFieldResult(string $columnName)

Checks whether the column with the given name is mapped as a field result as part of an entity result or joined entity result.

addFieldResult(string $alias, string $columnName, string $fieldName, string|null $declaringClass = null)

Adds a field to the result that belongs to an entity or joined entity.

addJoinedEntityResult(string $class, string $alias, string $parentAlias, string $relation)

Adds a joined entity result.

addScalarResult(string $columnName, string $alias, string $type = 'string')

Adds a scalar result mapping.

addMetadataParameterMapping(mixed $parameter, string $attribute)

Adds a metadata parameter mappings.

boolean
isScalarResult(string $columnName)

Checks whether a column with a given name is mapped as a scalar result.

string
getClassName(string $alias)

Gets the name of the class of an entity result or joined entity result, identified by the given unique alias.

string
getScalarAlias(string $columnName)

Gets the field alias for a column that is mapped as a scalar value.

string
getDeclaringClass(string $columnName)

Gets the name of the class that owns a field mapping for the specified column.

string
getRelation(string $alias)

No description

boolean
isRelation(string $alias)

No description

string
getEntityAlias(string $columnName)

Gets the alias of the class that owns a field mapping for the specified column.

string
getParentAlias(string $alias)

Gets the parent alias of the given alias.

boolean
hasParentAlias(string $alias)

Checks whether the given alias has a parent alias.

string
getFieldName(string $columnName)

Gets the field name for a column name.

array
getAliasMap()

No description

integer
getEntityResultCount()

Gets the number of different entities that appear in the mapped result.

boolean
isMixedResult()

Checks whether this ResultSetMapping defines a mixed result.

addMetaResult(string $alias, string $columnName, string $fieldName, bool $isIdentifierColumn = false, string $type = null)

Adds a meta column (foreign key or discriminator column) to the result set.

Details

ResultSetMapping addEntityResult(string $class, string $alias, string|null $resultAlias = null)

Adds an entity result to this ResultSetMapping.

Parameters

string $class The class name of the entity.
string $alias The alias for the class. The alias must be unique among all entity results or joined entity results within this ResultSetMapping.
string|null $resultAlias The result alias with which the entity result should be placed in the result structure.

Return Value

ResultSetMapping This ResultSetMapping instance.

ResultSetMapping setDiscriminatorColumn(string $alias, string $discrColumn)

Sets a discriminator column for an entity result or joined entity result.

The discriminator column will be used to determine the concrete class name to instantiate.

Parameters

string $alias The alias of the entity result or joined entity result the discriminator column should be used for.
string $discrColumn The name of the discriminator column in the SQL result set.

Return Value

ResultSetMapping This ResultSetMapping instance.

ResultSetMapping addIndexBy(string $alias, string $fieldName)

Sets a field to use for indexing an entity result or joined entity result.

Parameters

string $alias The alias of an entity result or joined entity result.
string $fieldName The name of the field to use for indexing.

Return Value

ResultSetMapping This ResultSetMapping instance.

ResultSetMapping addIndexByScalar(string $resultColumnName)

Sets to index by a scalar result column name.

Parameters

string $resultColumnName

Return Value

ResultSetMapping This ResultSetMapping instance.

ResultSetMapping addIndexByColumn(string $alias, string $resultColumnName)

Sets a column to use for indexing an entity or joined entity result by the given alias name.

Parameters

string $alias
string $resultColumnName

Return Value

ResultSetMapping This ResultSetMapping instance.

boolean hasIndexBy(string $alias)

Checks whether an entity result or joined entity result with a given alias has a field set for indexing.

Parameters

string $alias

Return Value

boolean

boolean isFieldResult(string $columnName)

Checks whether the column with the given name is mapped as a field result as part of an entity result or joined entity result.

Parameters

string $columnName The name of the column in the SQL result set.

Return Value

boolean

ResultSetMapping addFieldResult(string $alias, string $columnName, string $fieldName, string|null $declaringClass = null)

Adds a field to the result that belongs to an entity or joined entity.

Parameters

string $alias The alias of the root entity or joined entity to which the field belongs.
string $columnName The name of the column in the SQL result set.
string $fieldName The name of the field on the declaring class.
string|null $declaringClass 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.

Return Value

ResultSetMapping This ResultSetMapping instance.

ResultSetMapping addJoinedEntityResult(string $class, string $alias, string $parentAlias, string $relation)

Adds a joined entity result.

Parameters

string $class The class name of the joined entity.
string $alias The unique alias to use for the joined entity.
string $parentAlias The alias of the entity result that is the parent of this joined result.
string $relation The association field that connects the parent entity result with the joined entity result.

Return Value

ResultSetMapping This ResultSetMapping instance.

ResultSetMapping addScalarResult(string $columnName, string $alias, string $type = 'string')

Adds a scalar result mapping.

Parameters

string $columnName The name of the column in the SQL result set.
string $alias The result alias with which the scalar result should be placed in the result structure.
string $type The column type

Return Value

ResultSetMapping This ResultSetMapping instance.

addMetadataParameterMapping(mixed $parameter, string $attribute)

Adds a metadata parameter mappings.

Parameters

mixed $parameter The parameter name in the SQL result set.
string $attribute The metadata attribute.

boolean isScalarResult(string $columnName)

Checks whether a column with a given name is mapped as a scalar result.

Parameters

string $columnName The name of the column in the SQL result set.

Return Value

boolean

string getClassName(string $alias)

Gets the name of the class of an entity result or joined entity result, identified by the given unique alias.

Parameters

string $alias

Return Value

string

string getScalarAlias(string $columnName)

Gets the field alias for a column that is mapped as a scalar value.

Parameters

string $columnName The name of the column in the SQL result set.

Return Value

string

string getDeclaringClass(string $columnName)

Gets the name of the class that owns a field mapping for the specified column.

Parameters

string $columnName

Return Value

string

string getRelation(string $alias)

Parameters

string $alias

Return Value

string

boolean isRelation(string $alias)

Parameters

string $alias

Return Value

boolean

string getEntityAlias(string $columnName)

Gets the alias of the class that owns a field mapping for the specified column.

Parameters

string $columnName

Return Value

string

string getParentAlias(string $alias)

Gets the parent alias of the given alias.

Parameters

string $alias

Return Value

string

boolean hasParentAlias(string $alias)

Checks whether the given alias has a parent alias.

Parameters

string $alias

Return Value

boolean

string getFieldName(string $columnName)

Gets the field name for a column name.

Parameters

string $columnName

Return Value

string

array getAliasMap()

Return Value

array

integer getEntityResultCount()

Gets the number of different entities that appear in the mapped result.

Return Value

integer

boolean isMixedResult()

Checks whether this ResultSetMapping defines a mixed result.

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 Value

boolean

ResultSetMapping addMetaResult(string $alias, string $columnName, string $fieldName, bool $isIdentifierColumn = false, string $type = null)

Adds a meta column (foreign key or discriminator column) to the result set.

Parameters

string $alias The result alias with which the meta result should be placed in the result structure.
string $columnName The name of the column in the SQL result set.
string $fieldName The name of the field on the declaring class.
bool $isIdentifierColumn
string $type The column type

Return Value

ResultSetMapping This ResultSetMapping instance.