PHP Class Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo

Once populated, ClassMetadata instances are usually cached in a serialized form. IMPORTANT NOTE: The fields of this class are only public for 2 reasons: 1) To allow fast READ access. 2) To drastically reduce the size of a serialized instance (private/protected members get the whole class name, namespace inclusive, prepended to every property in the serialized representation).
Since: 1.0
Inheritance: implements Doctrine\Common\Persistence\Mapping\ClassMetadata
Afficher le fichier Open project: doctrine/mongodb-odm Class Usage Examples

Méthodes publiques

Свойство Type Description
$alsoLoadMethods array READ-ONLY: Array of fields to also load with a given method.
$associationMappings array Keys are field names and values are mapping definitions.
$changeTrackingPolicy integer READ-ONLY: The policy used for change-tracking on entities of this class.
$collection READ-ONLY: The name of the mongo collection the document is mapped to.
$collectionCapped READ-ONLY: If the collection should be a fixed size.
$collectionMax READ-ONLY: If the collection is fixed size, the maximum number of elements to store in the collection.
$collectionSize READ-ONLY: If the collection is fixed size, its size in bytes.
$customRepositoryClassName string (Optional).
$db READ-ONLY: The name of the mongo database the document is mapped to.
$defaultDiscriminatorValue string READ-ONLY: The default value for discriminatorField in case it's not set in the document
$discriminatorField string READ-ONLY: The definition of the discriminator field used in SINGLE_COLLECTION inheritance mapping.
$discriminatorMap mixed This does only apply to the SINGLE_COLLECTION inheritance mapping strategy where a discriminator field is used.
$discriminatorValue mixed This does only apply to the JOINED and SINGLE_COLLECTION inheritance mapping strategies where a discriminator field is used.
$distance READ-ONLY: The field that stores the calculated distance when performing geo spatial queries.
$fieldMappings array Keys are field names and values are mapping definitions. The mapping definition array has the following values: - fieldName (string) The name of the field in the Document. - id (boolean, optional) Marks the field as the primary key of the document. Multiple fields of an document can have the id attribute, forming a composite key.
$file READ-ONLY: The field that stores a file reference and indicates the document is a file and should be stored on the MongoGridFS.
$generatorOptions array READ-ONLY: The Id generator options.
$generatorType string READ-ONLY: The Id generator type used by the class.
$idGenerator Doctrine\ODM\MongoDB\Id\AbstractIdGenerator READ-ONLY: The ID generator used for generating IDs for this class.
$identifier READ-ONLY: The field name of the document identifier.
$indexes READ-ONLY: The array of indexes for the document collection.
$inheritanceType integer READ-ONLY: The inheritance mapping type used by the class.
$isEmbeddedDocument boolean READ-ONLY: Whether this class describes the mapping of a embedded document.
$isLockable boolean READ-ONLY: A flag for whether or not instances of this class are to allow pessimistic locking.
$isMappedSuperclass boolean READ-ONLY: Whether this class describes the mapping of a mapped superclass.
$isQueryResultDocument boolean READ-ONLY: Whether this class describes the mapping of an aggregation result document.
$isVersioned boolean READ-ONLY: A flag for whether or not instances of this class are to be versioned with optimistic locking.
$lifecycleCallbacks array READ-ONLY: The registered lifecycle callbacks for documents of this class.
$lockField mixed READ-ONLY: The name of the field which is used for locking a document.
$name READ-ONLY: The name of the document class.
$namespace string READ-ONLY: The namespace the document class is contained in.
$parentClasses array READ-ONLY: The names of the parent classes (ancestors).
$reflClass ReflectionClass The ReflectionClass instance of the mapped class.
$reflFields ReflectionProperty[] The ReflectionProperty instances of the mapped class.
$requireIndexes READ-ONLY: Whether or not queries on this document should require indexes.
$rootDocumentName string READ-ONLY: The name of the document class that is at the root of the mapped document inheritance hierarchy. If the document is not part of a mapped inheritance hierarchy this is the same as {@link $documentName}.
$shardKey READ-ONLY: Keys and options describing shard key. Only for sharded collections.
$slaveOkay READ-ONLY: Whether or not reads for this class are okay to read from a slave.
$subClasses array READ-ONLY: The names of all subclasses (descendants).
$versionField mixed READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any).
$writeConcern READ-ONLY: Describes the level of acknowledgement requested from MongoDB for write operations.

Méthodes publiques

