Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function killUser($uid)
 {
     $result = null;
     if ($uid) {
         $row = null;
         try {
             $row = $this->model->find($uid, 'uid');
         } catch (\Exception $e) {
             $result = false;
         }
         if ($row) {
             try {
                 $row->delete();
                 $result = true;
             } catch (\Exception $e) {
                 $result = false;
             }
         }
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Fetch search result
  *
  * @param Model $model
  * @param Where $where
  * @param int   $limit
  * @param int   $offset
  *
  * @return array
  */
 protected function fetchResult(Model $model, Where $where, $limit = 0, $offset = 0)
 {
     $data = array();
     $select = $model->select();
     $select->where($where);
     $select->columns(array_keys($this->meta));
     $select->limit($limit)->offset($offset);
     if ($this->order) {
         $select->order($this->order);
     }
     $rowset = $model->selectWith($select);
     foreach ($rowset as $row) {
         $item = array();
         foreach ($this->meta as $column => $field) {
             $item[$field] = $row[$column];
             if ('content' == $field) {
                 $item[$field] = $this->buildContent($item[$field]);
             }
         }
         $item['url'] = $this->buildUrl($item);
         $data[] = $item;
     }
     return $data;
 }