idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
12,400 | public function prepareAssociatedDocumentValue ( array $ mapping , $ document , $ includeNestedCollections = false ) { if ( isset ( $ mapping [ 'embedded' ] ) ) { return $ this -> prepareEmbeddedDocumentValue ( $ mapping , $ document , $ includeNestedCollections ) ; } if ( isset ( $ mapping [ 'reference' ] ) ) { return... | Returns the embedded document or reference representation to be stored . |
12,401 | protected function validateIdentifier ( ClassMetadata $ class ) : void { if ( ! $ class -> identifier && ! $ class -> isMappedSuperclass && ! $ class -> isEmbeddedDocument && ! $ class -> isQueryResultDocument ) { throw MappingException :: identifierRequired ( $ class -> name ) ; } } | Validates the identifier mapping . |
12,402 | private function setInheritedShardKey ( ClassMetadata $ subClass , ClassMetadata $ parentClass ) : void { if ( ! $ parentClass -> isSharded ( ) ) { return ; } $ subClass -> setShardKey ( $ parentClass -> shardKey [ 'keys' ] , $ parentClass -> shardKey [ 'options' ] ) ; } | Adds inherited shard key to the subclass mapping . |
12,403 | public function update ( object $ parent , array $ collections , array $ options ) : void { $ setStrategyColls = [ ] ; $ addPushStrategyColls = [ ] ; foreach ( $ collections as $ coll ) { $ mapping = $ coll -> getMapping ( ) ; if ( $ mapping [ 'isInverseSide' ] ) { continue ; } switch ( $ mapping [ 'strategy' ] ) { cas... | Updates a list PersistentCollection instances deleting removed rows and inserting new rows . |
12,404 | private function setCollections ( object $ parent , array $ collections , array $ options ) : void { $ pathCollMap = [ ] ; $ paths = [ ] ; foreach ( $ collections as $ coll ) { [ $ propertyPath ] = $ this -> getPathAndParent ( $ coll ) ; $ pathCollMap [ $ propertyPath ] = $ coll ; $ paths [ ] = $ propertyPath ; } $ pat... | Sets a list of PersistentCollection instances . |
12,405 | private function deleteElements ( object $ parent , array $ collections , array $ options ) : void { $ pathCollMap = [ ] ; $ paths = [ ] ; $ deleteDiffMap = [ ] ; foreach ( $ collections as $ coll ) { $ coll -> initialize ( ) ; if ( ! $ this -> uow -> isCollectionScheduledForUpdate ( $ coll ) ) { continue ; } $ deleteD... | Deletes removed elements from a list of PersistentCollection instances . |
12,406 | private function insertElements ( object $ parent , array $ collections , array $ options ) : void { $ pushAllPathCollMap = [ ] ; $ addToSetPathCollMap = [ ] ; $ pushAllPaths = [ ] ; $ addToSetPaths = [ ] ; $ diffsMap = [ ] ; foreach ( $ collections as $ coll ) { $ coll -> initialize ( ) ; if ( ! $ this -> uow -> isCol... | Inserts new elements for a PersistentCollection instances . |
12,407 | private function pushAllCollections ( object $ parent , array $ collsPaths , array $ pathCollsMap , array $ diffsMap , array $ options ) : void { $ pushAllPaths = $ this -> excludeSubPaths ( $ collsPaths ) ; $ pushAllColls = array_intersect_key ( $ pathCollsMap , array_flip ( $ pushAllPaths ) ) ; $ pushAllPayload = [ ]... | Perform collections update for pushAll strategy . |
12,408 | private function addToSetCollections ( object $ parent , array $ collsPaths , array $ pathCollsMap , array $ diffsMap , array $ options ) : void { $ addToSetPaths = $ this -> excludeSubPaths ( $ collsPaths ) ; $ addToSetColls = array_intersect_key ( $ pathCollsMap , array_flip ( $ addToSetPaths ) ) ; $ addToSetPayload ... | Perform collections update by addToSet strategy . |
12,409 | private function getValuePrepareCallback ( PersistentCollectionInterface $ coll ) : Closure { $ mapping = $ coll -> getMapping ( ) ; if ( isset ( $ mapping [ 'embedded' ] ) ) { return function ( $ v ) use ( $ mapping ) { return $ this -> pb -> prepareEmbeddedDocumentValue ( $ mapping , $ v ) ; } ; } return function ( $... | Return callback instance for specified collection . This callback will prepare values for query from documents that collection contain . |
12,410 | private function excludeSubPaths ( array $ paths ) : array { if ( empty ( $ paths ) ) { return $ paths ; } sort ( $ paths ) ; $ uniquePaths = [ $ paths [ 0 ] ] ; for ( $ i = 1 , $ count = count ( $ paths ) ; $ i < $ count ; ++ $ i ) { $ lastUniquePath = end ( $ uniquePaths ) ; assert ( $ lastUniquePath !== false ) ; if... | Remove from passed paths list all sub - paths . |
12,411 | public function near ( $ x , $ y = null ) : self { if ( $ x instanceof Point ) { $ x = $ x -> jsonSerialize ( ) ; } $ this -> near = is_array ( $ x ) ? $ x : [ $ x , $ y ] ; $ this -> spherical = is_array ( $ x ) && isset ( $ x [ 'type' ] ) ; return $ this ; } | The point for which to find the closest documents . |
12,412 | public function getFilter ( string $ name ) : BsonFilter { if ( ! $ this -> isEnabled ( $ name ) ) { throw new InvalidArgumentException ( "Filter '" . $ name . "' is not enabled." ) ; } return $ this -> enabledFilters [ $ name ] ; } | Get an enabled filter from the collection . |
12,413 | public function connectToField ( string $ connectToField ) : self { $ this -> connectToField = $ this -> convertTargetFieldName ( $ connectToField ) ; return $ this ; } | Field name in other documents against which to match the value of the field specified by the connectFromField parameter . |
12,414 | public function concat ( $ expression1 , $ expression2 , ... $ expressions ) : self { $ this -> expr -> concat ( ... func_get_args ( ) ) ; return $ this ; } | Concatenates strings and returns the concatenated string . |
12,415 | public function concatArrays ( $ array1 , $ array2 , ... $ arrays ) : self { $ this -> expr -> concatArrays ( ... func_get_args ( ) ) ; return $ this ; } | Concatenates arrays to return the concatenated array . |
12,416 | public function dateToString ( $ format , $ expression ) : self { $ this -> expr -> dateToString ( $ format , $ expression ) ; return $ this ; } | Converts a date object to a string according to a user - specified format . |
12,417 | public function divide ( $ expression1 , $ expression2 ) : self { $ this -> expr -> divide ( $ expression1 , $ expression2 ) ; return $ this ; } | Divides one number by another and returns the result . The first argument is divided by the second argument . |
12,418 | public function eq ( $ expression1 , $ expression2 ) : self { $ this -> expr -> eq ( $ expression1 , $ expression2 ) ; return $ this ; } | Compares two values and returns whether they are equivalent . |
12,419 | public function in ( $ expression , $ arrayExpression ) : self { $ this -> expr -> in ( $ expression , $ arrayExpression ) ; return $ this ; } | Returns a boolean indicating whether a specified value is in an array . |
12,420 | public function ifNull ( $ expression , $ replacementExpression ) : self { $ this -> expr -> ifNull ( $ expression , $ replacementExpression ) ; return $ this ; } | Evaluates an expression and returns the value of the expression if the expression evaluates to a non - null value . If the expression evaluates to a null value including instances of undefined values or missing fields returns the value of the replacement expression . |
12,421 | public function let ( $ vars , $ in ) : self { $ this -> expr -> let ( $ vars , $ in ) ; return $ this ; } | Binds variables for use in the specified expression and returns the result of the expression . |
12,422 | public function log ( $ number , $ base ) : self { $ this -> expr -> log ( $ number , $ base ) ; return $ this ; } | Calculates the log of a number in the specified base and returns the result as a double . |
12,423 | public function mod ( $ expression1 , $ expression2 ) : self { $ this -> expr -> mod ( $ expression1 , $ expression2 ) ; return $ this ; } | Divides one number by another and returns the remainder . The first argument is divided by the second argument . |
12,424 | public function multiply ( $ expression1 , $ expression2 , ... $ expressions ) : self { $ this -> expr -> multiply ( ... func_get_args ( ) ) ; return $ this ; } | Multiplies numbers together and returns the result . |
12,425 | public function pow ( $ number , $ exponent ) : self { $ this -> expr -> pow ( $ number , $ exponent ) ; return $ this ; } | Raises a number to the specified exponent and returns the result . |
12,426 | public function setDifference ( $ expression1 , $ expression2 ) : self { $ this -> expr -> setDifference ( $ expression1 , $ expression2 ) ; return $ this ; } | Takes two sets and returns an array containing the elements that only exist in the first set . |
12,427 | public function setEquals ( $ expression1 , $ expression2 , ... $ expressions ) : self { $ this -> expr -> setEquals ( ... func_get_args ( ) ) ; return $ this ; } | Compares two or more arrays and returns true if they have the same distinct elements and false otherwise . |
12,428 | public function setIntersection ( $ expression1 , $ expression2 , ... $ expressions ) : self { $ this -> expr -> setIntersection ( ... func_get_args ( ) ) ; return $ this ; } | Takes two or more arrays and returns an array that contains the elements that appear in every input array . |
12,429 | public function setIsSubset ( $ expression1 , $ expression2 ) : self { $ this -> expr -> setIsSubset ( $ expression1 , $ expression2 ) ; return $ this ; } | Takes two arrays and returns true when the first array is a subset of the second including when the first array equals the second array and false otherwise . |
12,430 | public function setUnion ( $ expression1 , $ expression2 , ... $ expressions ) : self { $ this -> expr -> setUnion ( ... func_get_args ( ) ) ; return $ this ; } | Takes two or more arrays and returns an array containing the elements that appear in any input array . |
12,431 | public function split ( $ string , $ delimiter ) : self { $ this -> expr -> split ( $ string , $ delimiter ) ; return $ this ; } | Divides a string into an array of substrings based on a delimiter . |
12,432 | public function subtract ( $ expression1 , $ expression2 ) : self { $ this -> expr -> subtract ( $ expression1 , $ expression2 ) ; return $ this ; } | Subtracts two numbers to return the difference . The second argument is subtracted from the first argument . |
12,433 | public function pipeline ( $ builder ) : self { if ( ! $ this -> field ) { throw new LogicException ( __METHOD__ . ' requires you set a current field using field().' ) ; } if ( $ builder instanceof Stage ) { $ builder = $ builder -> builder ; } if ( ! $ builder instanceof Builder ) { throw new InvalidArgumentException ... | Use the given pipeline for the current field . |
12,434 | public static function getDateTime ( $ value ) : DateTimeInterface { $ datetime = false ; $ exception = null ; if ( $ value instanceof DateTimeInterface ) { return $ value ; } elseif ( $ value instanceof UTCDateTime ) { $ datetime = $ value -> toDateTime ( ) ; $ datetime -> setTimezone ( new DateTimeZone ( date_default... | Converts a value to a DateTime . Supports microseconds |
12,435 | private function doRemove ( $ offset , $ arrayAccess ) { $ this -> initialize ( ) ; if ( $ arrayAccess ) { $ this -> coll -> offsetUnset ( $ offset ) ; $ removed = true ; } else { $ removed = $ this -> coll -> remove ( $ offset ) ; } if ( ! $ removed && ! $ arrayAccess ) { return $ removed ; } $ this -> changed ( ) ; r... | Actual logic for removing element by its key . |
12,436 | private function doSet ( $ offset , $ value , $ arrayAccess ) { $ arrayAccess ? $ this -> coll -> offsetSet ( $ offset , $ value ) : $ this -> coll -> set ( $ offset , $ value ) ; if ( $ this -> uow !== null && $ this -> isOrphanRemovalEnabled ( ) && $ value !== null ) { $ this -> uow -> unscheduleOrphanRemoval ( $ val... | Actual logic for setting an element in the collection . |
12,437 | public function debug ( ? string $ name = null ) { return $ name !== null ? $ this -> query [ $ name ] : $ this -> query ; } | Return an array of information about the query structure for debugging . |
12,438 | private function makeIterator ( Traversable $ cursor ) : Iterator { if ( $ this -> hydrate ) { $ cursor = new HydratingIterator ( $ cursor , $ this -> dm -> getUnitOfWork ( ) , $ this -> class , $ this -> unitOfWorkHints ) ; } $ cursor = new CachingIterator ( $ cursor ) ; if ( ! empty ( $ this -> primers ) ) { $ refere... | Decorate the cursor with caching hydration and priming behavior . |
12,439 | public function find ( $ id , int $ lockMode = LockMode :: NONE , ? int $ lockVersion = null ) : ? object { if ( $ id === null ) { return null ; } if ( is_array ( $ id ) ) { [ $ identifierFieldName ] = $ this -> class -> getIdentifierFieldNames ( ) ; if ( isset ( $ id [ $ identifierFieldName ] ) ) { $ id = $ id [ $ ide... | Finds a document matching the specified identifier . Optionally a lock mode and expected version may be specified . |
12,440 | public function getPersistenceBuilder ( ) : PersistenceBuilder { if ( ! $ this -> persistenceBuilder ) { $ this -> persistenceBuilder = new PersistenceBuilder ( $ this -> dm , $ this ) ; } return $ this -> persistenceBuilder ; } | Factory for returning new PersistenceBuilder instances used for preparing data into queries for insert persistence . |
12,441 | public function getCollectionPersister ( ) : CollectionPersister { if ( ! isset ( $ this -> collectionPersister ) ) { $ pb = $ this -> getPersistenceBuilder ( ) ; $ this -> collectionPersister = new Persisters \ CollectionPersister ( $ this -> dm , $ pb , $ this ) ; } return $ this -> collectionPersister ; } | Get the collection persister instance . |
12,442 | public function setDocumentPersister ( string $ documentName , Persisters \ DocumentPersister $ persister ) : void { $ this -> persisters [ $ documentName ] = $ persister ; } | Set the document persister instance to use for the given document name |
12,443 | private function getClassesForCommitAction ( array $ documents , bool $ includeEmbedded = false ) : array { if ( empty ( $ documents ) ) { return [ ] ; } $ divided = [ ] ; $ embeds = [ ] ; foreach ( $ documents as $ oid => $ d ) { $ className = get_class ( $ d ) ; if ( isset ( $ embeds [ $ className ] ) ) { continue ; ... | Groups a list of scheduled documents by their class . |
12,444 | private function computeScheduleInsertsChangeSets ( ) : void { foreach ( $ this -> documentInsertions as $ document ) { $ class = $ this -> dm -> getClassMetadata ( get_class ( $ document ) ) ; if ( $ class -> isEmbeddedDocument ) { continue ; } $ this -> computeChangeSet ( $ class , $ document ) ; } } | Compute changesets of all documents scheduled for insertion . |
12,445 | private function computeScheduleUpsertsChangeSets ( ) : void { foreach ( $ this -> documentUpserts as $ document ) { $ class = $ this -> dm -> getClassMetadata ( get_class ( $ document ) ) ; if ( $ class -> isEmbeddedDocument ) { continue ; } $ this -> computeChangeSet ( $ class , $ document ) ; } } | Compute changesets of all documents scheduled for upsert . |
12,446 | public function setDocumentChangeSet ( object $ document , array $ changeset ) : void { $ this -> documentChangeSets [ spl_object_hash ( $ document ) ] = $ changeset ; } | Sets the changeset for a document . |
12,447 | public function scheduleForInsert ( ClassMetadata $ class , object $ document ) : void { $ oid = spl_object_hash ( $ document ) ; if ( isset ( $ this -> documentUpdates [ $ oid ] ) ) { throw new InvalidArgumentException ( 'Dirty document can not be scheduled for insertion.' ) ; } if ( isset ( $ this -> documentDeletion... | Schedules a document for insertion into the database . If the document already has an identifier it will be added to the identity map . |
12,448 | public function scheduleForUpsert ( ClassMetadata $ class , object $ document ) : void { $ oid = spl_object_hash ( $ document ) ; if ( $ class -> isEmbeddedDocument ) { throw new InvalidArgumentException ( 'Embedded document can not be scheduled for upsert.' ) ; } if ( isset ( $ this -> documentUpdates [ $ oid ] ) ) { ... | Schedules a document for upsert into the database and adds it to the identity map |
12,449 | public function isScheduledForSynchronization ( object $ document ) : bool { $ class = $ this -> dm -> getClassMetadata ( get_class ( $ document ) ) ; return isset ( $ this -> scheduledForSynchronization [ $ class -> name ] [ spl_object_hash ( $ document ) ] ) ; } | Checks whether a document is registered to be checked in the unit of work . |
12,450 | public function scheduleForDelete ( object $ document ) : void { $ oid = spl_object_hash ( $ document ) ; if ( isset ( $ this -> documentInsertions [ $ oid ] ) ) { if ( $ this -> isInIdentityMap ( $ document ) ) { $ this -> removeFromIdentityMap ( $ document ) ; } unset ( $ this -> documentInsertions [ $ oid ] ) ; retu... | Schedules a document for deletion . |
12,451 | public function isDocumentScheduled ( object $ document ) : bool { $ oid = spl_object_hash ( $ document ) ; return isset ( $ this -> documentInsertions [ $ oid ] ) || isset ( $ this -> documentUpserts [ $ oid ] ) || isset ( $ this -> documentUpdates [ $ oid ] ) || isset ( $ this -> documentDeletions [ $ oid ] ) ; } | Checks whether a document is scheduled for insertion update or deletion . |
12,452 | public function addToIdentityMap ( object $ document ) : bool { $ class = $ this -> dm -> getClassMetadata ( get_class ( $ document ) ) ; $ id = $ this -> getIdForIdentityMap ( $ document ) ; if ( isset ( $ this -> identityMap [ $ class -> name ] [ $ id ] ) ) { return false ; } $ this -> identityMap [ $ class -> name ]... | Registers a document in the identity map . |
12,453 | public function tryGetById ( $ id , ClassMetadata $ class ) { if ( ! $ class -> identifier ) { throw new InvalidArgumentException ( sprintf ( 'Class "%s" does not have an identifier' , $ class -> name ) ) ; } $ serializedId = serialize ( $ class -> getDatabaseIdentifierValue ( $ id ) ) ; return $ this -> identityMap [ ... | Tries to get a document by its identifier hash . If no document is found for the given hash FALSE is returned . |
12,454 | public function containsId ( $ id , string $ rootClassName ) : bool { return isset ( $ this -> identityMap [ $ rootClassName ] [ serialize ( $ id ) ] ) ; } | Checks whether an identifier exists in the identity map . |
12,455 | public function persist ( object $ document ) : void { $ class = $ this -> dm -> getClassMetadata ( get_class ( $ document ) ) ; if ( $ class -> isMappedSuperclass || $ class -> isQueryResultDocument ) { throw MongoDBException :: cannotPersistMappedSuperclass ( $ class -> name ) ; } $ visited = [ ] ; $ this -> doPersis... | Persists a document as part of the current unit of work . |
12,456 | public function unscheduleOrphanRemoval ( object $ document ) : void { $ oid = spl_object_hash ( $ document ) ; unset ( $ this -> orphanRemovals [ $ oid ] ) ; } | Unschedules an embedded or referenced object for removal . |
12,457 | public function scheduleCollectionDeletion ( PersistentCollectionInterface $ coll ) : void { $ oid = spl_object_hash ( $ coll ) ; unset ( $ this -> collectionUpdates [ $ oid ] ) ; if ( isset ( $ this -> collectionDeletions [ $ oid ] ) ) { return ; } $ this -> collectionDeletions [ $ oid ] = $ coll ; $ this -> scheduleC... | Schedules a complete collection for removal when this UnitOfWork commits . |
12,458 | public function unscheduleCollectionDeletion ( PersistentCollectionInterface $ coll ) : void { if ( $ coll -> getOwner ( ) === null ) { return ; } $ oid = spl_object_hash ( $ coll ) ; if ( ! isset ( $ this -> collectionDeletions [ $ oid ] ) ) { return ; } $ topmostOwner = $ this -> getOwningDocument ( $ coll -> getOwne... | Unschedules a collection from being deleted when this UnitOfWork commits . |
12,459 | public function scheduleCollectionUpdate ( PersistentCollectionInterface $ coll ) : void { $ mapping = $ coll -> getMapping ( ) ; if ( CollectionHelper :: usesSet ( $ mapping [ 'strategy' ] ) ) { $ this -> unscheduleCollectionDeletion ( $ coll ) ; } $ oid = spl_object_hash ( $ coll ) ; if ( isset ( $ this -> collection... | Schedules a collection for update when this UnitOfWork commits . |
12,460 | public function unscheduleCollectionUpdate ( PersistentCollectionInterface $ coll ) : void { if ( $ coll -> getOwner ( ) === null ) { return ; } $ oid = spl_object_hash ( $ coll ) ; if ( ! isset ( $ this -> collectionUpdates [ $ oid ] ) ) { return ; } $ topmostOwner = $ this -> getOwningDocument ( $ coll -> getOwner ( ... | Unschedules a collection from being updated when this UnitOfWork commits . |
12,461 | public function setOriginalDocumentProperty ( string $ oid , string $ property , $ value ) : void { $ this -> originalDocumentData [ $ oid ] [ $ property ] = $ value ; } | Sets a property value of the original data array of a document . |
12,462 | public function foreignField ( string $ foreignField ) : self { $ this -> foreignField = $ this -> prepareFieldName ( $ foreignField , $ this -> targetClass ) ; return $ this ; } | Specifies the field from the documents in the from collection . |
12,463 | private static function getReferencePrefix ( string $ storeAs ) : string { if ( ! in_array ( $ storeAs , [ self :: REFERENCE_STORE_AS_REF , self :: REFERENCE_STORE_AS_DB_REF , self :: REFERENCE_STORE_AS_DB_REF_WITH_DB ] ) ) { throw new LogicException ( 'Can only get a reference prefix for DBRef and reference arrays' ) ... | Returns the reference prefix used for a reference |
12,464 | public static function getReferenceFieldName ( string $ storeAs , string $ pathPrefix = '' ) : string { if ( $ storeAs === self :: REFERENCE_STORE_AS_ID ) { return $ pathPrefix ; } return ( $ pathPrefix ? $ pathPrefix . '.' : '' ) . static :: getReferencePrefix ( $ storeAs ) . 'id' ; } | Returns a fully qualified field name for a given reference |
12,465 | public function setDefaultDiscriminatorValue ( ? string $ defaultDiscriminatorValue ) : void { if ( $ this -> isFile ) { throw MappingException :: discriminatorNotAllowedForGridFS ( $ this -> name ) ; } if ( $ defaultDiscriminatorValue === null ) { $ this -> defaultDiscriminatorValue = null ; return ; } if ( ! array_ke... | Sets the default discriminator value to be used for this class Used for SINGLE_TABLE inheritance mapping strategies if the document has no discriminator value |
12,466 | public function addIndex ( array $ keys , array $ options = [ ] ) : void { $ this -> indexes [ ] = [ 'keys' => array_map ( static function ( $ value ) { if ( $ value === 1 || $ value === - 1 ) { return $ value ; } if ( is_string ( $ value ) ) { $ lower = strtolower ( $ value ) ; if ( $ lower === 'asc' ) { return 1 ; } ... | Add a index for this Document . |
12,467 | public function setReadPreference ( ? string $ readPreference , array $ tags ) : void { $ this -> readPreference = $ readPreference ; $ this -> readPreferenceTags = $ tags ; } | Sets the read preference used by this class . |
12,468 | public function setCollection ( $ name ) : void { if ( is_array ( $ name ) ) { if ( ! isset ( $ name [ 'name' ] ) ) { throw new InvalidArgumentException ( 'A name key is required when passing an array to setCollection()' ) ; } $ this -> collectionCapped = $ name [ 'capped' ] ?? false ; $ this -> collectionSize = $ name... | Sets the collection this Document is mapped to . |
12,469 | private function applyStorageStrategy ( array & $ mapping ) : void { if ( ! isset ( $ mapping [ 'type' ] ) || isset ( $ mapping [ 'id' ] ) ) { return ; } switch ( true ) { case $ mapping [ 'type' ] === 'int' : case $ mapping [ 'type' ] === 'float' : $ defaultStrategy = self :: STORAGE_STRATEGY_SET ; $ allowedStrategies... | Validates the storage strategy of a mapping for consistency |
12,470 | public function getPHPIdentifierValue ( $ id ) { $ idType = $ this -> fieldMappings [ $ this -> identifier ] [ 'type' ] ; return Type :: getType ( $ idType ) -> convertToPHPValue ( $ id ) ; } | Casts the identifier to its portable PHP type . |
12,471 | public function getDatabaseIdentifierValue ( $ id ) { $ idType = $ this -> fieldMappings [ $ this -> identifier ] [ 'type' ] ; return Type :: getType ( $ idType ) -> convertToDatabaseValue ( $ id ) ; } | Casts the identifier to its database type . |
12,472 | public function getFieldMappingByDbFieldName ( string $ dbFieldName ) : array { foreach ( $ this -> fieldMappings as $ mapping ) { if ( $ mapping [ 'name' ] === $ dbFieldName ) { return $ mapping ; } } throw MappingException :: mappingNotFoundByDbName ( $ this -> name , $ dbFieldName ) ; } | Gets the field mapping by its DB name . E . g . it returns identifier s mapping when called with _id . |
12,473 | public function isNullable ( string $ fieldName ) : bool { $ mapping = $ this -> getFieldMapping ( $ fieldName ) ; return isset ( $ mapping [ 'nullable' ] ) && $ mapping [ 'nullable' ] === true ; } | Check if the field is not null . |
12,474 | public function getAssociationCollectionClass ( string $ assocName ) : string { if ( ! isset ( $ this -> associationMappings [ $ assocName ] ) ) { throw new InvalidArgumentException ( "Association name expected, '" . $ assocName . "' is not an association." ) ; } if ( ! array_key_exists ( 'collectionClass' , $ this -> ... | Retrieve the collectionClass associated with an association |
12,475 | public function buckets ( int $ buckets ) : Stage \ BucketAuto { assert ( $ this -> bucket instanceof Stage \ BucketAuto ) ; return $ this -> bucket -> buckets ( $ buckets ) ; } | A positive 32 - bit integer that specifies the number of buckets into which input documents are grouped . |
12,476 | public function granularity ( string $ granularity ) : Stage \ BucketAuto { assert ( $ this -> bucket instanceof Stage \ BucketAuto ) ; return $ this -> bucket -> granularity ( $ granularity ) ; } | A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10 . |
12,477 | public function boundaries ( ... $ boundaries ) { assert ( $ this -> bucket instanceof Stage \ Bucket ) ; return $ this -> bucket -> boundaries ( ... $ boundaries ) ; } | An array of values based on the groupBy expression that specify the boundaries for each bucket . |
12,478 | private function isEquivalentIndexKeys ( IndexInfo $ mongoIndex , array $ documentIndex ) : bool { $ mongoIndexKeys = $ mongoIndex [ 'key' ] ; $ documentIndexKeys = $ documentIndex [ 'keys' ] ; if ( isset ( $ mongoIndexKeys [ '_fts' ] ) && $ mongoIndexKeys [ '_fts' ] === 'text' ) { unset ( $ mongoIndexKeys [ '_fts' ] ,... | Determine if the keys for a MongoDB index can be considered equivalent to those for an index in class metadata . |
12,479 | private function indexOptionsAreMissing ( array $ mongoIndexOptions , array $ documentIndexOptions ) : bool { foreach ( self :: ALLOWED_MISSING_INDEX_OPTIONS as $ option ) { unset ( $ mongoIndexOptions [ $ option ] , $ documentIndexOptions [ $ option ] ) ; } return array_diff_key ( $ mongoIndexOptions , $ documentIndex... | Checks if any index options are missing . |
12,480 | private function isEquivalentTextIndexWeights ( IndexInfo $ mongoIndex , array $ documentIndex ) : bool { $ mongoIndexWeights = $ mongoIndex [ 'weights' ] ; $ documentIndexWeights = $ documentIndex [ 'options' ] [ 'weights' ] ?? [ ] ; foreach ( $ documentIndex [ 'keys' ] as $ key => $ type ) { if ( $ type !== 'text' ||... | Determine if the text index weights for a MongoDB index can be considered equivalent to those for an index in class metadata . |
12,481 | public function getDocumentCollection ( string $ className ) : Collection { $ className = $ this -> classNameResolver -> getRealClass ( $ className ) ; $ metadata = $ this -> metadataFactory -> getMetadataFor ( $ className ) ; assert ( $ metadata instanceof ClassMetadata ) ; if ( $ metadata -> isFile ) { return $ this ... | Returns the collection instance for a class . |
12,482 | public function getDocumentBucket ( string $ className ) : Bucket { $ className = $ this -> classNameResolver -> getRealClass ( $ className ) ; $ metadata = $ this -> metadataFactory -> getMetadataFor ( $ className ) ; if ( ! $ metadata -> isFile ) { throw MongoDBException :: documentBucketOnlyAvailableForGridFSFiles (... | Returns the bucket instance for a class . |
12,483 | public function find ( $ documentName , $ identifier , $ lockMode = LockMode :: NONE , $ lockVersion = null ) : ? object { $ repository = $ this -> getRepository ( $ documentName ) ; if ( $ repository instanceof DocumentRepository ) { return $ repository -> find ( $ identifier , $ lockMode , $ lockVersion ) ; } return ... | Finds a Document by its identifier . |
12,484 | public function createReference ( object $ document , array $ referenceMapping ) { $ class = $ this -> getClassMetadata ( get_class ( $ document ) ) ; $ id = $ this -> unitOfWork -> getDocumentIdentifier ( $ document ) ; if ( $ id === null ) { throw new RuntimeException ( sprintf ( 'Cannot create a DBRef for class %s w... | Returns a reference to the supplied document . |
12,485 | private function getDiscriminatorData ( array $ referenceMapping , ClassMetadata $ class ) : array { $ discriminatorField = null ; $ discriminatorValue = null ; $ discriminatorMap = null ; if ( isset ( $ referenceMapping [ 'discriminatorField' ] ) ) { $ discriminatorField = $ referenceMapping [ 'discriminatorField' ] ;... | Build discriminator portion of reference for specified reference mapping and class metadata . |
12,486 | public function expr ( ) : Expr { $ expr = new Expr ( $ this -> dm ) ; $ expr -> setClassMetadata ( $ this -> class ) ; return $ expr ; } | Create a new Expr instance that can be used as an expression with the Builder |
12,487 | public function field ( string $ field ) : self { $ this -> currentField = $ field ; $ this -> expr -> field ( $ field ) ; return $ this ; } | Set the current field to operate on . |
12,488 | public function find ( ? string $ documentName = null ) : self { $ this -> setDocumentName ( $ documentName ) ; $ this -> query [ 'type' ] = Query :: TYPE_FIND ; return $ this ; } | Change the query type to find and optionally set and change the class being queried . |
12,489 | public function selectMeta ( string $ fieldName , string $ metaDataKeyword ) : self { $ this -> query [ 'select' ] [ $ fieldName ] = [ '$meta' => $ metaDataKeyword ] ; return $ this ; } | Select a metadata field for the query projection . |
12,490 | private function getDiscriminatorValues ( $ classNames ) : array { $ discriminatorValues = [ ] ; $ collections = [ ] ; foreach ( $ classNames as $ className ) { $ class = $ this -> dm -> getClassMetadata ( $ className ) ; $ discriminatorValues [ ] = $ class -> discriminatorValue ; $ key = $ this -> dm -> getDocumentDat... | Get Discriminator Values |
12,491 | public function generate ( DocumentManager $ dm , object $ document ) { $ uuid = $ this -> generateV4 ( ) ; return $ this -> generateV5 ( $ uuid , $ this -> salt ? : php_uname ( 'n' ) ) ; } | Generates a new UUID |
12,492 | public function bucket ( ) : Stage \ Bucket { $ stage = new Stage \ Bucket ( $ this , $ this -> dm , $ this -> class ) ; $ this -> addStage ( $ stage ) ; return $ stage ; } | Categorizes incoming documents into groups called buckets based on a specified expression and bucket boundaries . |
12,493 | public function bucketAuto ( ) : Stage \ BucketAuto { $ stage = new Stage \ BucketAuto ( $ this , $ this -> dm , $ this -> class ) ; $ this -> addStage ( $ stage ) ; return $ stage ; } | Categorizes incoming documents into a specific number of groups called buckets based on a specified expression . |
12,494 | public function collStats ( ) : Stage \ CollStats { $ stage = new Stage \ CollStats ( $ this ) ; $ this -> addStage ( $ stage ) ; return $ stage ; } | Returns statistics regarding a collection or view . |
12,495 | public function count ( string $ fieldName ) : Stage \ Count { $ stage = new Stage \ Count ( $ this , $ fieldName ) ; $ this -> addStage ( $ stage ) ; return $ stage ; } | Returns a document that contains a count of the number of documents input to the stage . |
12,496 | public function execute ( array $ options = [ ] ) : Iterator { $ options = array_merge ( $ options , [ 'cursor' => true ] ) ; $ cursor = $ this -> collection -> aggregate ( $ this -> getPipeline ( ) , $ options ) ; assert ( $ cursor instanceof Cursor ) ; return $ this -> prepareIterator ( $ cursor ) ; } | Executes the aggregation pipeline |
12,497 | public function facet ( ) : Stage \ Facet { $ stage = new Stage \ Facet ( $ this ) ; $ this -> addStage ( $ stage ) ; return $ stage ; } | Processes multiple aggregation pipelines within a single stage on the same set of input documents . |
12,498 | public function getPipeline ( ) : array { $ pipeline = array_map ( static function ( Stage $ stage ) { return $ stage -> getExpression ( ) ; } , $ this -> stages ) ; if ( $ this -> getStage ( 0 ) instanceof Stage \ GeoNear ) { $ pipeline [ 0 ] [ '$geoNear' ] [ 'query' ] = $ this -> applyFilters ( $ pipeline [ 0 ] [ '$g... | Returns the assembled aggregation pipeline |
12,499 | public function graphLookup ( string $ from ) : Stage \ GraphLookup { $ stage = new Stage \ GraphLookup ( $ this , $ from , $ this -> dm , $ this -> class ) ; $ this -> addStage ( $ stage ) ; return $ stage ; } | Performs a recursive search on a collection with options for restricting the search by recursion depth and query filter . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.