PHP 트레잇 Mongolid\Model\Relations

파일 보기 프로젝트 열기: leroy-merlin-br/mongolid

공개 메소드들

메소드 설명
attach ( string $field, mixed &$obj ) : void Attach document _id reference to an attribute. It will also generate an _id for the document if it's not present.
detach ( string $field, mixed &$obj ) : void Removes a document _id reference from an attribute. It will remove the _id of the given $obj from inside the given $field.
embed ( string $field, mixed &$obj ) : void Embed a new document to an attribute. It will also generate an _id for the document if it's not present.
unembed ( string $field, mixed &$obj ) : void Removes an embedded document from the given field. It does that by using the _id of the given $obj.

보호된 메소드들

메소드 설명
embedsMany ( string $entity, string $field ) : EmbeddedCursor Return array of embedded documents as objects.
embedsOne ( string $entity, string $field ) : Model | null Return a embedded documents as object.
referencesMany ( string $entity, string $field ) : array Returns the cursor for the referenced documents as objects.
referencesOne ( string $entity, string $field ) : mixed Returns the referenced documents as objects.

메소드 상세

attach() 공개 메소드

Attach document _id reference to an attribute. It will also generate an _id for the document if it's not present.
public attach ( string $field, mixed &$obj ) : void
$field string Name of the field where the reference will be stored.
$obj mixed Document, model instance or _id to be referenced.
리턴 void

detach() 공개 메소드

Removes a document _id reference from an attribute. It will remove the _id of the given $obj from inside the given $field.
public detach ( string $field, mixed &$obj ) : void
$field string Field where the reference is stored.
$obj mixed Document, model instance or _id that have been referenced by $field.
리턴 void

embed() 공개 메소드

Embed a new document to an attribute. It will also generate an _id for the document if it's not present.
public embed ( string $field, mixed &$obj ) : void
$field string Field to where the $obj will be embedded.
$obj mixed Document or model instance.
리턴 void

embedsMany() 보호된 메소드

Return array of embedded documents as objects.
protected embedsMany ( string $entity, string $field ) : EmbeddedCursor
$entity string Class of the entity or of the schema of the entity.
$field string Field where the embedded documents are stored.
리턴 Mongolid\Cursor\EmbeddedCursor Array with the embedded documents

embedsOne() 보호된 메소드

Return a embedded documents as object.
protected embedsOne ( string $entity, string $field ) : Model | null
$entity string Class of the entity or of the schema of the entity.
$field string Field where the embedded document is stored.
리턴 Model | null

referencesMany() 보호된 메소드

Returns the cursor for the referenced documents as objects.
protected referencesMany ( string $entity, string $field ) : array
$entity string Class of the entity or of the schema of the entity.
$field string The field where the _ids are stored.
리턴 array

referencesOne() 보호된 메소드

Returns the referenced documents as objects.
protected referencesOne ( string $entity, string $field ) : mixed
$entity string Class of the entity or of the schema of the entity.
$field string The field where the _id is stored.
리턴 mixed

unembed() 공개 메소드

Removes an embedded document from the given field. It does that by using the _id of the given $obj.
public unembed ( string $field, mixed &$obj ) : void
$field string Name of the field where the $obj is embeded.
$obj mixed Document, model instance or _id.
리턴 void