PHP 클래스 Mongolid\ActiveRecord

The Mongolid\Schema\Schema that describes the entity will be generated on the go based on the $fields.
상속: implements Mongolid\Model\AttributesAccessInterface, implements Mongolid\Schema\HasSchemaInterface, use trait Mongolid\Model\Attributes, use trait Mongolid\Model\Relations
파일 보기 프로젝트 열기: leroy-merlin-br/mongolid 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$dynamic boolean The $dynamic property tells if the object will accept additional fields that are not specified in the $fields property. This is useful if you does not have a strict document format or if you want to take full advantage of the "schemaless" nature of MongoDB.

보호된 프로퍼티들

프로퍼티 타입 설명
$collection string Name of the collection where this kind of Entity is going to be saved or retrieved from.
$fields string | string[] Describes the Schema fields of the model. Optionally you can set it to the name of a Schema class to be used.
$writeConcern integer

공개 메소드들

메소드 설명
__call ( mixed $method, mixed $parameters ) : mixed Handle dynamic method calls into the model.
all ( ) : Cursor Gets a cursor of this kind of entities from the database.
delete ( ) : boolean Deletes this object in database.
first ( mixed $query = [], array $projection = [], boolean $useCache = false ) : ActiveRecord Gets the first entity of this kind that matches the query.
firstOrFail ( mixed $query = [], array $projection = [], boolean $useCache = false ) : ActiveRecord Gets the first entity of this kind that matches the query. If no document was found, throws ModelNotFoundException.
firstOrNew ( mixed $id ) : ActiveRecord Gets the first entity of this kind that matches the query. If no document was found, a new entity will be returned with the _if field filled.
getCollectionName ( ) : string Getter for the $collection attribute.
getDataMapper ( ) : DataMapper Returns a DataMapper configured with the Schema and collection described in this entity.
getSchema ( ) : Schema
getWriteConcern ( ) : mixed Getter for $writeConcern variable.
insert ( ) : boolean Insert this object into database.
save ( ) : boolean Saves this object into database.
setWriteConcern ( mixed $writeConcern ) : void Setter for $writeConcern variable.
update ( ) : boolean Updates this object in database.
where ( array $query = [], array $projection = [], boolean $useCache = false ) : Cursor Gets a cursor of this kind of entities that matches the query from the database.

보호된 메소드들

메소드 설명
execute ( string $action ) : boolean Performs the given action into database.
instantiateSchemaInFields ( ) : Schema | null Will check if the current value of $fields property is the name of a Schema class and instantiate it if possible.

비공개 메소드들

메소드 설명
getDataMapperInstance ( ) : mixed Returns the a valid instance from Ioc.

메소드 상세

__call() 공개 메소드

Handle dynamic method calls into the model.
public __call ( mixed $method, mixed $parameters ) : mixed
$method mixed Name of the method that is being called.
$parameters mixed Parameters of $method.
리턴 mixed

all() 공개 정적인 메소드

Gets a cursor of this kind of entities from the database.
public static all ( ) : Cursor
리턴 Mongolid\Cursor\Cursor

delete() 공개 메소드

Deletes this object in database.
public delete ( ) : boolean
리턴 boolean Success

execute() 보호된 메소드

Performs the given action into database.
protected execute ( string $action ) : boolean
$action string Datamapper function to execute.
리턴 boolean

first() 공개 정적인 메소드

Gets the first entity of this kind that matches the query.
public static first ( mixed $query = [], array $projection = [], boolean $useCache = false ) : ActiveRecord
$query mixed MongoDB selection criteria.
$projection array Fields to project in Mongo query.
$useCache boolean Retrieves the entity through a CacheableCursor.
리턴 ActiveRecord

firstOrFail() 공개 정적인 메소드

Gets the first entity of this kind that matches the query. If no document was found, throws ModelNotFoundException.
public static firstOrFail ( mixed $query = [], array $projection = [], boolean $useCache = false ) : ActiveRecord
$query mixed MongoDB selection criteria.
$projection array Fields to project in Mongo query.
$useCache boolean Retrieves the entity through a CacheableCursor.
리턴 ActiveRecord

firstOrNew() 공개 정적인 메소드

Gets the first entity of this kind that matches the query. If no document was found, a new entity will be returned with the _if field filled.
public static firstOrNew ( mixed $id ) : ActiveRecord
$id mixed Document id.
리턴 ActiveRecord

getCollectionName() 공개 메소드

Getter for the $collection attribute.
public getCollectionName ( ) : string
리턴 string

getDataMapper() 공개 메소드

Returns a DataMapper configured with the Schema and collection described in this entity.
public getDataMapper ( ) : DataMapper
리턴 Mongolid\DataMapper\DataMapper

getSchema() 공개 메소드

public getSchema ( ) : Schema
리턴 Mongolid\Schema\Schema

getWriteConcern() 공개 메소드

Getter for $writeConcern variable.
public getWriteConcern ( ) : mixed
리턴 mixed

insert() 공개 메소드

Insert this object into database.
public insert ( ) : boolean
리턴 boolean Success

instantiateSchemaInFields() 보호된 메소드

Will check if the current value of $fields property is the name of a Schema class and instantiate it if possible.
protected instantiateSchemaInFields ( ) : Schema | null
리턴 Mongolid\Schema\Schema | null

save() 공개 메소드

Saves this object into database.
public save ( ) : boolean
리턴 boolean Success

setWriteConcern() 공개 메소드

Setter for $writeConcern variable.
public setWriteConcern ( mixed $writeConcern ) : void
$writeConcern mixed Level of write concern to the transation.
리턴 void

update() 공개 메소드

Updates this object in database.
public update ( ) : boolean
리턴 boolean Success

where() 공개 정적인 메소드

Gets a cursor of this kind of entities that matches the query from the database.
public static where ( array $query = [], array $projection = [], boolean $useCache = false ) : Cursor
$query array MongoDB selection criteria.
$projection array Fields to project in Mongo query.
$useCache boolean Retrieves a CacheableCursor instead.
리턴 Mongolid\Cursor\Cursor

프로퍼티 상세

$collection 보호되어 있는 프로퍼티

Name of the collection where this kind of Entity is going to be saved or retrieved from.
protected string $collection
리턴 string

$dynamic 공개적으로 프로퍼티

The $dynamic property tells if the object will accept additional fields that are not specified in the $fields property. This is useful if you does not have a strict document format or if you want to take full advantage of the "schemaless" nature of MongoDB.
public bool $dynamic
리턴 boolean

$fields 보호되어 있는 프로퍼티

Describes the Schema fields of the model. Optionally you can set it to the name of a Schema class to be used.
또한 보기: Mongolid\Schema\Schema::$fields
protected string|string[] $fields
리턴 string | string[]

$writeConcern 보호되어 있는 프로퍼티

또한 보기: https://docs.mongodb.com/manual/reference/write-concern/
protected int $writeConcern
리턴 integer