Ejemplo n.º 1
0
 public function findAction()
 {
     $robots = $this->demoModel->find(array("conditions" => "id >= :id:", "columns" => "id, username,password", "order" => "username DESC", "offset" => 0, "limit" => 10, "group" => "id, username", "bind" => array("id" => 1)));
     dump($robots->toArray());
     exit;
     // 也可以这样
     $robots = Robots::query()->where("type = :type:")->andWhere("year < 2000")->bind(array("type" => "mechanical"))->order("name")->execute();
     // 单条记录
     $data = $this->demoModel->findFirst();
 }
<?php

$robots = Robots::query()->where("type = :type:")->andWhere("year < 2000")->bind(array("type" => "mechanical"))->order("name")->execute();