Méthode Description
__construct ( string $documentName ) Initializes a new ClassMetadata instance that will hold the object-document mapping metadata of the class with the given name.
addIndex ( array $keys, array $options = [] ) Add a index for this Document.
addInheritedAssociationMapping ( array $mapping ) : void INTERNAL: Adds an association mapping without completing/validating it.
addInheritedFieldMapping ( array $fieldMapping ) INTERNAL: Adds a field mapping without completing/validating it.
addLifecycleCallback ( string $callback, string $event ) Adds a lifecycle callback for documents of this class.
getAssociationCollectionClass ( string $assocName ) Retrieve the collectionClass associated with an association
getAssociationMappedByTargetField ( $fieldName ) {@inheritDoc}
getAssociationNames ( ) {@inheritDoc}
getAssociationTargetClass ( $assocName ) {@inheritDoc}
getCollection ( ) : string Get the collection this Document is mapped to.
getCollectionCapped ( ) : boolean Get whether or not the documents collection is capped.
getCollectionMax ( ) : integer Get the collection max.
getCollectionSize ( ) : integer Get the collection size
getDatabase ( ) : string Returns the database this Document is mapped to.
getDatabaseIdentifierValue ( mixed $id ) : mixed Casts the identifier to its database type.
getDistance ( ) : string Returns the distance field name.
getEmbeddedFieldsMappings ( ) : array Gets mappings of fields holding embedded document(s).
getFieldMapping ( string $fieldName ) : array Gets the mapping of a field.
getFieldMappingByDbFieldName ( string $dbFieldName ) : array Gets the field mapping by its DB name.
getFieldNames ( ) {@inheritDoc}
getFieldValue ( object $document, string $field ) : mixed Gets the specified field's value off the given document.
getFile ( ) : string Returns the file field name.
getIdentifier ( ) {@inheritDoc}
getIdentifierFieldNames ( ) {@inheritDoc}
getIdentifierObject ( object $document ) : MongoId Get the document identifier object as a database type.
getIdentifierValue ( object $document ) : mixed Gets the document identifier as a PHP type.
getIdentifierValues ( $object ) {@inheritDoc}
getIndexes ( ) : array Returns the array of indexes for this Document.
getLifecycleCallbacks ( string $event ) : array Gets the registered lifecycle callbacks for an event.
getName ( ) {@inheritDoc}
getNamespace ( ) : string The namespace this Document class belongs to.
getPHPIdentifierValue ( mixed $id ) : mixed Casts the identifier to its portable PHP type.
getReflectionClass ( ) {@inheritDoc}
getReflectionProperties ( ) : array Gets the ReflectionProperties of the mapped class.
getReflectionProperty ( string $name ) : ReflectionProperty Gets a ReflectionProperty for a specific field of the mapped class.
getShardKey ( ) : array
getTypeOfField ( $fieldName ) {@inheritDoc}
getWriteConcern ( ) : string
hasAssociation ( $fieldName ) {@inheritDoc}
hasDiscriminator ( ) : boolean Checks whether the document has a discriminator field and value configured.
hasEmbed ( string $fieldName ) : boolean Checks whether the class has a mapped embed with the given field name.
hasField ( $fieldName ) {@inheritDoc}
hasIndexes ( ) : boolean Checks whether this document has indexes or not.
hasLifecycleCallbacks ( string $event ) : boolean Checks whether the class has callbacks registered for a lifecycle event.
hasReference ( string $fieldName ) : boolean Checks whether the class has a mapped association with the given field name.
hasWriteConcern ( ) : boolean Whether there is a write concern configured for this class.
invokeLifecycleCallbacks ( string $event, object $document, array $arguments = null ) Dispatches the lifecycle event of the given document by invoking all registered callbacks.
isAssociationInverseSide ( $fieldName ) {@inheritDoc}
isChangeTrackingDeferredExplicit ( ) : boolean Whether the change tracking policy of this class is "deferred explicit".
isChangeTrackingDeferredImplicit ( ) : boolean Whether the change tracking policy of this class is "deferred implicit".
isChangeTrackingNotify ( ) : boolean Whether the change tracking policy of this class is "notify".
isCollectionValuedAssociation ( $fieldName ) {@inheritDoc}
isCollectionValuedEmbed ( string $fieldName ) : boolean Checks whether the class has a mapped embedded document for the specified field and if yes, checks whether it is a collection-valued association (to-many).
isCollectionValuedReference ( string $fieldName ) : boolean Checks whether the class has a mapped association for the specified field and if yes, checks whether it is a collection-valued association (to-many).
isFile ( ) : boolean Returns TRUE if this Document is a file to be stored on the MongoGridFS FALSE otherwise.
isIdGeneratorAuto ( ) : boolean Checks whether the class will generate a new \MongoId instance for us.
isIdGeneratorIncrement ( ) : boolean Checks whether the class will use a collection to generate incremented identifiers.
isIdGeneratorNone ( ) : boolean Checks whether the class uses no id generator.
isIdGeneratorUuid ( ) : boolean Checks whether the class will generate a uuid id.
isIdentifier ( $fieldName ) {@inheritDoc}
isInheritanceTypeCollectionPerClass ( ) : boolean Checks whether the mapped class uses the COLLECTION_PER_CLASS inheritance mapping strategy.
isInheritanceTypeNone ( ) : boolean
isInheritanceTypeSingleCollection ( ) : boolean Checks whether the mapped class uses the SINGLE_COLLECTION inheritance mapping strategy.
isInheritedField ( string $fieldName ) : boolean Checks whether a mapped field is inherited from an entity superclass.
isMappedToCollection ( ) : boolean Returns TRUE if this Document is mapped to a collection FALSE otherwise.
isNullable ( string $fieldName ) : boolean Check if the field is not null.
isSharded ( ) : boolean Checks whether this document has shard key or not.
isSingleValuedAssociation ( $fieldName ) {@inheritDoc}
isSingleValuedEmbed ( string $fieldName ) : boolean Checks whether the class has a mapped embedded document for the specified field and if yes, checks whether it is a single-valued association (to-one).
isSingleValuedReference ( string $fieldName ) : boolean Checks whether the class has a mapped association for the specified field and if yes, checks whether it is a single-valued association (to-one).
mapField ( array $mapping ) : array Map a field.
mapFile ( array $mapping ) Map a MongoGridFSFile.
mapManyEmbedded ( array $mapping ) Map a collection of embedded documents.
mapManyReference ( array $mapping ) Map a collection of document references.
mapOneEmbedded ( array $mapping ) Map a single embedded document.
mapOneReference ( array $mapping ) Map a single document reference.
registerAlsoLoadMethod ( string $method, array | string $fields ) Registers a method for loading document data before field hydration.
setAlsoLoadMethods ( array $methods ) Sets the AlsoLoad methods for documents of this class.
setChangeTrackingPolicy ( integer $policy ) Sets the change tracking policy used by this class.
setCollection ( array | string $name ) Sets the collection this Document is mapped to.
setCollectionCapped ( boolean $bool ) Set whether or not the documents collection is capped.
setCollectionMax ( integer $max ) Set the collection max.
setCollectionSize ( integer $size ) Set the collection size.
setCustomRepositoryClass ( string $repositoryClassName ) Registers a custom repository class for the document class.
setDatabase ( string $db ) Set the database this Document is mapped to.
setDefaultDiscriminatorValue ( string $defaultDiscriminatorValue ) Sets the default discriminator value to be used for this class Used for JOINED and SINGLE_TABLE inheritance mapping strategies if the document has no discriminator value
setDiscriminatorField ( string $discriminatorField ) Sets the discriminator field.
setDiscriminatorMap ( array $map ) Sets the discriminator values used by this class.
setDiscriminatorValue ( string $value ) Sets the discriminator value for this class.
setDistance ( string $distance ) Set the field name that stores the distance.
setFieldValue ( object $document, string $field, mixed $value ) Sets the specified field to the specified value on the given document.
setFile ( string $file ) Set the field name that stores the grid file.
setIdGenerator ( AbstractIdGenerator $generator ) Sets the ID generator used to generate IDs for instances of this class.
setIdGeneratorOptions ( array $generatorOptions ) Sets the Id generator options.
setIdGeneratorType ( string $generatorType ) Sets the type of Id generator to use for the mapped class.
setIdentifier ( string $identifier ) INTERNAL: Sets the mapped identifier field of this class.
setIdentifierValue ( object $document, mixed $id ) Sets the document identifier of a document.
setInheritanceType ( integer $type ) Sets the inheritance type used by the class and it's subclasses.
setLifecycleCallbacks ( array $callbacks ) Sets the lifecycle callbacks for documents of this class.
setLockField ( string $lockField ) Sets the name of the field that is to be used for storing whether a document is currently locked or not.
setLockMapping ( array &$mapping ) Sets the version field mapping used for versioning. Sets the default value to use depending on the column type.
setLockable ( boolean $bool ) Sets whether this class is to allow pessimistic locking.
setParentClasses ( array $classNames ) Sets the parent class names.
setRequireIndexes ( boolean $requireIndexes ) Set whether or not queries on this document should require indexes.
setShardKey ( array $keys, array $options = [] ) Set shard key for this Document.
setSlaveOkay ( boolean | null $slaveOkay ) Sets the slaveOkay option applied to collections for this class.
setSubclasses ( array $subclasses ) Sets the mapped subclasses of this class.
setVersionField ( string $versionField ) Sets the name of the field that is to be used for versioning if this class is versioned for optimistic locking.
setVersionMapping ( array &$mapping ) Sets the version field mapping used for versioning. Sets the default value to use depending on the column type.
setVersioned ( boolean $bool ) Sets whether this class is to be versioned for optimistic locking.
setWriteConcern ( string $writeConcern ) Sets the write concern used by this class.

