3 class Users
Extends ActiveMongo
12 $col = $this->_getCollection();
14 /* Build our request */
15 $res = $col->find(array('uid' => array('$gt' => 5, '$lt' => 10)));
16 $res->sort(array('uid' => -1));
18 /* Give to ActiveMongo our Cursor */
19 $this->setCursor($res);
21 /* You must return 'this' for easy iteration */
25 function username_filter(&$value, $past_value)
27 if ($past_value != null && $value != $past_value) {
28 throw new FilterException("You cannot change the username");
30 if (strlen($value) < 5) {
31 throw new FilterException("Name too short");
37 function password_filter(&$value, &$past_value)
39 if (strlen($value) < 5) {
40 throw new FilterException("Password is too sort");
42 $value = sha1($value);
48 $this->_getCollection()->ensureIndex(array('uid' => 1), array('unique' => true, 'background' => true));