PHP Class Doctrine\ODM\MongoDB\SchemaManager

Mostrar archivo Open project: doctrine/mongodb-odm Class Usage Examples

Protected Properties

Property Type Description
$dm DocumentManager
$metadataFactory Doctrine\ODM\MongoDB\Mapping\ClassMetadataFactory

Public Methods

Method Description
__construct ( DocumentManager $dm, ClassMetadataFactory $cmf )
createCollections ( ) Create all the mapped document collections in the metadata factory.
createDatabases ( ) Create all the mapped document databases in the metadata factory.
createDocumentCollection ( string $documentName ) Create the document collection for a mapped class.
createDocumentDatabase ( string $documentName ) Create the document database for a mapped class.
deleteDocumentIndexes ( string $documentName ) Delete the given document's indexes.
deleteIndexes ( ) Delete indexes for all documents that can be loaded with the metadata factory.
dropCollections ( ) Drop all the mapped document collections in the metadata factory.
dropDatabases ( ) Drop all the mapped document databases in the metadata factory.
dropDocumentCollection ( string $documentName ) Drop the document collection for a mapped class.
dropDocumentDatabase ( string $documentName ) Drop the document database for a mapped class.
enableShardingForDbByDocumentName ( string $documentName ) Enable sharding for database which contains documents with given name.
ensureDocumentIndexes ( string $documentName, integer $timeout = null ) Ensure the given document's indexes are created.
ensureDocumentSharding ( string $documentName, array $indexOptions = [] ) Ensure sharding for collection by document name.
ensureIndexes ( integer $timeout = null ) Ensure indexes are created for all documents that can be loaded with the metadata factory.
ensureSharding ( array $indexOptions = [] ) Ensure collections are sharded for all documents that can be loaded with the metadata factory.
getDocumentIndexes ( string $documentName ) : array
isMongoIndexEquivalentToDocumentIndex ( array $mongoIndex, array $documentIndex ) : boolean Determine if an index returned by MongoCollection::getIndexInfo() can be considered equivalent to an index in class metadata.
updateDocumentIndexes ( string $documentName, integer $timeout = null ) Ensure indexes exist for the mapped document class.
updateIndexes ( integer $timeout = null ) Ensure indexes exist for all mapped document classes.

Private Methods

Method Description
doGetDocumentIndexes ( string $documentName, array &$visited ) : array
prepareIndexes ( ClassMetadata $class ) : array
runShardCollectionCommand ( $documentName ) : array

Method Details

__construct() public method

public __construct ( DocumentManager $dm, ClassMetadataFactory $cmf )
$dm DocumentManager
$cmf Doctrine\ODM\MongoDB\Mapping\ClassMetadataFactory

createCollections() public method

Create all the mapped document collections in the metadata factory.
public createCollections ( )

createDatabases() public method

Create all the mapped document databases in the metadata factory.
Deprecation: Databases are created automatically by MongoDB (>= 3.0). Deprecated since ODM 1.2, to be removed in ODM 2.0.
public createDatabases ( )

createDocumentCollection() public method

Create the document collection for a mapped class.
public createDocumentCollection ( string $documentName )
$documentName string

createDocumentDatabase() public method

Create the document database for a mapped class.
Deprecation: A database is created automatically by MongoDB (>= 3.0). Deprecated since ODM 1.2, to be removed in ODM 2.0.
public createDocumentDatabase ( string $documentName )
$documentName string

deleteDocumentIndexes() public method

Delete the given document's indexes.
public deleteDocumentIndexes ( string $documentName )
$documentName string

deleteIndexes() public method

Delete indexes for all documents that can be loaded with the metadata factory.
public deleteIndexes ( )

dropCollections() public method

Drop all the mapped document collections in the metadata factory.
public dropCollections ( )

dropDatabases() public method

Drop all the mapped document databases in the metadata factory.
public dropDatabases ( )

dropDocumentCollection() public method

Drop the document collection for a mapped class.
public dropDocumentCollection ( string $documentName )
$documentName string

dropDocumentDatabase() public method

Drop the document database for a mapped class.
public dropDocumentDatabase ( string $documentName )
$documentName string

enableShardingForDbByDocumentName() public method

Enable sharding for database which contains documents with given name.
public enableShardingForDbByDocumentName ( string $documentName )
$documentName string

ensureDocumentIndexes() public method

Ensure the given document's indexes are created.
public ensureDocumentIndexes ( string $documentName, integer $timeout = null )
$documentName string
$timeout integer Timeout (ms) for acknowledged index creation

ensureDocumentSharding() public method

Ensure sharding for collection by document name.
public ensureDocumentSharding ( string $documentName, array $indexOptions = [] )
$documentName string
$indexOptions array Options for `ensureIndex` command. It's performed on an existing collections.

ensureIndexes() public method

Ensure indexes are created for all documents that can be loaded with the metadata factory.
public ensureIndexes ( integer $timeout = null )
$timeout integer Timeout (ms) for acknowledged index creation

ensureSharding() public method

Ensure collections are sharded for all documents that can be loaded with the metadata factory.
public ensureSharding ( array $indexOptions = [] )
$indexOptions array Options for `ensureIndex` command. It's performed on an existing collections

getDocumentIndexes() public method

public getDocumentIndexes ( string $documentName ) : array
$documentName string
return array

isMongoIndexEquivalentToDocumentIndex() public method

Indexes are considered different if: (a) Key/direction pairs differ or are not in the same order (b) Sparse or unique options differ (c) Mongo index is unique without dropDups and mapped index is unique with dropDups (d) Geospatial options differ (bits, max, min) (e) The partialFilterExpression differs Regarding (c), the inverse case is not a reason to delete and recreate the index, since dropDups only affects creation of the unique index. Additionally, the background option is only relevant to index creation and is not considered.
public isMongoIndexEquivalentToDocumentIndex ( array $mongoIndex, array $documentIndex ) : boolean
$mongoIndex array Mongo index data.
$documentIndex array Document index data.
return boolean True if the indexes are equivalent, otherwise false.

updateDocumentIndexes() public method

Indexes that exist in MongoDB but not the document metadata will be deleted.
public updateDocumentIndexes ( string $documentName, integer $timeout = null )
$documentName string
$timeout integer Timeout (ms) for acknowledged index creation

updateIndexes() public method

Indexes that exist in MongoDB but not the document metadata will be deleted.
public updateIndexes ( integer $timeout = null )
$timeout integer Timeout (ms) for acknowledged index creation

Property Details

$dm protected_oe property

protected DocumentManager,Doctrine\ODM\MongoDB $dm
return DocumentManager

$metadataFactory protected_oe property

protected ClassMetadataFactory,Doctrine\ODM\MongoDB\Mapping $metadataFactory
return Doctrine\ODM\MongoDB\Mapping\ClassMetadataFactory