Private Methods

Méthode Description
applyStorageStrategy ( array &$mapping ) Validates the storage strategy of a mapping for consistency

Method Details

__construct() public méthode

Initializes a new ClassMetadata instance that will hold the object-document mapping metadata of the class with the given name.
public __construct ( string $documentName )
$documentName string The name of the document class the new instance is used for.

addIndex() public méthode

Add a index for this Document.
public addIndex ( array $keys, array $options = [] )
$keys array Array of keys for the index.
$options array Array of options for the index.

addInheritedAssociationMapping() public méthode

This is mainly used to add inherited association mappings to derived classes.
public addInheritedAssociationMapping ( array $mapping ) : void
$mapping array
Résultat void

addInheritedFieldMapping() public méthode

This is mainly used to add inherited field mappings to derived classes.
public addInheritedFieldMapping ( array $fieldMapping )
$fieldMapping array

addLifecycleCallback() public méthode

If the callback is already registered, this is a NOOP.
public addLifecycleCallback ( string $callback, string $event )
$callback string
$event string

getAssociationCollectionClass() public méthode

Retrieve the collectionClass associated with an association
public getAssociationCollectionClass ( string $assocName )
$assocName string

getAssociationMappedByTargetField() public méthode

{@inheritDoc}
public getAssociationMappedByTargetField ( $fieldName )

