pclib
3.0.0
Lightweight PHP framework
|
Selection of records in database. More...
Public Member Functions | |
rewind () | |
Iterator.rewind() implementation. | |
current () | |
Iterator.current() implementation. | |
key () | |
Iterator.key() implementation. | |
next () | |
Iterator.next() implementation. | |
valid () | |
Iterator.valid() implementation. | |
__call ($name, $args) | |
PHP magic method. More... | |
first () | |
Return first record in the selection. More... | |
isEmpty () | |
Is Selection empty? More... | |
count () | |
Return number of rows in the Selection. | |
sum ($s) | |
Return summary of field $s. More... | |
avg ($s) | |
Return AVG of field $s. More... | |
find ($id) | |
Find record by primary key. More... | |
update (array $values) | |
Update records in selection with $values. | |
delete () | |
Delete selection. | |
getClone () | |
Clone selection. | |
limit ($limit, $offset=0) | |
Set selection limit. More... | |
select ($columns) | |
Execute selection and return array of rows. More... | |
selectPair ($columns) | |
See Db->selectPair(). | |
from ($s) | |
Set source table $s. More... | |
where ($s) | |
Set where condition. More... | |
whereJoin ($relName, $s) | |
Set where condition. More... | |
order ($s) | |
Set order by clausule. More... | |
group ($s) | |
Set group by clausule. More... | |
having ($s) | |
Set having clausule. More... | |
close () | |
Closes the cursor, enabling the query to be executed again. More... | |
clear () | |
Clear selection query and data. More... | |
getSql () | |
Build sql query for current selection. More... | |
toArray ($deep=false) | |
Return current selection as array. More... | |
__toString () | |
Return string representation of selection for debugging purposes. | |
Public Member Functions inherited from BaseObject | |
loadDefaults ($className=null) | |
Load default parameters of class $className into object instance. | |
setProperties (array $defaults) | |
Set public properties of object from the array. More... | |
toArray () | |
Convert object to array. More... | |
Data Fields | |
$db | |
var Db | |
Data Fields inherited from BaseObject | |
$serviceLocator | |
var function() Return service object when requested with service(). | |
Protected Member Functions | |
newModel ($data) | |
Create model instance, fill its values with $data and return it. More... | |
execute () | |
Execute query to the database and set $this->result. More... | |
Protected Member Functions inherited from BaseObject | |
service ($service, $default=null) | |
Try acquire $service and load it into property $this->$service. More... | |
Protected Attributes | |
$query = array() | |
Array of sql query clausules. | |
$result = null | |
Result of underlying sql query. | |
$data = array() | |
Data of the current row. | |
Additional Inherited Members | |
Static Public Member Functions inherited from BaseObject | |
static | defaults () |
Set or retireve default parameters of the object. More... | |
Selection of records in database.
It represents any selection on database table and will return Model instances as records. It does not load records from the database before they are really requested.
Features:
__call | ( | $name, | |
$args | |||
) |
PHP magic method.
Redirect unknown method call to underlying model class.
Reimplemented from BaseObject.
avg | ( | $s | ) |
Return AVG of field $s.
@TODO: verify if $s is valid fieldname.
close | ( | ) |
Closes the cursor, enabling the query to be executed again.
|
protected |
Execute query to the database and set $this->result.
find | ( | $id | ) |
Find record by primary key.
first | ( | ) |
Return first record in the selection.
from | ( | $s | ) |
getSql | ( | ) |
Build sql query for current selection.
group | ( | $s | ) |
having | ( | $s | ) |
isEmpty | ( | ) |
Is Selection empty?
limit | ( | $limit, | |
$offset = 0 |
|||
) |
|
protected |
Create model instance, fill its values with $data and return it.
order | ( | $s | ) |
select | ( | $columns | ) |
Execute selection and return array of rows.
array | string | $columns | List of columns to select |
sum | ( | $s | ) |
Return summary of field $s.
@TODO: verify if $s is valid fieldname.
toArray | ( | $deep = false | ) |
Return current selection as array.
bool | $deep | Return arrays instead of models |
where | ( | $s | ) |
whereJoin | ( | $relName, | |
$s | |||
) |
Set where condition.
Fluent interface.
$relName | Name of relation |
$s | Condition used on relation |