PHP Класс Doctrine\ODM\CouchDB\Mapping\ClassMetadata

С версии: 1.0
Автор: Benjamin Eberlei ([email protected])
Автор: Lukas Kahwe Smith ([email protected])
Наследование: extends Doctrine\ODM\CouchDB\Mapping\ClassMetadataInfo, implements Doctrine\Common\Persistence\Mapping\ClassMetadata
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
validateAndCompleteAssociationMapping ( $mapping )
validateAndCompleteFieldMapping ( $mapping )
validateAndCompleteReferenceMapping ( $mapping )

Приватные методы

Метод Описание
checkAndStoreIndexMapping ( $mapping )
storeAssociationMapping ( $mapping )

Описание методов

__construct() публичный Метод

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() публичный Метод

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
Результат array The names of all the fields that should be serialized.

deriveChildMetadata() публичный Метод

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

getAssociationMappedByTargetField() публичный Метод

{@inheritDoc}
public getAssociationMappedByTargetField ( $assocName )

getAssociationNames() публичный Метод

This array includes identifier associations if present on this class.
public getAssociationNames ( ) : array
Результат array

getAssociationTargetClass() публичный Метод

Returns the target class name of the given association.
public getAssociationTargetClass ( string $assocName ) : string
$assocName string
Результат string

getFieldMapping() публичный Метод

Gets the mapping of a field.
public getFieldMapping ( string $fieldName ) : array
$fieldName string The field name.
Результат array The field mapping.

getFieldNames() публичный Метод

This array includes identifier fields if present on this class.
public getFieldNames ( ) : array
Результат array

getFieldValue() публичный Метод

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

getIdentifier() публичный Метод

Gets the mapped identifier field of this class.
public getIdentifier ( ) : string
Результат string $identifier

getIdentifierFieldNames() публичный Метод

Since CouchDB only allows exactly one identifier field this is a proxy to {@see \getIdentifier()} and returns an array.
public getIdentifierFieldNames ( ) : array
Результат array

getIdentifierValue() публичный Метод

Gets the document identifier.
public getIdentifierValue ( object $document ) : string
$document object
Результат string $id

getIdentifierValues() публичный Метод

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
Результат array

getName() публичный Метод

The name of this Document class.
public getName ( ) : string
Результат string $name The Document class name.

getNamespace() публичный Метод

The namespace this Document class belongs to.
public getNamespace ( ) : string
Результат string $namespace The namespace name.

getReflectionClass() публичный Метод

Gets the ReflectionClass instance of the mapped class.
public getReflectionClass ( ) : ReflectionClas\ReflectionClass
Результат ReflectionClas\ReflectionClass

getReflectionProperties() публичный Метод

Gets the ReflectionPropertys of the mapped class.
public getReflectionProperties ( ) : array
Результат array An array of ReflectionProperty instances.

getReflectionProperty() публичный Метод

Gets a ReflectionProperty for a specific field of the mapped class.
public getReflectionProperty ( string $name ) : ReflectionPropert\ReflectionProperty
$name string
Результат ReflectionPropert\ReflectionProperty

getTypeOfField() публичный Метод

Gets the type of a field.
public getTypeOfField ( string $fieldName ) : Type
$fieldName string
Результат Type

hasAssociation() публичный Метод

Checks if the given field is a mapped association for this class.
public hasAssociation ( string $fieldName ) : boolean
$fieldName string
Результат boolean

hasField() публичный Метод

Checks whether the class has a (mapped) field with a certain name.
public hasField ( $fieldName ) : boolean
$fieldName
Результат boolean

initializeReflection() публичный Метод

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.
Результат void

isAssociationInverseSide() публичный Метод

{@inheritDoc}
public isAssociationInverseSide ( $assocName )

isCollectionValuedAssociation() публичный Метод

isIdentifier() публичный Метод

Checks whether a field is part of the identifier/primary key field(s).
public isIdentifier ( string $fieldName ) : boolean
$fieldName string The field name
Результат boolean TRUE if the field is part of the table identifier/primary key field(s), FALSE otherwise.