getAssociationNames() public méthode

{@inheritDoc}
public getAssociationNames ( )

getAssociationTargetClass() public méthode

{@inheritDoc}
public getAssociationTargetClass ( $assocName )

getCollection() public méthode

Get the collection this Document is mapped to.
public getCollection ( ) : string
Résultat string $collection The collection name.

getCollectionCapped() public méthode

Get whether or not the documents collection is capped.
public getCollectionCapped ( ) : boolean
Résultat boolean

getCollectionMax() public méthode

Get the collection max.
public getCollectionMax ( ) : integer
Résultat integer

getCollectionSize() public méthode

Get the collection size
public getCollectionSize ( ) : integer
Résultat integer

getDatabase() public méthode

Returns the database this Document is mapped to.
public getDatabase ( ) : string
Résultat string $db The database name.

getDatabaseIdentifierValue() public méthode

Casts the identifier to its database type.
public getDatabaseIdentifierValue ( mixed $id ) : mixed
$id mixed
Résultat mixed $id

getDistance() public méthode

Returns the distance field name.
public getDistance ( ) : string
Résultat string $distance The distance field name.

getEmbeddedFieldsMappings() public méthode

Gets mappings of fields holding embedded document(s).
public getEmbeddedFieldsMappings ( ) : array
Résultat array of field mappings

getFieldMapping() public méthode

Gets the mapping of a field.
public getFieldMapping ( string $fieldName ) : array
$fieldName string The field name.
Résultat array The field mapping.

getFieldMappingByDbFieldName() public méthode

E.g. it returns identifier's mapping when called with _id.
public getFieldMappingByDbFieldName ( string $dbFieldName ) : array
$dbFieldName string
Résultat array

getFieldNames() public méthode

{@inheritDoc}
public getFieldNames ( )

getFieldValue() public méthode

Gets the specified field's value off the given document.
public getFieldValue ( object $document, string $field ) : mixed
$document object
$field string
Résultat mixed

getFile() public méthode

Returns the file field name.
public getFile ( ) : string
Résultat string $file The file field name.

getIdentifier() public méthode

Since MongoDB only allows exactly one identifier field this will always return an array with only one value
public getIdentifier ( )

getIdentifierFieldNames() public méthode

Since MongoDB only allows exactly one identifier field this will always return an array with only one value

getIdentifierObject() public méthode

Get the document identifier object as a database type.
public getIdentifierObject ( object $document ) : MongoId
$document object
Résultat MongoId $id The MongoID object.

getIdentifierValue() public méthode

Gets the document identifier as a PHP type.
public getIdentifierValue ( object $document ) : mixed
$document object
Résultat mixed $id

getIdentifierValues() public méthode

Since MongoDB only allows exactly one identifier field this is a proxy to {@see \getIdentifierValue()} and returns an array with the identifier field as a key.
public getIdentifierValues ( $object )

getIndexes() public méthode

Returns the array of indexes for this Document.
public getIndexes ( ) : array
Résultat array $indexes The array of indexes.

getLifecycleCallbacks() public méthode

Gets the registered lifecycle callbacks for an event.
public getLifecycleCallbacks ( string $event ) : array
$event string
Résultat array

getName() public méthode

{@inheritDoc}
public getName ( )

getNamespace() public méthode

The namespace this Document class belongs to.
public getNamespace ( ) : string
Résultat string $namespace The namespace name.

getPHPIdentifierValue() public méthode

Casts the identifier to its portable PHP type.
public getPHPIdentifierValue ( mixed $id ) : mixed
$id mixed
Résultat mixed $id

getReflectionClass() public méthode

