Example #1
0
 /**
  * testFindColumn
  *
  * @return  void
  */
 public function testFindColumn()
 {
     $columns = $this->instance->findColumn('id', array(), 'catid, ordering', 0, 3);
     $this->assertEquals(array(3, 4, 7), $columns);
 }
 /**
  * Find column as an array.
  *
  * @param string  $column     The column we want to select.
  * @param mixed   $conditions Where conditions, you can use array or Compare object.
  *                            Example:
  *                            - `array('id' => 5)` => id = 5
  *                            - `new GteCompare('id', 20)` => 'id >= 20'
  *                            - `new Compare('id', '%Flower%', 'LIKE')` => 'id LIKE "%Flower%"'
  * @param mixed   $order      Order sort, can ba string, array or object.
  *                            Example:
  *                            - `id ASC` => ORDER BY id ASC
  *                            - `array('catid DESC', 'id')` => ORDER BY catid DESC, id
  * @param integer $start      Limit start number.
  * @param integer $limit      Limit rows.
  *
  * @return  mixed
  *
  * @throws \InvalidArgumentException
  */
 public function findColumn($column, $conditions = array(), $order = null, $start = null, $limit = null)
 {
     $this->observers->update('onBeforeFindColumn', array($column, $conditions, $order, $start, $limit));
     $columns = parent::findColumn($column, $conditions, $order, $start, $limit);
     $this->observers->update('onAfterFindColumn', array(&$columns));
     return $columns;
 }