Property | Type | Description | |
---|---|---|---|
$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. |
Property | Type | Description | |
---|---|---|---|
$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 |
Method | Description | |
---|---|---|
__call ( mixed $method, mixed $parameters ) : mixed | Handle dynamic method calls into the model. | |
all ( ) : |
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 ) : |
Gets the first entity of this kind that matches the query. | |
firstOrFail ( mixed $query = [], array $projection = [], boolean $useCache = false ) : |
Gets the first entity of this kind that matches the query. If no document was found, throws ModelNotFoundException. | |
firstOrNew ( mixed $id ) : |
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 ( ) : |
Returns a DataMapper configured with the Schema and collection described in this entity. | |
getSchema ( ) : |
||
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 ) : |
Gets a cursor of this kind of entities that matches the query from the database. |
Method | Description | |
---|---|---|
execute ( string $action ) : boolean | Performs the given action into database. | |
instantiateSchemaInFields ( ) : |
Will check if the current value of $fields property is the name of a Schema class and instantiate it if possible. |
Method | Description | |
---|---|---|
getDataMapperInstance ( ) : mixed | Returns the a valid instance from Ioc. |
public static all ( ) : |
||
return |
public static firstOrNew ( mixed $id ) : |
||
$id | mixed | Document id. |
return |
public getCollectionName ( ) : string | ||
return | string |
public getDataMapper ( ) : |
||
return |
public getWriteConcern ( ) : mixed | ||
return | mixed |
protected instantiateSchemaInFields ( ) : |
||
return |
public setWriteConcern ( mixed $writeConcern ) : void | ||
$writeConcern | mixed | Level of write concern to the transation. |
return | void |
protected string $collection | ||
return | string |
public bool $dynamic | ||
return | boolean |
protected string|string[] $fields | ||
return | string | string[] |