{@inheritDoc}
public getReflectionClass ( )

getReflectionProperties() public méthode

Gets the ReflectionProperties of the mapped class.
public getReflectionProperties ( ) : array
Résultat array An array of ReflectionProperty instances.

getReflectionProperty() public méthode

Gets a ReflectionProperty for a specific field of the mapped class.
public getReflectionProperty ( string $name ) : ReflectionProperty
$name string
Résultat ReflectionProperty

getShardKey() public méthode

public getShardKey ( ) : array
Résultat array

getTypeOfField() public méthode

{@inheritDoc}
public getTypeOfField ( $fieldName )

getWriteConcern() public méthode

public getWriteConcern ( ) : string
Résultat string

hasAssociation() public méthode

Checks whether the class has a mapped association (embed or reference) with the given field name.
public hasAssociation ( $fieldName )

hasDiscriminator() public méthode

Checks whether the document has a discriminator field and value configured.
public hasDiscriminator ( ) : boolean
Résultat boolean

hasEmbed() public méthode

Checks whether the class has a mapped embed with the given field name.
public hasEmbed ( string $fieldName ) : boolean
$fieldName string
Résultat boolean

hasField() public méthode

{@inheritDoc}
public hasField ( $fieldName )

hasIndexes() public méthode

Checks whether this document has indexes or not.
public hasIndexes ( ) : boolean
Résultat boolean

hasLifecycleCallbacks() public méthode

Checks whether the class has callbacks registered for a lifecycle event.
public hasLifecycleCallbacks ( string $event ) : boolean
$event string Lifecycle event
Résultat boolean

hasReference() public méthode

Checks whether the class has a mapped association with the given field name.
public hasReference ( string $fieldName ) : boolean
$fieldName string
Résultat boolean

hasWriteConcern() public méthode

Whether there is a write concern configured for this class.
public hasWriteConcern ( ) : boolean
Résultat boolean

invokeLifecycleCallbacks() public méthode

Dispatches the lifecycle event of the given document by invoking all registered callbacks.
public invokeLifecycleCallbacks ( string $event, object $document, array $arguments = null )
$event string Lifecycle event
$document object Document on which the event occurred
$arguments array Arguments to pass to all callbacks

isAssociationInverseSide() public méthode

{@inheritDoc}
public isAssociationInverseSide ( $fieldName )

isChangeTrackingDeferredExplicit() public méthode

Whether the change tracking policy of this class is "deferred explicit".

isChangeTrackingDeferredImplicit() public méthode

Whether the change tracking policy of this class is "deferred implicit".

isChangeTrackingNotify() public méthode

Whether the change tracking policy of this class is "notify".
public isChangeTrackingNotify ( ) : boolean
Résultat boolean

isCollectionValuedAssociation() public méthode

Checks whether the class has a mapped reference or embed for the specified field and is a collection valued association.
public isCollectionValuedAssociation ( $fieldName )

isCollectionValuedEmbed() public méthode

Checks whether the class has a mapped embedded document for the specified field and if yes, checks whether it is a collection-valued association (to-many).
public isCollectionValuedEmbed ( string $fieldName ) : boolean
$fieldName string
Résultat boolean TRUE if the association exists and is collection-valued, FALSE otherwise.

isCollectionValuedReference() public méthode

Checks whether the class has a mapped association for the specified field and if yes, checks whether it is a collection-valued association (to-many).
public isCollectionValuedReference ( string $fieldName ) : boolean
$fieldName string
Résultat boolean TRUE if the association exists and is collection-valued, FALSE otherwise.

isFile() public méthode

Returns TRUE if this Document is a file to be stored on the MongoGridFS FALSE otherwise.
public isFile ( ) : boolean
Résultat boolean

isIdGeneratorAuto() public méthode

Checks whether the class will generate a new \MongoId instance for us.
public isIdGeneratorAuto ( ) : boolean
Résultat boolean TRUE if the class uses the AUTO generator, FALSE otherwise.

isIdGeneratorIncrement() public méthode

Checks whether the class will use a collection to generate incremented identifiers.
public isIdGeneratorIncrement ( ) : boolean
Résultat boolean TRUE if the class uses the INCREMENT generator, FALSE otherwise.

isIdGeneratorNone() public méthode

Checks whether the class uses no id generator.
public isIdGeneratorNone ( ) : boolean
Résultat boolean TRUE if the class does not use any id generator, FALSE otherwise.

isIdGeneratorUuid() public méthode

Checks whether the class will generate a uuid id.
public isIdGeneratorUuid ( ) : boolean
Résultat boolean TRUE if the class uses the UUID generator, FALSE otherwise.

isIdentifier() public méthode

{@inheritDoc}
public isIdentifier ( $fieldName )

isInheritanceTypeCollectionPerClass() public méthode

