Ejemplo n.º 1
0
 /**
  * Prepare array from db
  *
  * @param array $fields
  * @return array
  */
 protected function prepareArrayFromDb(array $fields)
 {
     $columns = $this->table->getColumns();
     foreach ($fields as $field => &$value) {
         if ($columns->has($field)) {
             $value = $columns->get($field)->convertFromDB($value);
         }
     }
     unset($value);
     return $fields;
 }
Ejemplo n.º 2
0
 /**
  * Set filter
  * @param array $filter
  * @return \BX\DB\Filter\SqlBuilder
  */
 public function filter(array $filter = [])
 {
     $filter_rule = [];
     foreach ($this->entity->getColumns() as $key => $column) {
         $filter_rule[$key] = $column->getFilterRule();
     }
     $block = new LogicBlock($this, $filter_rule);
     $sql = $block->toSql($filter);
     if ($this->string()->length($sql) > 0) {
         $this->filter_sql[] = $sql;
     }
     return $this;
 }