summaryrefslogtreecommitdiffstats
path: root/src/Psecio/Gatekeeper/DataSource/Mysql.php
diff options
context:
space:
mode:
authorChris Cornutt <enygma@phpdeveloper.org>2015-01-19 06:13:32 -0600
committerChris Cornutt <enygma@phpdeveloper.org>2015-01-19 06:13:32 -0600
commita7e38e180ada2752016ebc59f043df45cb540cfe (patch)
treed4e6424332cf3e93bfd14860cf0085928b17499a /src/Psecio/Gatekeeper/DataSource/Mysql.php
parentf603aa73081383a5806802bff92db6fe7b7f4970 (diff)
downloadgatekeeper-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.php6
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 {