Checks whether the mapped class uses the COLLECTION_PER_CLASS inheritance mapping strategy.

isInheritanceTypeNone() public méthode

public isInheritanceTypeNone ( ) : boolean
Résultat boolean

isInheritanceTypeSingleCollection() public méthode

Checks whether the mapped class uses the SINGLE_COLLECTION inheritance mapping strategy.

isInheritedField() public méthode

Checks whether a mapped field is inherited from an entity superclass.
public isInheritedField ( string $fieldName ) : boolean
$fieldName string
Résultat boolean TRUE if the field is inherited, FALSE otherwise.

isMappedToCollection() public méthode

Returns TRUE if this Document is mapped to a collection FALSE otherwise.
public isMappedToCollection ( ) : boolean
Résultat boolean

isNullable() public méthode

Check if the field is not null.
public isNullable ( string $fieldName ) : boolean
$fieldName string The field name
Résultat boolean TRUE if the field is not null, FALSE otherwise.

isSharded() public méthode

Checks whether this document has shard key or not.
public isSharded ( ) : boolean
Résultat boolean

isSingleValuedAssociation() public méthode

Checks whether the class has a mapped reference or embed for the specified field and is a single valued association.
public isSingleValuedAssociation ( $fieldName )

isSingleValuedEmbed() public méthode

Checks whether the class has a mapped embedded document for the specified field and if yes, checks whether it is a single-valued association (to-one).
public isSingleValuedEmbed ( string $fieldName ) : boolean
$fieldName string
Résultat boolean TRUE if the association exists and is single-valued, FALSE otherwise.

isSingleValuedReference() public méthode

Checks whether the class has a mapped association for the specified field and if yes, checks whether it is a single-valued association (to-one).
public isSingleValuedReference ( string $fieldName ) : boolean
$fieldName string
Résultat boolean TRUE if the association exists and is single-valued, FALSE otherwise.

mapField() public méthode

Map a field.
public mapField ( array $mapping ) : array
$mapping array The mapping information.
Résultat array

mapFile() public méthode

Map a MongoGridFSFile.
public mapFile ( array $mapping )
$mapping array The mapping information.

mapManyEmbedded() public méthode

Map a collection of embedded documents.
public mapManyEmbedded ( array $mapping )
$mapping array The mapping information.

mapManyReference() public méthode

Map a collection of document references.
public mapManyReference ( array $mapping )
$mapping array The mapping information.

mapOneEmbedded() public méthode

Map a single embedded document.
public mapOneEmbedded ( array $mapping )
$mapping array The mapping information.

mapOneReference() public méthode

Map a single document reference.
public mapOneReference ( array $mapping )
$mapping array The mapping information.

registerAlsoLoadMethod() public méthode

Note: A method may be registered multiple times for different fields. it will be invoked only once for the first field found.
public registerAlsoLoadMethod ( string $method, array | string $fields )
$method string Method name
$fields array | string Database field name(s)

setAlsoLoadMethods() public méthode

Any previously registered methods are overwritten.
public setAlsoLoadMethods ( array $methods )
$methods array

setChangeTrackingPolicy() public méthode

Sets the change tracking policy used by this class.
public setChangeTrackingPolicy ( integer $policy )
$policy integer

setCollection() public méthode

Sets the collection this Document is mapped to.
public setCollection ( array | string $name )
$name array | string

setCollectionCapped() public méthode

Set whether or not the documents collection is capped.
public setCollectionCapped ( boolean $bool )
$bool boolean

setCollectionMax() public méthode

Set the collection max.
public setCollectionMax ( integer $max )
$max integer

setCollectionSize() public méthode

Set the collection size.
public setCollectionSize ( integer $size )
$size integer

setCustomRepositoryClass() public méthode

Registers a custom repository class for the document class.
public setCustomRepositoryClass ( string $repositoryClassName )
$repositoryClassName string The class name of the custom repository.

setDatabase() public méthode

Set the database this Document is mapped to.
public setDatabase ( string $db )
$db string The database name

setDefaultDiscriminatorValue() public méthode

Sets the default discriminator value to be used for this class Used for JOINED and SINGLE_TABLE inheritance mapping strategies if the document has no discriminator value
public setDefaultDiscriminatorValue ( string $defaultDiscriminatorValue )
$defaultDiscriminatorValue string

setDiscriminatorField() public méthode

The field name is the the unmapped database field. Discriminator values are only used to discern the hydration class and are not mapped to class properties.
public setDiscriminatorField ( string $discriminatorField )
$discriminatorField string

setDiscriminatorMap() public méthode

Used for JOINED and SINGLE_TABLE inheritance mapping strategies.
public setDiscriminatorMap ( array $map )
$map array

setDiscriminatorValue() public méthode

Used for JOINED/SINGLE_TABLE inheritance and multiple document types in a single collection.
public setDiscriminatorValue ( string $value )
$value string

