PHP Class DB\Mongo\Mapper

Inheritance: extends DB\Cursor
Datei anzeigen Open project: bcosca/fatfree-core Class Usage Examples

Protected Properties

Property Type Description
$collection
$cursor
$db
$document
$fields

Public Methods

Method Description
__construct ( Mongo $db, $collection, $fields = NULL ) : void Instantiate class
cast ( $obj = NULL ) : array Return fields of mapper object as an associative array
clear ( $key ) : null Delete field
copyfrom ( $var, $func = NULL ) : null Hydrate mapper object using hive array variable
copyto ( $key ) : null Populate hive array variable with mapper fields
count ( $filter = NULL, $ttl ) : integer Count records that match criteria
cursor ( ) : object | null Return the cursor from last query
dbtype ( ) : string Return database type
erase ( $filter = NULL ) : boolean Delete current record
exists ( $key ) : boolean Return TRUE if field is defined
fields ( ) : array Return field names
find ( $filter = NULL, array $options = NULL, $ttl ) : static[] Return records that match criteria
get ( $key ) : scalar | FALSE Retrieve value of field
getiterator ( ) : object Retrieve external iterator for fields
insert ( ) : array Insert new record
reset ( ) : null Reset cursor
select ( $fields = NULL, $filter = NULL, array $options = NULL, $ttl ) : static[] Build query and execute
set ( $key, $val ) : scalar | FALSE Assign value to field
skip ( $ofs = 1 ) : array Return record at specified offset using criteria of previous load() call and make it active
update ( ) : array Update current record

Protected Methods

Method Description
factory ( $row ) : static Convert array to mapper object

Method Details

__construct() public method

Instantiate class
public __construct ( Mongo $db, $collection, $fields = NULL ) : void
$db DB\Mongo object
$collection string
$fields array
return void

cast() public method

Return fields of mapper object as an associative array
public cast ( $obj = NULL ) : array
$obj object
return array

clear() public method

Delete field
public clear ( $key ) : null
$key string
return null

copyfrom() public method

Hydrate mapper object using hive array variable
public copyfrom ( $var, $func = NULL ) : null
$var array|string
$func callback
return null

copyto() public method

Populate hive array variable with mapper fields
public copyto ( $key ) : null
$key string
return null

count() public method

Count records that match criteria
public count ( $filter = NULL, $ttl ) : integer
$filter array
$ttl int
return integer

cursor() public method

Return the cursor from last query
public cursor ( ) : object | null
return object | null

dbtype() public method

Return database type
public dbtype ( ) : string
return string

erase() public method

Delete current record
public erase ( $filter = NULL ) : boolean
$filter array
return boolean

exists() public method

Return TRUE if field is defined
public exists ( $key ) : boolean
$key string
return boolean

factory() protected method

Convert array to mapper object
protected factory ( $row ) : static
$row array
return static

fields() public method

Return field names
public fields ( ) : array
return array

find() public method

Return records that match criteria
public find ( $filter = NULL, array $options = NULL, $ttl ) : static[]
$filter array
$options array array
$ttl int
return static[]

get() public method

Retrieve value of field
public get ( $key ) : scalar | FALSE
$key string
return scalar | FALSE

getiterator() public method

Retrieve external iterator for fields
public getiterator ( ) : object
return object

insert() public method

Insert new record
public insert ( ) : array
return array

reset() public method

Reset cursor
public reset ( ) : null
return null

select() public method

Build query and execute
public select ( $fields = NULL, $filter = NULL, array $options = NULL, $ttl ) : static[]
$fields string
$filter array
$options array array
$ttl int
return static[]

set() public method

Assign value to field
public set ( $key, $val ) : scalar | FALSE
$key string
$val scalar
return scalar | FALSE

skip() public method

Return record at specified offset using criteria of previous load() call and make it active
public skip ( $ofs = 1 ) : array
$ofs int
return array

update() public method

Update current record
public update ( ) : array
return array

Property Details

$collection protected_oe property

protected $collection

$cursor protected_oe property

protected $cursor

$db protected_oe property

protected $db

$document protected_oe property

protected $document

$fields protected_oe property

protected $fields