Exemplo n.º 1
0
 public function get($limit = null)
 {
     $result = [];
     foreach (parent::get($limit) as $data) {
         $result[$data->id()] = $data;
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * where in 子查询语句
  *
  * @param string $column
  * @param array|Select $relation
  * @param boolean $in
  * @return $this
  */
 protected function whereSub($column, $relation, $in)
 {
     $column = $this->adapter->quoteIdentifier($column);
     $params = [];
     if ($relation instanceof Select) {
         list($sql, $params) = $relation->compile();
         $sub = $sql;
     } else {
         $sub = implode(',', $this->adapter->quote($relation));
     }
     $where = $in ? sprintf('%s IN (%s)', $column, $sub) : sprintf('%s NOT IN (%s)', $column, $sub);
     $this->where[] = [$where, $params];
     return $this;
 }