diff options
author | Chris Cornutt <enygma@phpdeveloper.org> | 2015-01-19 06:13:32 -0600 |
---|---|---|
committer | Chris Cornutt <enygma@phpdeveloper.org> | 2015-01-19 06:13:32 -0600 |
commit | a7e38e180ada2752016ebc59f043df45cb540cfe (patch) | |
tree | d4e6424332cf3e93bfd14860cf0085928b17499a /src/Psecio/Gatekeeper/DataSource/Mysql.php | |
parent | f603aa73081383a5806802bff92db6fe7b7f4970 (diff) | |
download | gatekeeper-a7e38e180ada2752016ebc59f043df45cb540cfe.zip gatekeeper-a7e38e180ada2752016ebc59f043df45cb540cfe.tar.gz gatekeeper-a7e38e180ada2752016ebc59f043df45cb540cfe.tar.bz2 |
adding option to force return as multiple or single
Diffstat (limited to 'src/Psecio/Gatekeeper/DataSource/Mysql.php')
-rw-r--r-- | src/Psecio/Gatekeeper/DataSource/Mysql.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Psecio/Gatekeeper/DataSource/Mysql.php b/src/Psecio/Gatekeeper/DataSource/Mysql.php index 645055f..b3d043d 100644 --- a/src/Psecio/Gatekeeper/DataSource/Mysql.php +++ b/src/Psecio/Gatekeeper/DataSource/Mysql.php @@ -184,10 +184,12 @@ class Mysql extends \Psecio\Gatekeeper\DataSource * Find records matching the "where" data given * All "where" options are appended via "and" * + * @param \Modler\Model $model Model instance * @param array $where Data to use in "where" statement + * @param boolean $multiple Force return of single/multiple * @return array Fetched data */ - public function find(\Modler\Model $model, array $where = array()) + public function find(\Modler\Model $model, array $where = array(), $multiple = false) { $properties = $model->getProperties(); list($columns, $bind) = $this->setup($where); @@ -207,7 +209,7 @@ class Mysql extends \Psecio\Gatekeeper\DataSource $result = $this->fetch($sql, $where); - if ($result !== false && count($result) == 1) { + if ($result !== false && count($result) == 1 && $multiple === false) { $model->load($result[0]); return $model; } else { |