public function read($id = '')
 {
     $mapper = self::mapper();
     $query = array('type' => 'unread_item', 'userRef' => MongoMapper::mongoID($this->userRef->asString()));
     if ($this->projectRef->asString() != '') {
         $query['projectRef'] = MongoMapper::mongoID($this->projectRef->asString());
     } else {
         $query['projectRef'] = null;
     }
     if ($this->questionRef->asString() != '') {
         $query['questionRef'] = MongoMapper::mongoID($this->questionRef->asString());
     } else {
         $query['questionRef'] = null;
     }
     $mapper->readByProperties($this, $query);
 }
 /**
  * Removes a user from the collection
  * Project references to this user are also removed
  */
 public function remove()
 {
     UserModelMongoMapper::instance()->remove($this->id->asString());
 }
 public function remove()
 {
     $result = self::mapper($this->_projectModel->databaseName())->remove($this->id->asString());
     return $result;
 }
 public function read($id = '')
 {
     $mapper = self::mapper();
     $exists = $mapper->readByProperties($this, array('type' => 'vote', 'userRef' => MongoMapper::mongoID($this->userRef->asString()), 'projectRef' => MongoMapper::mongoID($this->projectRef->asString()), 'questionRef' => MongoMapper::mongoID($this->questionRef->asString())));
 }