1 | <?php |
||
8 | abstract class AbstractRecord extends AbstractValidator |
||
9 | { |
||
10 | /** |
||
11 | * Error constants |
||
12 | */ |
||
13 | const ERROR_NO_RECORD_FOUND = 'noRecordFound'; |
||
14 | const ERROR_RECORD_FOUND = 'recordFound'; |
||
15 | |||
16 | /** |
||
17 | * @var array Message templates |
||
18 | */ |
||
19 | protected $messageTemplates = array( |
||
20 | self::ERROR_NO_RECORD_FOUND => "No record matching the input was found", |
||
21 | self::ERROR_RECORD_FOUND => "A record matching the input was found", |
||
22 | ); |
||
23 | |||
24 | /** |
||
25 | * @var UserInterface |
||
26 | */ |
||
27 | protected $mapper; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $key; |
||
33 | |||
34 | /** |
||
35 | * Required options are: |
||
36 | * - key Field to use, 'email' or 'username' |
||
37 | */ |
||
38 | public function __construct(array $options) |
||
48 | |||
49 | /** |
||
50 | * getMapper |
||
51 | * |
||
52 | * @return UserInterface |
||
53 | */ |
||
54 | public function getMapper() |
||
58 | |||
59 | /** |
||
60 | * setMapper |
||
61 | * |
||
62 | * @param UserInterface $mapper |
||
63 | * @return AbstractRecord |
||
64 | */ |
||
65 | public function setMapper(UserInterface $mapper) |
||
70 | |||
71 | /** |
||
72 | * Get key. |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | public function getKey() |
||
80 | |||
81 | /** |
||
82 | * Set key. |
||
83 | * |
||
84 | * @param string $key |
||
85 | */ |
||
86 | public function setKey($key) |
||
91 | |||
92 | /** |
||
93 | * Grab the user from the mapper |
||
94 | * |
||
95 | * @param string $value |
||
96 | * @return mixed |
||
97 | */ |
||
98 | protected function query($value) |
||
118 | } |
||
119 |