class SchemaManager (View source)

Properties

protected DocumentManager $dm
protected ClassMetadataFactory $metadataFactory

Methods

ensureIndexes(integer $timeout = null)

Ensure indexes are created for all documents that can be loaded with the metadata factory.

updateIndexes(integer $timeout = null)

Ensure indexes exist for all mapped document classes.

updateDocumentIndexes(string $documentName, integer $timeout = null)

Ensure indexes exist for the mapped document class.

array
getDocumentIndexes(string $documentName)

No description

ensureDocumentIndexes(string $documentName, integer $timeout = null)

Ensure the given document's indexes are created.

deleteIndexes()

Delete indexes for all documents that can be loaded with the metadata factory.

deleteDocumentIndexes(string $documentName)

Delete the given document's indexes.

createCollections()

Create all the mapped document collections in the metadata factory.

createDocumentCollection(string $documentName)

Create the document collection for a mapped class.

dropCollections()

Drop all the mapped document collections in the metadata factory.

dropDocumentCollection(string $documentName)

Drop the document collection for a mapped class.

dropDatabases()

Drop all the mapped document databases in the metadata factory.

dropDocumentDatabase(string $documentName)

Drop the document database for a mapped class.

createDatabases()

Create all the mapped document databases in the metadata factory.

createDocumentDatabase(string $documentName)

Create the document database for a mapped class.

isMongoIndexEquivalentToDocumentIndex($mongoIndex, $documentIndex)

Determine if an index returned by MongoCollection::getIndexInfo() can be considered equivalent to an index in class metadata.

Details

__construct(DocumentManager $dm, ClassMetadataFactory $cmf)

ensureIndexes(integer $timeout = null)

Ensure indexes are created for all documents that can be loaded with the metadata factory.

Parameters

integer $timeout Timeout (ms) for acknowledged index creation

updateIndexes(integer $timeout = null)

Ensure indexes exist for all mapped document classes.

Indexes that exist in MongoDB but not the document metadata will be deleted.

Parameters

integer $timeout Timeout (ms) for acknowledged index creation

updateDocumentIndexes(string $documentName, integer $timeout = null)

Ensure indexes exist for the mapped document class.

Indexes that exist in MongoDB but not the document metadata will be deleted.

Parameters

string $documentName
integer $timeout Timeout (ms) for acknowledged index creation

Exceptions

InvalidArgumentException

array getDocumentIndexes(string $documentName)

Parameters

string $documentName

Return Value

array

ensureDocumentIndexes(string $documentName, integer $timeout = null)

Ensure the given document's indexes are created.

Parameters

string $documentName
integer $timeout Timeout (ms) for acknowledged index creation

Exceptions

InvalidArgumentException

deleteIndexes()

Delete indexes for all documents that can be loaded with the metadata factory.

deleteDocumentIndexes(string $documentName)

Delete the given document's indexes.

Parameters

string $documentName

Exceptions

InvalidArgumentException

createCollections()

Create all the mapped document collections in the metadata factory.

createDocumentCollection(string $documentName)

Create the document collection for a mapped class.

Parameters

string $documentName

Exceptions

InvalidArgumentException

dropCollections()

Drop all the mapped document collections in the metadata factory.

dropDocumentCollection(string $documentName)

Drop the document collection for a mapped class.

Parameters

string $documentName

Exceptions

InvalidArgumentException

dropDatabases()

Drop all the mapped document databases in the metadata factory.

dropDocumentDatabase(string $documentName)

Drop the document database for a mapped class.

Parameters

string $documentName

Exceptions

InvalidArgumentException

createDatabases()

Create all the mapped document databases in the metadata factory.

createDocumentDatabase(string $documentName)

Create the document database for a mapped class.

Parameters

string $documentName

Exceptions

InvalidArgumentException

isMongoIndexEquivalentToDocumentIndex($mongoIndex, $documentIndex)

Determine if an index returned by MongoCollection::getIndexInfo() can be considered equivalent to an index in class metadata.

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)

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.

Parameters

$mongoIndex
$documentIndex