Pages

Collection to handle page data

Pages -object helps to fetch, modify and save data in tables.

Object can hoid a collection of PageĻs, which can be handled as a group: Calculating total amount, render pages in HTML table or modify values...

Arguments

$name
table name

Example

$Orders = $this->get('pages','order');

Use examples

Fetching data and calculating values

Fetch all open orders and calculate total amount with vat:

$totalVat = $this->get('pages','order')
    ->addWhere('status','Open')
    ->calculate('amount*(100+vat)/100');

render HTML

Loop through pages in collection and render information:

$Pages = $this->get('pages','order')->addWhere('status','open');
foreach ( $Pages as $Page ){
    $txt .= "
        <h2>{$Page->getTitle()}</h2>
        <p>Customer: {$Page->customer->name}</p>
    ";
}

Methods