Browse Source

Extend SqlCriteria::select() - use array or string for setting multiple fields of one call that method.

namespace
Alexander Demidov 11 years ago
parent
commit
9a881f6560
  1. 10
      model/SqlCriteria.php

10
model/SqlCriteria.php

@ -106,12 +106,16 @@ class SqlCriteria
} }
/** /**
* @param string $field
* @param string|array $fields
* @ex SqlCriteria::select('field')
* @ex SqlCriteria->select(array('field1', 'field2'))
* @ex SqlCriteria->select('field1,field2')
* @return SqlCriteria * @return SqlCriteria
*/ */
public function select($field)
public function select($fields)
{ {
$this->select[] = $field;
$fields = explode(',', $fields);
$this->select = $this->select + $fields;
return $this; return $this;
} }

Loading…
Cancel
Save