summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Cornutt <enygma@phpdeveloper.org>2015-02-18 11:24:41 -0500
committerChris Cornutt <enygma@phpdeveloper.org>2015-02-18 11:24:41 -0500
commitd50704482d2ee621882b72e5b58d3b5b08e87e9b (patch)
tree9a64b2bf3678962f04e6bbd7efb6822b75830997
parenta49cf268694cca1c7d0ee2a63960474b483c1b65 (diff)
downloadgatekeeper-d50704482d2ee621882b72e5b58d3b5b08e87e9b.zip
gatekeeper-d50704482d2ee621882b72e5b58d3b5b08e87e9b.tar.gz
gatekeeper-d50704482d2ee621882b72e5b58d3b5b08e87e9b.tar.bz2
adding the collection for the security questions for a user
-rw-r--r--src/Psecio/Gatekeeper/SecurityQuestionCollection.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Psecio/Gatekeeper/SecurityQuestionCollection.php b/src/Psecio/Gatekeeper/SecurityQuestionCollection.php
new file mode 100644
index 0000000..b424236
--- /dev/null
+++ b/src/Psecio/Gatekeeper/SecurityQuestionCollection.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Psecio\Gatekeeper;
+
+class SecurityQuestionCollection extends \Psecio\Gatekeeper\Collection\Mysql
+{
+ /**
+ * Find the security questions for the given user ID
+ *
+ * @param integer $userId User ID
+ */
+ public function findByUserId($userId)
+ {
+ $data = array('userId' => $userId);
+ $sql = 'select * from security_questions where user_id = :userId';
+
+ $results = $this->getDb()->fetch($sql, $data);
+
+ foreach ($results as $result) {
+ $question = new SecurityQuestionModel($this->getDb(), $result);
+ $this->add($question);
+ }
+ }
+} \ No newline at end of file