Documentation

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
todo

Think about whether the number of lookup maps can be reduced.

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
psalm-var

array<string, string>

$isIdentifierColumn

This is necessary to hydrate derivate foreign keys correctly.

public mixed $isIdentifierColumn = []
Tags
psalm-var

array<string, array<string, bool>>

$metadataParameterMapping

Maps metadata parameter names to the metadata attribute.

public mixed $metadataParameterMapping = []
Tags
psalm-var

array<int|string, string>

$newObjectMappings

Maps column names in the result set to field names for each new object expression.

public mixed $newObjectMappings = []
Tags
psalm-var

array<string, array<string, mixed>>

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
psalm-param

class-string $class

todo

Rename: addRootEntity

Return values
$this

addEnumResult()

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
$this

addFieldResult()

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
psalm-param

class-string|null $declaringClass

todo

Rename: addField

Return values
$this

addIndexBy()

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
$this

addIndexByColumn()

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
$this

addIndexByScalar()

Sets to index by a scalar result column name.

public addIndexByScalar(string $resultColumnName) : $this
Parameters
$resultColumnName : string
Return values
$this

addJoinedEntityResult()

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
psalm-param

class-string $class

todo

Rename: addJoinedEntity

Return values
$this

addMetadataParameterMapping()

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
todo

Make all methods of this class require all parameters and not infer anything

Return values
$this

addScalarResult()

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
todo

Rename: addScalar

Return values
$this

getAliasMap()

public getAliasMap() : mixed
Tags
psalm-return

array<string, class-string>

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-string

getDeclaringClass()

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-string

getEntityAlias()

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
string

getEntityResultCount()

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

public getEntityResultCount() : int
Tags
psalm-return

0|positive-int

Return values
int

getFieldName()

Gets the field name for a column name.

public getFieldName(string $columnName) : string
Parameters
$columnName : string
Return values
string

getParentAlias()

Gets the parent alias of the given alias.

public getParentAlias(string $alias) : string
Parameters
$alias : string
Return values
string

getRelation()

public getRelation(string $alias) : string
Parameters
$alias : string
Return values
string

getScalarAlias()

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|int

hasIndexBy()

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
todo

Rename: isIndexed($alias)

Return values
bool

hasParentAlias()

Checks whether the given alias has a parent alias.

public hasParentAlias(string $alias) : bool
Parameters
$alias : string
Return values
bool

isFieldResult()

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
todo

Rename: isField

Return values
bool

isMixedResult()

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
bool

isRelation()

public isRelation(string $alias) : bool
Parameters
$alias : string
Return values
bool

isScalarResult()

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
todo

Rename: isScalar

Return values
bool

setDiscriminatorColumn()

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.

Tags
todo

Rename: addDiscriminatorColumn

Return values
$this

        
On this page

Search results