Doctrine


Doctrine\ORM\Query\ResultSetMapping
/Doctrine/ORM/Query/ResultSetMapping.php at line 38

Class ResultSetMapping

ResultSetMapping

public class ResultSetMapping

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.

Author:
Roman Borschel
Since:
2.0
Todo:
Think about whether the number of lookup maps can be reduced.

Field Summary
array

$aliasMap

Maps alias names to class names.

array

$columnOwnerMap

Maps column names in the result set to the alias they belong to.

array

$declaringClasses

Map from column names to class names that declare the field the column is mapped to.

array

$discriminatorColumns

List of columns in the result set that are used as discriminator columns.

array

$fieldMappings

Maps column names in the result set to field names for each class.

array

$indexByMap

Maps alias names to field names that should be used for indexing.

boolean

$isMixed

Whether the result is mixed (contains scalar values together with field values).

array

$metaMappings

Maps column names of meta columns (foreign keys, discriminator columns, ...) to field names.

array

$parentAliasMap

Maps alias names to parent alias names.

array

$relationMap

Maps alias names to related association field names.

array

$scalarMappings

Maps column names in the result set to the alias/field name to use in the mapped result.

Method Summary
void

addEntityResult(string class, string alias)

Adds an entity result to this ResultSetMapping.

void

addFieldResult(string alias, string columnName, string fieldName, string declaringClass)

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

void

addIndexBy(string alias, string fieldName)

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

void

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

Adds a joined entity result.

void

addMetaResult(mixed alias, mixed columnName, mixed fieldName, $fieldName )

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

void

addScalarResult(string columnName, string alias)

Adds a scalar result mapping.

array

getAliasMap()

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

getDeclaringClass(string columnName)

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

string

getEntityAlias(string columnName)

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

integer

getEntityResultCount()

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

string

getFieldName(string columnName)

Gets the field name for a column name.

string

getParentAlias(string alias)

Gets the parent alias of the given alias.

AssociationMapping

getRelation(string alias)

string

getScalarAlias(string columnName)

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

boolean

hasIndexBy(string alias)

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

boolean

hasParentAlias(string alias)

Checks whether the given alias has a parent alias.

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.

boolean

isMixedResult()

Checks whether this ResultSetMapping defines a mixed result.

boolean

isRelation(string alias)

boolean

isScalarResult(mixed columnName, string columName)

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

void

setDiscriminatorColumn(string alias, string discrColumn)

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

Field Detail

/Doctrine/ORM/Query/ResultSetMapping.php at line 53

aliasMap

public array $aliasMap = array()

Maps alias names to class names.

Ignore.

/Doctrine/ORM/Query/ResultSetMapping.php at line 95

columnOwnerMap

public array $columnOwnerMap = array()

Maps column names in the result set to the alias they belong to.

Ignore.

/Doctrine/ORM/Query/ResultSetMapping.php at line 116

declaringClasses

public array $declaringClasses = array()

Map from column names to class names that declare the field the column is mapped to.

Ignore.

/Doctrine/ORM/Query/ResultSetMapping.php at line 102

discriminatorColumns

public array $discriminatorColumns = array()

List of columns in the result set that are used as discriminator columns.

Ignore.

/Doctrine/ORM/Query/ResultSetMapping.php at line 74

fieldMappings

public array $fieldMappings = array()

Maps column names in the result set to field names for each class.

Ignore.

/Doctrine/ORM/Query/ResultSetMapping.php at line 109

indexByMap

public array $indexByMap = array()

Maps alias names to field names that should be used for indexing.

Ignore.

/Doctrine/ORM/Query/ResultSetMapping.php at line 46

isMixed

public boolean $isMixed = false

Whether the result is mixed (contains scalar values together with field values).

Ignore.

/Doctrine/ORM/Query/ResultSetMapping.php at line 88

metaMappings

public array $metaMappings = array()

Maps column names of meta columns (foreign keys, discriminator columns, ...) to field names.

Ignore.

/Doctrine/ORM/Query/ResultSetMapping.php at line 67

parentAliasMap

public array $parentAliasMap = array()

Maps alias names to parent alias names.

Ignore.

/Doctrine/ORM/Query/ResultSetMapping.php at line 60

relationMap

public array $relationMap = array()

Maps alias names to related association field names.

Ignore.

/Doctrine/ORM/Query/ResultSetMapping.php at line 81

scalarMappings

public array $scalarMappings = array()

Maps column names in the result set to the alias/field name to use in the mapped result.

Ignore.

Method Detail

/Doctrine/ORM/Query/ResultSetMapping.php at line 126

