PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Creating a query

For the user's convenience, the select() method instantiates a query object specific to the adapter, and sets the SELECT clause for it.

Example 84. Creating a structured query

<?php
$query 
$documents->select()
                   ->
from('collectionName')
                   ->
where('year > ?', array(1945))
                   ->
limit(3);
$docs $documents->query('collectionName'$query);
foreach (
$docs as $doc) {
    
$id $doc->getId();
    echo 
"Found document with ID: "
        
var_export($id1)
        . 
"\n";
}

Zend Framework