Example #1
0
 /**
  * @covers Gacela\Criteria::limit
  */
 public function testLimit()
 {
     $this->object->limit(0, 50);
     $this->assertAttributeSame(array(array('limit', 0, 50)), '_criteria', $this->object);
 }
Example #2
0
<?php

$repository = new BlogPostRepository();
$criteria = new Criteria();
$criteria->equals('BlogPost.ID', $blog_post_id);
$criteria->limit($limit);
$related_blog_poasts = $repository->getTagRelated($criteria);
Example #3
0
 public function get_list(Criteria $criteria = null)
 {
     if (!$criteria) {
         $criteria = new Criteria();
     }
     if ($criteria->order()) {
         $this->db->order_by($criteria->order());
     }
     if ($criteria->limit()) {
         $this->db->limit($criteria->limit(), $criteria->offset());
     }
     $this->_prepare_fields($criteria);
     $this->_prepare_from();
     $this->_prepare_where($criteria);
     if ($this->_debug) {
         $res = $this->db->get();
         log_message('debug', $this->db->last_query());
         return $res->result_array();
     }
     $result = $this->db->get();
     if ($result === false) {
         throw new Exception($this->db->_error_message());
     }
     return $result->result_array();
 }