setDistance() public méthode

Set the field name that stores the distance.
public setDistance ( string $distance )
$distance string

setFieldValue() public méthode

Sets the specified field to the specified value on the given document.
public setFieldValue ( object $document, string $field, mixed $value )
$document object
$field string
$value mixed

setFile() public méthode

Set the field name that stores the grid file.
public setFile ( string $file )
$file string

setIdGenerator() public méthode

Sets the ID generator used to generate IDs for instances of this class.
public setIdGenerator ( AbstractIdGenerator $generator )
$generator Doctrine\ODM\MongoDB\Id\AbstractIdGenerator

setIdGeneratorOptions() public méthode

Sets the Id generator options.
public setIdGeneratorOptions ( array $generatorOptions )
$generatorOptions array Generator options.

setIdGeneratorType() public méthode

Sets the type of Id generator to use for the mapped class.
public setIdGeneratorType ( string $generatorType )
$generatorType string Generator type.

setIdentifier() public méthode

INTERNAL: Sets the mapped identifier field of this class.
public setIdentifier ( string $identifier )
$identifier string

setIdentifierValue() public méthode

The value will be converted to a PHP type before being set.
public setIdentifierValue ( object $document, mixed $id )
$document object
$id mixed

setInheritanceType() public méthode

Sets the inheritance type used by the class and it's subclasses.
public setInheritanceType ( integer $type )
$type integer

setLifecycleCallbacks() public méthode

Any previously registered callbacks are overwritten.
public setLifecycleCallbacks ( array $callbacks )
$callbacks array

setLockField() public méthode

Sets the name of the field that is to be used for storing whether a document is currently locked or not.
public setLockField ( string $lockField )
$lockField string

setLockMapping() public méthode

Sets the version field mapping used for versioning. Sets the default value to use depending on the column type.
public setLockMapping ( array &$mapping )
$mapping array The version field mapping array

setLockable() public méthode

Sets whether this class is to allow pessimistic locking.
public setLockable ( boolean $bool )
$bool boolean

setParentClasses() public méthode

Assumes that the class names in the passed array are in the order: directParent -> directParentParent -> directParentParentParent ... -> root.
public setParentClasses ( array $classNames )
$classNames array

setRequireIndexes() public méthode

Set whether or not queries on this document should require indexes.
Deprecation: method was deprecated in 1.2 and will be removed in 2.0
public setRequireIndexes ( boolean $requireIndexes )
$requireIndexes boolean

setShardKey() public méthode

Set shard key for this Document.
public setShardKey ( array $keys, array $options = [] )
$keys array Array of document keys.
$options array Array of sharding options.

setSlaveOkay() public méthode

Sets the slaveOkay option applied to collections for this class.
public setSlaveOkay ( boolean | null $slaveOkay )
$slaveOkay boolean | null

setSubclasses() public méthode

Sets the mapped subclasses of this class.
public setSubclasses ( array $subclasses )
$subclasses array The names of all mapped subclasses.

setVersionField() public méthode

Sets the name of the field that is to be used for versioning if this class is versioned for optimistic locking.
public setVersionField ( string $versionField )
$versionField string

setVersionMapping() public méthode

Sets the version field mapping used for versioning. Sets the default value to use depending on the column type.
public setVersionMapping ( array &$mapping )
$mapping array The version field mapping array

setVersioned() public méthode

Sets whether this class is to be versioned for optimistic locking.
public setVersioned ( boolean $bool )
$bool boolean

setWriteConcern() public méthode

Sets the write concern used by this class.
public setWriteConcern ( string $writeConcern )
$writeConcern string

Property Details

$alsoLoadMethods public_oe property

READ-ONLY: Array of fields to also load with a given method.
public array $alsoLoadMethods
Résultat array

$associationMappings public_oe property

Keys are field names and values are mapping definitions.
public array $associationMappings
Résultat array

$changeTrackingPolicy public_oe property

READ-ONLY: The policy used for change-tracking on entities of this class.
public int $changeTrackingPolicy
Résultat integer

$collection public_oe property

READ-ONLY: The name of the mongo collection the document is mapped to.
public $collection

$collectionCapped public_oe property

READ-ONLY: If the collection should be a fixed size.
public $collectionCapped

$collectionMax public_oe property

READ-ONLY: If the collection is fixed size, the maximum number of elements to store in the collection.
public $collectionMax

$collectionSize public_oe property

READ-ONLY: If the collection is fixed size, its size in bytes.
public $collectionSize

$customRepositoryClassName public_oe property

(Optional).
public string $customRepositoryClassName
Résultat string

$db public_oe property

READ-ONLY: The name of the mongo database the document is mapped to.
public $db

$defaultDiscriminatorValue public_oe property