addEntityResult

public void addEntityResult(string class, string alias)

Adds an entity result to this ResultSetMapping.

Parameters:
class - The class name of the entity.
alias - The alias for the class. The alias must be unique among all entity results or joined entity results within this ResultSetMapping.
Todo:
Rename: addRootEntity

/Doctrine/ORM/Query/ResultSetMapping.php at line 197

addFieldResult

public void addFieldResult(string alias, string columnName, string fieldName, string declaringClass)

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

Parameters:
alias - The alias of the root entity or joined entity to which the field belongs.
columnName - The name of the column in the SQL result set.
fieldName - The name of the field on the declaring class.
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.
Todo:
Rename: addField

/Doctrine/ORM/Query/ResultSetMapping.php at line 153

addIndexBy

public void addIndexBy(string alias, string fieldName)

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

Parameters:
alias - The alias of an entity result or joined entity result.
fieldName - The name of the field to use for indexing.

/Doctrine/ORM/Query/ResultSetMapping.php at line 219

addJoinedEntityResult

public void addJoinedEntityResult(string class, string alias, string parentAlias, object relation)

Adds a joined entity result.

Parameters:
class - The class name of the joined entity.
alias - The unique alias to use for the joined entity.
parentAlias - The alias of the entity result that is the parent of this joined result.
relation - The association field that connects the parent entity result with the joined entity result.
Todo:
Rename: addJoinedEntity

/Doctrine/ORM/Query/ResultSetMapping.php at line 390

addMetaResult

public void addMetaResult(mixed alias, mixed columnName, mixed fieldName, $fieldName )

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


/Doctrine/ORM/Query/ResultSetMapping.php at line 233

addScalarResult

public void addScalarResult(string columnName, string alias)

Adds a scalar result mapping.

Parameters:
columnName - The name of the column in the SQL result set.
alias - The result alias with which the scalar result should be placed in the result structure.
Todo:
Rename: addScalar

/Doctrine/ORM/Query/ResultSetMapping.php at line 355

getAliasMap

public array getAliasMap()


/Doctrine/ORM/Query/ResultSetMapping.php at line 260

getClassName

public string getClassName(string alias)

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


/Doctrine/ORM/Query/ResultSetMapping.php at line 282

getDeclaringClass

public string getDeclaringClass(string columnName)

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


/Doctrine/ORM/Query/ResultSetMapping.php at line 313

getEntityAlias

public string getEntityAlias(string columnName)

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


/Doctrine/ORM/Query/ResultSetMapping.php at line 365

getEntityResultCount

public integer getEntityResultCount()

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


/Doctrine/ORM/Query/ResultSetMapping.php at line 346

getFieldName

public string getFieldName(string columnName)

Gets the field name for a column name.


/Doctrine/ORM/Query/ResultSetMapping.php at line 324

getParentAlias

public string getParentAlias(string alias)

Gets the parent alias of the given alias.


/Doctrine/ORM/Query/ResultSetMapping.php at line 292

getRelation

public AssociationMapping getRelation(string alias)


/Doctrine/ORM/Query/ResultSetMapping.php at line 271

getScalarAlias

public string getScalarAlias(string columnName)

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

Parameters:
columnName - The name of the column in the SQL result set.

/Doctrine/ORM/Query/ResultSetMapping.php at line 166

hasIndexBy

public boolean hasIndexBy(string alias)

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

Todo:
Rename: isIndexed($alias)

/Doctrine/ORM/Query/ResultSetMapping.php at line 335

hasParentAlias

public boolean hasParentAlias(string alias)

Checks whether the given alias has a parent alias.


/Doctrine/ORM/Query/ResultSetMapping.php at line 179

isFieldResult

public 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:
columnName - The name of the column in the SQL result set.
Todo:
Rename: isField

/Doctrine/ORM/Query/ResultSetMapping.php at line 378

isMixedResult

public 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.


/Doctrine/ORM/Query/ResultSetMapping.php at line 302

isRelation

public boolean isRelation(string alias)


/Doctrine/ORM/Query/ResultSetMapping.php at line 248

isScalarResult

public boolean isScalarResult(mixed columnName, string columName)

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

Parameters:
columName - The name of the column in the SQL result set.
Todo:
Rename: isScalar

/Doctrine/ORM/Query/ResultSetMapping.php at line 141

setDiscriminatorColumn

public void 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:
alias - The alias of the entity result or joined entity result the discriminator column should be used for.
discrColumn - The name of the discriminator column in the SQL result set.
Todo:
Rename: addDiscriminatorColumn

Doctrine