isInheritedAssociation() публичный Метод

public isInheritedAssociation ( $field )

isInheritedField() публичный Метод

public isInheritedField ( $field )

isSingleValuedAssociation() публичный Метод

Checks if the given field is a mapped single valued association for this class.
public isSingleValuedAssociation ( string $fieldName ) : boolean
$fieldName string
Результат boolean

mapAttachments() публичный Метод

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

mapEmbedded() публичный Метод

- 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() публичный Метод

- 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 mapManyToMany ( $mapping )

mapManyToOne() публичный Метод

public mapManyToOne ( $mapping )

markInheritanceRoot() публичный Метод

public markInheritanceRoot ( )

newInstance() публичный Метод

Creates a new instance of the mapped class, without invoking the constructor.
public newInstance ( ) : object
Результат object

setCustomRepositoryClass() публичный Метод

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

setFieldValue() публичный Метод

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() публичный Метод

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

setIdentifierValue() публичный Метод

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

setParentClasses() публичный Метод

public setParentClasses ( $classes )

validateAndCompleteAssociationMapping() защищенный Метод

protected validateAndCompleteAssociationMapping ( $mapping )

validateAndCompleteFieldMapping() защищенный Метод

protected validateAndCompleteFieldMapping ( $mapping )

validateAndCompleteReferenceMapping() защищенный Метод

protected validateAndCompleteReferenceMapping ( $mapping )

wakeupReflection() публичный Метод

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

Описание свойств

$alsoLoadMethods публичное свойство

READ-ONLY: Array of fields to also load with a given method.
public array $alsoLoadMethods
Результат array

$associationsMappings публичное свойство

READ-ONLY
public array $associationsMappings
Результат array

$attachmentDeclaredClass публичное свойство

If in an inheritance scenario the attachment field is on a super class, this is its name.
public string|null $attachmentDeclaredClass
Результат string | null

$attachmentField публичное свойство

Field that stores the attachments as a key->value array of file-names to attachment objects.
public string $attachmentField
Результат string

$customRepositoryClassName публичное свойство

(Optional).
public string $customRepositoryClassName
Результат string

$fieldMappings публичное свойство

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
Результат array

$hasAttachments публичное свойство

public bool $hasAttachments
Результат boolean

$idGenerator публичное свойство

public $idGenerator

$identifier публичное свойство

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

$inInheritanceHierachy публичное свойство

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

$indexed публичное свойство

Is this class indexed? If yes, then a findAll() query can be executed for this type.
public bool $indexed
Результат boolean

$indexes публичное свойство

An array of indexed fields, accessible through a generic view shipped with Doctrine.
public array $indexes
Результат array

$isEmbeddedDocument публичное свойство

READ-ONLY: Whether this class describes the mapping of a embedded document.
public bool $isEmbeddedDocument
Результат boolean

$isMappedSuperclass публичное свойство

READ-ONLY: Whether this class describes the mapping of a mapped superclass.
public bool $isMappedSuperclass
Результат boolean

$isReadOnly публичное свойство

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
Результат boolean

$isVersioned публичное свойство

CouchDB documents are always versioned, this flag determines if this version is exposed to the userland.
public bool $isVersioned
Результат boolean

$jsonNames публичное свойство

An array of json result-key-names to field-names
public array $jsonNames
Результат array

$name публичное свойство

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

$namespace публичное свойство

READ-ONLY: The namespace the document class is contained in.
public string $namespace
Результат string

$parentClasses публичное свойство

READ-ONLY: a list of all parent classes.
public $parentClasses

$reflClass публичное свойство

The ReflectionClass instance of the mapped class.
public ReflectionClass,ReflectionClas $reflClass
Результат ReflectionClas\ReflectionClass

$reflFields публичное свойство

The ReflectionProperty instances of the mapped class.
public array $reflFields
Результат array

$rootDocumentName публичное свойство

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

$versionField публичное свойство

Version Field stores the CouchDB Revision
public string $versionField
Результат string