PHP Class Bolt\Storage\Mapping\MetadataDriver

Author: Ross Riley ([email protected])
Inheritance: implements Doctrine\Common\Persistence\Mapping\Driver\MappingDriver
显示文件 Open project: bolt/bolt Class Usage Examples

Protected Properties

Property Type Description
$aliases array
$contenttypes array
$defaultAliases array
$fallbackEntity A default entity for any table not matched
$initialized boolean
$metadata metadata mappings
$namingStrategy Bolt\Storage\NamingStrategy
$schemaManager Bolt\Storage\Database\Schema\Manager
$taxonomies taxonomy configuration
$typemap array
$unmapped array Keeps a reference of which metadata is not mapped to a specific entity.

Public Methods

Method Description
__construct ( Manager $schemaManager, ConfigurationValueProxy $contenttypes, ConfigurationValueProxy $taxonomies, array $typemap, Bolt\Storage\NamingStrategy $namingStrategy = null ) Constructor.
getAliases ( ) : array Getter for aliases
getAllClassNames ( )
getClassMetadata ( string $className ) : Doctrine\Common\Persistence\Mapping\ClassMetadata | false Returns the metadata for a given class name.
getContentTypeFromAlias ( $alias, boolean $forceSlug = false ) : string Given a tablename or slug get the correct Bolt keyname from the config
getFieldMetadata ( $contenttype, $column, $field = null )
getFieldTypeFor ( string $name, Doctrine\DBAL\Schema\Column $column, null $field = null ) : string Get the field type for a given column.
getRepeaterMapping ( array $config ) : array This is a helper method to get a correct mapping from an array config. It's designed to take raw array config to generate a correct format mapping for repeaters.
getTaxonomyConfig ( ) : array
getUnmapped ( ) : array Gets a list of tables that are not mapped to specific entities.
initialize ( ) Reads the schema from Bolt\Storage\Database\Schema\Manager and creates mapping data
initializeDefaultAliases ( ) This seeds the defaultAliases array with the correctly prefixed mappings
initializeShortAliases ( ) Setup some short aliases so non prefixed keys can be used to get metadata
isTransient ( string $className ) : boolean Not implemented, always returns false.
loadMetadataForClass ( $className, Doctrine\Common\Persistence\Mapping\ClassMetadata $metadata = null )
loadMetadataForFields ( array $fields )
resolveClassName ( string $alias ) : string Method will try to find an entity class name to handle data, alternatively falling back to $this->fallbackEntity
setContentFields ( $contentKey, $className, $table )
setDefaultAlias ( string $alias, string $entity ) : void Adds an alias mapping from an internal name to a Fully Qualified Entity.
setIncomingRelations ( $contentKey, $className )
setRelations ( string $contentKey, string $className, Doctrine\DBAL\Schema\Table $table ) Set the relationship.
setRepeaters ( string $contentKey, string $className, array $inputData = null ) : array | null
setTaxonomies ( string $contentKey, string $className, Doctrine\DBAL\Schema\Table $table ) Set the taxonomy.
setTemplatefields ( string $contentKey, string $className, Doctrine\DBAL\Schema\Table $table ) Setup a templatefields field if needed.

Protected Methods

Method Description
loadMetadataForTable ( Doctrine\DBAL\Schema\Table $table ) Load the metadata for a table.
normalizeClassName ( $className ) : string Performs basic normalisation on a searched for class name to make sure it conforms to lookup format.

Method Details

__construct() public method

Constructor.
public __construct ( Manager $schemaManager, ConfigurationValueProxy $contenttypes, ConfigurationValueProxy $taxonomies, array $typemap, Bolt\Storage\NamingStrategy $namingStrategy = null )
$schemaManager Bolt\Storage\Database\Schema\Manager
$contenttypes Bolt\Configuration\ConfigurationValueProxy
$taxonomies Bolt\Configuration\ConfigurationValueProxy
$typemap array
$namingStrategy Bolt\Storage\NamingStrategy

getAliases() public method

Getter for aliases
public getAliases ( ) : array
return array

getAllClassNames() public method

public getAllClassNames ( )

getClassMetadata() public method

Returns the metadata for a given class name.
public getClassMetadata ( string $className ) : Doctrine\Common\Persistence\Mapping\ClassMetadata | false
$className string
return Doctrine\Common\Persistence\Mapping\ClassMetadata | false The class metadata.

getContentTypeFromAlias() public method

