From 9a881f6560bea45a376f9232e4be209746e2a199 Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Wed, 9 Oct 2013 07:07:34 +0400 Subject: [PATCH] Extend SqlCriteria::select() - use array or string for setting multiple fields of one call that method. --- model/SqlCriteria.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/model/SqlCriteria.php b/model/SqlCriteria.php index 9f18fd4..58b26dc 100644 --- a/model/SqlCriteria.php +++ b/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 */ - public function select($field) + public function select($fields) { - $this->select[] = $field; + $fields = explode(',', $fields); + $this->select = $this->select + $fields; return $this; }