Exemple #1
0
 public function testFind()
 {
     $obj = new Object("TestObject");
     $id = microtime();
     $obj->set("testid", $id);
     $obj->save();
     $query = new Query("TestObject");
     $query->equalTo("testid", $id);
     $objects = $query->find();
     $this->assertEquals(1, count($objects));
     $this->assertEquals($id, $objects[0]->get("testid"));
     $obj->destroy();
 }
Exemple #2
0
 /**
  * Get roles the user belongs to
  *
  * @return array Array of Role
  */
 public function getRoles()
 {
     if (!$this->getObjectId()) {
         return array();
     }
     $query = new Query("_Role");
     $query->equalTo("users", $this);
     $roles = $query->find();
     return $roles;
 }