Esempio n. 1
0
 /**
  * getFilterFields
  *
  * @param int $prefixFirst
  *
  * @return  array
  */
 public function getSelectFields($prefixFirst = self::COLS_WITH_FIRST)
 {
     $fields = array();
     $i = 0;
     foreach ($this->tables as $alias => $table) {
         $columns = DatabaseFactory::getCommand()->getColumns($table['name']);
         foreach ($columns as $column => $var) {
             if ($i === 0) {
                 if ($prefixFirst & self::COLS_WITH_FIRST) {
                     $fields[] = $this->db->quoteName("{$alias}.{$column}", $column);
                 }
                 if ($prefixFirst & self::COLS_PREFIX_WITH_FIRST) {
                     $fields[] = $this->db->quoteName("{$alias}.{$column}", "{$alias}_{$column}");
                 }
             } else {
                 $fields[] = $this->db->quoteName("{$alias}.{$column}", "{$alias}_{$column}");
             }
         }
         $i++;
     }
     return $fields;
 }
Esempio n. 2
0
 /**
  * Get table fields.
  *
  * @param string $table Table name.
  *
  * @return  array
  */
 protected function getFields($table = null)
 {
     $table = $table ?: $this->table;
     return array_keys(DatabaseFactory::getCommand()->getColumns($table));
 }