PHP Class Doctrine\ODM\CouchDB\Mapping\ClassMetadata

Since: 1.0
Author: Benjamin Eberlei ([email protected])
Author: Lukas Kahwe Smith ([email protected])
Inheritance: extends Doctrine\ODM\CouchDB\Mapping\ClassMetadataInfo, implements Doctrine\Common\Persistence\Mapping\ClassMetadata
Afficher le fichier Open project: doctrine/couchdb-odm Class Usage Examples

Méthodes publiques

Свойство Type Description
$alsoLoadMethods array READ-ONLY: Array of fields to also load with a given method.
$associationsMappings array READ-ONLY
$attachmentDeclaredClass string | null If in an inheritance scenario the attachment field is on a super class, this is its name.
$attachmentField string Field that stores the attachments as a key->value array of file-names to attachment objects.
$customRepositoryClassName string (Optional).
$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.
$hasAttachments boolean
$idGenerator
$identifier READ-ONLY: The field name of the document identifier.
$inInheritanceHierachy READ-ONLY: Is this entity in an inheritance hierachy?
$indexed boolean Is this class indexed? If yes, then a findAll() query can be executed for this type.
$indexes array An array of indexed fields, accessible through a generic view shipped with Doctrine.
$isEmbeddedDocument boolean READ-ONLY: Whether this class describes the mapping of a embedded document.
$isMappedSuperclass boolean READ-ONLY: Whether this class describes the mapping of a mapped superclass.
$isReadOnly boolean This should be set to true for value objects, for example attachments. Replacing the reference with a new value object will trigger an update.
$isVersioned boolean CouchDB documents are always versioned, this flag determines if this version is exposed to the userland.
$jsonNames array An array of json result-key-names to field-names
$name READ-ONLY: The name of the document class.
$namespace string READ-ONLY: The namespace the document class is contained in.
$parentClasses READ-ONLY: a list of all parent classes.
$reflClass ReflectionClas\ReflectionClass The ReflectionClass instance of the mapped class.
$reflFields array The ReflectionProperty instances of the mapped class.
$rootDocumentName READ-ONLY: The root document class name.
$versionField string Version Field stores the CouchDB Revision

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.
__sleep ( ) : array Determines which fields get serialized.
deriveChildMetadata ( ClassMetadata $child ) Used to derive a class metadata of the current instance for a mapped child class.
getAssociationMappedByTargetField ( $assocName ) {@inheritDoc}
getAssociationNames ( ) : array A numerically indexed list of association names of this persistent class.
getAssociationTargetClass ( string $assocName ) : string Returns the target class name of the given association.
getFieldMapping ( string $fieldName ) : array Gets the mapping of a field.
getFieldNames ( ) : array A numerically indexed list of field names of this persistent class.
getFieldValue ( object $document, string $field ) Gets the specified field's value off the given document.
getIdentifier ( ) : string Gets the mapped identifier field of this class.
getIdentifierFieldNames ( ) : array Get identifier field names of this class.;
getIdentifierValue ( object $document ) : string Gets the document identifier.
getIdentifierValues ( object $document ) : array Get identifier values of this document.
getName ( ) : string The name of this Document class.
getNamespace ( ) : string The namespace this Document class belongs to.
getReflectionClass ( ) : ReflectionClas\ReflectionClass Gets the ReflectionClass instance of the mapped class.
getReflectionProperties ( ) : array Gets the ReflectionPropertys of the mapped class.
getReflectionProperty ( string $name ) : ReflectionPropert\ReflectionProperty Gets a ReflectionProperty for a specific field of the mapped class.
getTypeOfField ( string $fieldName ) : Type Gets the type of a field.
hasAssociation ( string $fieldName ) : boolean Checks if the given field is a mapped association for this class.
hasField ( $fieldName ) : boolean Checks whether the class has a (mapped) field with a certain name.
initializeReflection ( Doctrine\Common\Persistence\Mapping\ReflectionService $reflService ) : void Initializes a new ClassMetadata instance that will hold the object-relational mapping metadata of the class with the given name.
isAssociationInverseSide ( $assocName ) {@inheritDoc}
isCollectionValuedAssociation ( $name )
isIdentifier ( string $fieldName ) : boolean Checks whether a field is part of the identifier/primary key field(s).
isInheritedAssociation ( $field )
isInheritedField ( $field )
isSingleValuedAssociation ( string $fieldName ) : boolean Checks if the given field is a mapped single valued association for this class.
mapAttachments ( string $fieldName ) Set the field that will contain attachments of this document.
mapEmbedded ( array $mapping ) Map an embedded object
mapField ( array $mapping ) Map a field.
mapManyToMany ( $mapping )
mapManyToOne ( $mapping )
markInheritanceRoot ( )
newInstance ( ) : object Creates a new instance of the mapped class, without invoking the constructor.
setCustomRepositoryClass ( string $repositoryClassName ) Registers a custom repository class for the document class.
setFieldValue ( object $document, string $field, mixed $value ) Sets the specified field to the specified value on the given document.
setIdentifier ( string $identifier ) INTERNAL: Sets the mapped identifier field of this class.
setIdentifierValue ( object $document, mixed $id ) Sets the document identifier of a document.
setParentClasses ( $classes )
wakeupReflection ( $reflService ) Restores some state that can not be serialized/unserialized.

