diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Psecio/Gatekeeper/DataSource/Mysql.php | 6 | ||||
-rw-r--r-- | src/Psecio/Gatekeeper/Gatekeeper.php | 2 |
2 files changed, 5 insertions, 3 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 { diff --git a/src/Psecio/Gatekeeper/Gatekeeper.php b/src/Psecio/Gatekeeper/Gatekeeper.php index 0ce45a3..85c78fa 100644 --- a/src/Psecio/Gatekeeper/Gatekeeper.php +++ b/src/Psecio/Gatekeeper/Gatekeeper.php @@ -327,7 +327,7 @@ class Gatekeeper } $model = self::modelFactory($model.'Model'); $collection = new $collectionNs(self::$datasource); - $collection = self::$datasource->find($model, $data); + $collection = self::$datasource->find($model, $data, true); return $collection; } |