summaryrefslogtreecommitdiffstats
path: root/src/Psecio/Gatekeeper/DataSource/Mysql.php
diff options
context:
space:
mode:
authorChris Cornutt <enygma@phpdeveloper.org>2015-01-19 11:40:57 -0600
committerChris Cornutt <enygma@phpdeveloper.org>2015-01-19 11:40:57 -0600
commit6432bde62f47aa94a9ed00b78247cac54599e89e (patch)
tree11ff807d433dd9b8933f29d98c4ef4aeb1eb5ab6 /src/Psecio/Gatekeeper/DataSource/Mysql.php
parent240b4ae115ad3d95c35dd441f68e15b56932eee6 (diff)
downloadgatekeeper-6432bde62f47aa94a9ed00b78247cac54599e89e.zip
gatekeeper-6432bde62f47aa94a9ed00b78247cac54599e89e.tar.gz
gatekeeper-6432bde62f47aa94a9ed00b78247cac54599e89e.tar.bz2
updating mysql data source with additional checks for model/collection switch
Diffstat (limited to 'src/Psecio/Gatekeeper/DataSource/Mysql.php')
-rw-r--r--src/Psecio/Gatekeeper/DataSource/Mysql.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Psecio/Gatekeeper/DataSource/Mysql.php b/src/Psecio/Gatekeeper/DataSource/Mysql.php
index b3d043d..09bd40f 100644
--- a/src/Psecio/Gatekeeper/DataSource/Mysql.php
+++ b/src/Psecio/Gatekeeper/DataSource/Mysql.php
@@ -212,7 +212,7 @@ class Mysql extends \Psecio\Gatekeeper\DataSource
if ($result !== false && count($result) == 1 && $multiple === false) {
$model->load($result[0]);
return $model;
- } else {
+ } elseif (count($result) > 1){
// Make a collection instead
$modelClass = get_class($model);
$collectionNs = str_replace('Model', 'Collection', $modelClass);
@@ -226,6 +226,7 @@ class Mysql extends \Psecio\Gatekeeper\DataSource
}
return $collection;
}
+ return $model;
}
/**