summaryrefslogtreecommitdiffstats
path: root/src/Psecio/Gatekeeper/SecurityQuestionCollection.php
blob: b00b7e2a8d59de1a42d6b675f6802c21c72c0bf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 '.$this->getPrefix().'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);
        }
	}
}