Méthodes protégées

Méthode Description
validateAndCompleteAssociationMapping ( $mapping )
validateAndCompleteFieldMapping ( $mapping )
validateAndCompleteReferenceMapping ( $mapping )

Private Methods

Méthode Description
checkAndStoreIndexMapping ( $mapping )
storeAssociationMapping ( $mapping )

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.

__sleep() public méthode

It is only serialized what is necessary for best unserialization performance. That means any metadata properties that are not set or empty or simply have their default value are NOT serialized. Parts that are also NOT serialized because they can not be properly unserialized: - reflClass (ReflectionClass) - reflFields (ReflectionProperty array)
public __sleep ( ) : array
Résultat array The names of all the fields that should be serialized.

deriveChildMetadata() public méthode

Used to derive a class metadata of the current instance for a mapped child class.
public deriveChildMetadata ( ClassMetadata $child )
$child ClassMetadata

getAssociationMappedByTargetField() public méthode

{@inheritDoc}
public getAssociationMappedByTargetField ( $assocName )

getAssociationNames() public méthode

This array includes identifier associations if present on this class.
public getAssociationNames ( ) : array
Résultat array

getAssociationTargetClass() public méthode

Returns the target class name of the given association.
public getAssociationTargetClass ( string $assocName ) : string
$assocName string
Résultat string

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.

getFieldNames() public méthode

This array includes identifier fields if present on this class.
public getFieldNames ( ) : array
Résultat array

getFieldValue() public méthode

Gets the specified field's value off the given document.
public getFieldValue ( object $document, string $field )
$document object
$field string

getIdentifier() public méthode

Gets the mapped identifier field of this class.
public getIdentifier ( ) : string
Résultat string $identifier

getIdentifierFieldNames() public méthode

Since CouchDB only allows exactly one identifier field this is a proxy to {@see \getIdentifier()} and returns an array.
public getIdentifierFieldNames ( ) : array
Résultat array

getIdentifierValue() public méthode

Gets the document identifier.
public getIdentifierValue ( object $document ) : string
$document object
Résultat string $id

getIdentifierValues() public méthode

Since CouchDB 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 $document ) : array
$document object
Résultat array

getName() public méthode

The name of this Document class.
public getName ( ) : string
Résultat string $name The Document class name.

getNamespace() public méthode

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

getReflectionClass() public méthode

Gets the ReflectionClass instance of the mapped class.
public getReflectionClass ( ) : ReflectionClas\ReflectionClass
Résultat ReflectionClas\ReflectionClass

getReflectionProperties() public méthode

Gets the ReflectionPropertys 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 ) : ReflectionPropert\ReflectionProperty
$name string
Résultat ReflectionPropert\ReflectionProperty

getTypeOfField() public méthode

Gets the type of a field.
public getTypeOfField ( string $fieldName ) : Type
$fieldName string
Résultat Type

hasAssociation() public méthode

Checks if the given field is a mapped association for this class.
public hasAssociation ( string $fieldName ) : boolean
$fieldName string
Résultat boolean

hasField() public méthode

Checks whether the class has a (mapped) field with a certain name.
public hasField ( $fieldName ) : boolean
$fieldName
Résultat boolean

initializeReflection() public méthode

Initializes a new ClassMetadata instance that will hold the object-relational mapping metadata of the class with the given name.
public initializeReflection ( Doctrine\Common\Persistence\Mapping\ReflectionService $reflService ) : void
$reflService Doctrine\Common\Persistence\Mapping\ReflectionService The reflection service.
Résultat void

isAssociationInverseSide() public méthode

{@inheritDoc}
public isAssociationInverseSide ( $assocName )

isCollectionValuedAssociation() public méthode

isIdentifier() public méthode