READ-ONLY: The default value for discriminatorField in case it's not set in the document
See also: discriminatorField
public string $defaultDiscriminatorValue
Résultat string

$discriminatorField public_oe property

READ-ONLY: The definition of the discriminator field used in SINGLE_COLLECTION inheritance mapping.
public string $discriminatorField
Résultat string

$discriminatorMap public_oe property

This does only apply to the SINGLE_COLLECTION inheritance mapping strategy where a discriminator field is used.
See also: discriminatorField
public mixed $discriminatorMap
Résultat mixed

$discriminatorValue public_oe property

This does only apply to the JOINED and SINGLE_COLLECTION inheritance mapping strategies where a discriminator field is used.
See also: discriminatorField
public mixed $discriminatorValue
Résultat mixed

$distance public_oe property

READ-ONLY: The field that stores the calculated distance when performing geo spatial queries.
public $distance

$fieldMappings public_oe property

Keys are field names and values are mapping definitions. The mapping definition array has the following values: - fieldName (string) The name of the field in the Document. - id (boolean, optional) Marks the field as the primary key of the document. Multiple fields of an document can have the id attribute, forming a composite key.
public array $fieldMappings
Résultat array

$file public_oe property

READ-ONLY: The field that stores a file reference and indicates the document is a file and should be stored on the MongoGridFS.
public $file

$generatorOptions public_oe property

READ-ONLY: The Id generator options.
public array $generatorOptions
Résultat array

$generatorType public_oe property

READ-ONLY: The Id generator type used by the class.
public string $generatorType
Résultat string

$idGenerator public_oe property

READ-ONLY: The ID generator used for generating IDs for this class.
public AbstractIdGenerator,Doctrine\ODM\MongoDB\Id $idGenerator
Résultat Doctrine\ODM\MongoDB\Id\AbstractIdGenerator

$identifier public_oe property

READ-ONLY: The field name of the document identifier.
public $identifier

$indexes public_oe property

READ-ONLY: The array of indexes for the document collection.
public $indexes

$inheritanceType public_oe property

READ-ONLY: The inheritance mapping type used by the class.
public int $inheritanceType
Résultat integer

$isEmbeddedDocument public_oe property

READ-ONLY: Whether this class describes the mapping of a embedded document.
public bool $isEmbeddedDocument
Résultat boolean

$isLockable public_oe property

READ-ONLY: A flag for whether or not instances of this class are to allow pessimistic locking.
public bool $isLockable
Résultat boolean

$isMappedSuperclass public_oe property

READ-ONLY: Whether this class describes the mapping of a mapped superclass.
public bool $isMappedSuperclass
Résultat boolean

$isQueryResultDocument public_oe property

READ-ONLY: Whether this class describes the mapping of an aggregation result document.
public bool $isQueryResultDocument
Résultat boolean

$isVersioned public_oe property

READ-ONLY: A flag for whether or not instances of this class are to be versioned with optimistic locking.
public bool $isVersioned
Résultat boolean

$lifecycleCallbacks public_oe property

READ-ONLY: The registered lifecycle callbacks for documents of this class.
public array $lifecycleCallbacks
Résultat array

$lockField public_oe property

READ-ONLY: The name of the field which is used for locking a document.
public mixed $lockField
Résultat mixed

$name public_oe property

READ-ONLY: The name of the document class.
public $name

$namespace public_oe property

READ-ONLY: The namespace the document class is contained in.
public string $namespace
Résultat string

$parentClasses public_oe property

READ-ONLY: The names of the parent classes (ancestors).
public array $parentClasses
Résultat array

$reflClass public_oe property

The ReflectionClass instance of the mapped class.
public ReflectionClass $reflClass
Résultat ReflectionClass

$reflFields public_oe property

The ReflectionProperty instances of the mapped class.
public ReflectionProperty[] $reflFields
Résultat ReflectionProperty[]

$requireIndexes public_oe property

READ-ONLY: Whether or not queries on this document should require indexes.
Deprecation: property was deprecated in 1.2 and will be removed in 2.0
public $requireIndexes

$rootDocumentName public_oe property

READ-ONLY: The name of the document class that is at the root of the mapped document inheritance hierarchy. If the document is not part of a mapped inheritance hierarchy this is the same as {@link $documentName}.
public string $rootDocumentName
Résultat string

$shardKey public_oe property

READ-ONLY: Keys and options describing shard key. Only for sharded collections.
public $shardKey

$slaveOkay public_oe property

READ-ONLY: Whether or not reads for this class are okay to read from a slave.
public $slaveOkay

$subClasses public_oe property

READ-ONLY: The names of all subclasses (descendants).
public array $subClasses
Résultat array

$versionField public_oe property

READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any).
public mixed $versionField
Résultat mixed

$writeConcern public_oe property

READ-ONLY: Describes the level of acknowledgement requested from MongoDB for write operations.
public $writeConcern