PHP Класс MongoDBRef

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$idKey
$refKey

Открытые методы

Метод Описание
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.

Описание методов

create() публичный статический Метод

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
Результат array Returns the reference

get() публичный статический Метод

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
Результат array | null Returns the document to which the reference refers or null if the document does not exist (the reference is broken)

isRef() публичный статический Метод

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
Результат boolean Returns true if $ref is a reference

Описание свойств

$idKey защищенное статическое свойство

protected static $idKey

$refKey защищенное статическое свойство

protected static $refKey