Given a tablename or slug get the correct Bolt keyname from the config
public getContentTypeFromAlias ( $alias, boolean $forceSlug = false ) : string
$alias
$forceSlug boolean
return string $key

getFieldMetadata() public method

public getFieldMetadata ( $contenttype, $column, $field = null )

getFieldTypeFor() public method

Get the field type for a given column.
public getFieldTypeFor ( string $name, Doctrine\DBAL\Schema\Column $column, null $field = null ) : string
$name string
$column Doctrine\DBAL\Schema\Column
$field null Optional field value for repeaters/array based columns
return string

getRepeaterMapping() public method

This is a helper method to get a correct mapping from an array config. It's designed to take raw array config to generate a correct format mapping for repeaters.
public getRepeaterMapping ( array $config ) : array
$config array
return array

getTaxonomyConfig() public method

public getTaxonomyConfig ( ) : array
return array

getUnmapped() public method

Gets a list of tables that are not mapped to specific entities.
public getUnmapped ( ) : array
return array

initialize() public method

Reads the schema from Bolt\Storage\Database\Schema\Manager and creates mapping data
public initialize ( )

initializeDefaultAliases() public method

This seeds the defaultAliases array with the correctly prefixed mappings

initializeShortAliases() public method

Setup some short aliases so non prefixed keys can be used to get metadata

isTransient() public method

Not implemented, always returns false.
public isTransient ( string $className ) : boolean
$className string
return boolean

loadMetadataForClass() public method

public loadMetadataForClass ( $className, Doctrine\Common\Persistence\Mapping\ClassMetadata $metadata = null )
$metadata Doctrine\Common\Persistence\Mapping\ClassMetadata

loadMetadataForFields() public method

public loadMetadataForFields ( array $fields )
$fields array

loadMetadataForTable() protected method

Load the metadata for a table.
protected loadMetadataForTable ( Doctrine\DBAL\Schema\Table $table )
$table Doctrine\DBAL\Schema\Table

normalizeClassName() protected method

Performs basic normalisation on a searched for class name to make sure it conforms to lookup format.
protected normalizeClassName ( $className ) : string
$className
return string

resolveClassName() public method

Method will try to find an entity class name to handle data, alternatively falling back to $this->fallbackEntity
public resolveClassName ( string $alias ) : string
$alias string
return string Fully Qualified Class Name

setContentFields() public method

public setContentFields ( $contentKey, $className, $table )

setDefaultAlias() public method

Adds an alias mapping from an internal name to a Fully Qualified Entity.
public setDefaultAlias ( string $alias, string $entity ) : void
$alias string
$entity string
return void

setIncomingRelations() public method

public setIncomingRelations ( $contentKey, $className )
$contentKey
$className

setRelations() public method

Set the relationship.
public setRelations ( string $contentKey, string $className, Doctrine\DBAL\Schema\Table $table )
$contentKey string
$className string
$table Doctrine\DBAL\Schema\Table

setRepeaters() public method

public setRepeaters ( string $contentKey, string $className, array $inputData = null ) : array | null
$contentKey string
$className string
$inputData array
return array | null

setTaxonomies() public method

Set the taxonomy.
public setTaxonomies ( string $contentKey, string $className, Doctrine\DBAL\Schema\Table $table )
$contentKey string
$className string
$table Doctrine\DBAL\Schema\Table

setTemplatefields() public method

Setup a templatefields field if needed.
public setTemplatefields ( string $contentKey, string $className, Doctrine\DBAL\Schema\Table $table )
$contentKey string
$className string
$table Doctrine\DBAL\Schema\Table

Property Details

$aliases protected_oe property

protected array $aliases
return array

$contenttypes protected_oe property

protected array $contenttypes
return array

$defaultAliases protected_oe property

protected array $defaultAliases
return array

$fallbackEntity protected_oe property

A default entity for any table not matched
protected $fallbackEntity

$initialized protected_oe property

protected bool $initialized
return boolean

$metadata protected_oe property

metadata mappings
protected $metadata

$namingStrategy protected_oe property

protected NamingStrategy,Bolt\Storage $namingStrategy
return Bolt\Storage\NamingStrategy

$schemaManager protected_oe property

protected Manager,Bolt\Storage\Database\Schema $schemaManager
return Bolt\Storage\Database\Schema\Manager

$taxonomies protected_oe property

taxonomy configuration
protected $taxonomies

$typemap protected_oe property

protected array $typemap
return array

$unmapped protected_oe property

Keeps a reference of which metadata is not mapped to a specific entity.
protected array $unmapped
return array