PHP Class MongoDBRef

Afficher le fichier Open project: alcaeus/mongo-php-adapter Class Usage Examples

Protected Properties

Свойство Type Description
$idKey
$refKey

Méthodes publiques

Méthode Description
create ( string $collection, mixed $id, string $database = null ) : array If no database is given, the current database is used.
get ( MongoDB $db, array $ref ) : array | null Fetches the object pointed to by a reference
isRef ( mixed $ref ) : boolean This not actually follow the reference, so it does not determine if it is broken or not.

Method Details

create() public static méthode

If no database is given, the current database is used.
public static create ( string $collection, mixed $id, string $database = null ) : array
$collection string Collection name (without the database name)
$id mixed The _id field of the object to which to link
$database string Database name
Résultat array Returns the reference

get() public static méthode

Fetches the object pointed to by a reference
public static get ( MongoDB $db, array $ref ) : array | null
$db MongoDB Database to use
$ref array Reference to fetch
Résultat array | null Returns the document to which the reference refers or null if the document does not exist (the reference is broken)

isRef() public static méthode

It merely checks that $ref is in valid database reference format (in that it is an object or array with $ref and $id fields).
public static isRef ( mixed $ref ) : boolean
$ref mixed Array or object to check
Résultat boolean Returns true if $ref is a reference

Property Details

$idKey protected_oe static_oe property

protected static $idKey

$refKey protected_oe static_oe property

protected static $refKey