Checks whether a field is part of the identifier/primary key field(s).
public isIdentifier ( string $fieldName ) : boolean
$fieldName string The field name
Résultat boolean TRUE if the field is part of the table identifier/primary key field(s), FALSE otherwise.

isInheritedAssociation() public méthode

public isInheritedAssociation ( $field )

isInheritedField() public méthode

public isInheritedField ( $field )

isSingleValuedAssociation() public méthode

Checks if the given field is a mapped single valued association for this class.
public isSingleValuedAssociation ( string $fieldName ) : boolean
$fieldName string
Résultat boolean

mapAttachments() public méthode

Set the field that will contain attachments of this document.
public mapAttachments ( string $fieldName )
$fieldName string

mapEmbedded() public méthode

- fieldName - The name of the property/field on the mapped php class - jsonName - JSON key name of this field in CouchDB. - targetDocument - Name of the target document - embedded - one or many embedded objects?
public mapEmbedded ( array $mapping )
$mapping array

mapField() public méthode

- type - The Doctrine Type of this field. - fieldName - The name of the property/field on the mapped php class - jsonName - JSON key name of this field in CouchDB. - name - The JSON key of this field in the CouchDB document - id - True for an ID field. - strategy - ID Generator strategy when the field is an id-field. - indexed - Is this field indexed for the Doctrine CouchDB repository view - isVersionField - Is this field containing the revision number of this document?
public mapField ( array $mapping )
$mapping array The mapping information.

mapManyToMany() public méthode

public mapManyToMany ( $mapping )

mapManyToOne() public méthode

public mapManyToOne ( $mapping )

markInheritanceRoot() public méthode

public markInheritanceRoot ( )

newInstance() public méthode

Creates a new instance of the mapped class, without invoking the constructor.
public newInstance ( ) : object
Résultat object

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

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

setIdentifier() public méthode

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

setIdentifierValue() public méthode

Sets the document identifier of a document.
public setIdentifierValue ( object $document, mixed $id )
$document object
$id mixed

setParentClasses() public méthode

public setParentClasses ( $classes )

validateAndCompleteAssociationMapping() protected méthode

protected validateAndCompleteAssociationMapping ( $mapping )

validateAndCompleteFieldMapping() protected méthode

protected validateAndCompleteFieldMapping ( $mapping )

validateAndCompleteReferenceMapping() protected méthode

protected validateAndCompleteReferenceMapping ( $mapping )

wakeupReflection() public méthode

Restores some state that can not be serialized/unserialized.
public wakeupReflection ( $reflService )

Property Details

$alsoLoadMethods public_oe property

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

$associationsMappings public_oe property

READ-ONLY
public array $associationsMappings
Résultat array

$attachmentDeclaredClass public_oe property

If in an inheritance scenario the attachment field is on a super class, this is its name.
public string|null $attachmentDeclaredClass
Résultat string | null

$attachmentField public_oe property

Field that stores the attachments as a key->value array of file-names to attachment objects.
public string $attachmentField
Résultat string

$customRepositoryClassName public_oe property

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

$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

$hasAttachments public_oe property

public bool $hasAttachments
Résultat boolean

$idGenerator public_oe property

public $idGenerator

$identifier public_oe property

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

$inInheritanceHierachy public_oe property

READ-ONLY: Is this entity in an inheritance hierachy?
public $inInheritanceHierachy

$indexed public_oe property

Is this class indexed? If yes, then a findAll() query can be executed for this type.
public bool $indexed
Résultat boolean

$indexes public_oe property

An array of indexed fields, accessible through a generic view shipped with Doctrine.
public array $indexes
Résultat array

$isEmbeddedDocument public_oe property

READ-ONLY: Whether this class describes the mapping of a embedded document.
public bool $isEmbeddedDocument
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

$isReadOnly public_oe property

This should be set to true for value objects, for example attachments. Replacing the reference with a new value object will trigger an update.
public bool $isReadOnly
Résultat boolean

$isVersioned public_oe property

CouchDB documents are always versioned, this flag determines if this version is exposed to the userland.
public bool $isVersioned
Résultat boolean

$jsonNames public_oe property

An array of json result-key-names to field-names
public array $jsonNames
Résultat array

$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: a list of all parent classes.
public $parentClasses

$reflClass public_oe property

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

$reflFields public_oe property

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

$rootDocumentName public_oe property

READ-ONLY: The root document class name.
public $rootDocumentName

$versionField public_oe property

Version Field stores the CouchDB Revision
public string $versionField
Résultat string