public function testOrLikes() { $sql = "SELECT DISTINCT a, b, c FROM table WHERE d LIKE e OR f LIKE e OR g LIKE e ORDER BY h"; $query = new \Peyote\Select('table'); $query->distinct()->columns("a", "b", "c")->where('d', 'LIKE', 'e', false)->orWhere('f', 'LIKE', 'e', false)->orWhere('g', 'LIKE', 'e', false)->orderBy('h'); $this->assertSame($sql, $query->compile()); }
/** * Gets all of the records that satisfy the search parameters. * * @param array $params The search parameters * @return \Cactus\Collection */ public function find(array $params) { $query = new \Peyote\Select($this->table); foreach ($params as $key => $value) { $query->where($key, '=', $value); } $result = $this->adapter->select($query->compile(), $query->getParams()); return $this->formCollection($result); }