/** * @param string $databaseName */ public function __construct($databaseName) { $this->entries = new MapOf(function ($data) use($databaseName) { return new SmsModel($databaseName); }); parent::__construct(SmsMongoMapper::connect($databaseName), array()); }
/** * * @param ProjectModel $projectModel * @param int $newerThanTimestamp */ public function __construct($projectModel, $newerThanTimestamp = null) { if (!is_null($newerThanTimestamp)) { $startDate = new \MongoDate($newerThanTimestamp); parent::__construct(self::mapper($projectModel->databaseName()), array('dateModified' => array('$gte' => $startDate)), array(), array('name' => 1)); } else { parent::__construct(self::mapper($projectModel->databaseName()), array(), array(), array('name' => 1)); } }
/** * * @param ProjectModel $projectModel * @param int $newerThanTimestamp */ public function __construct($projectModel, $newerThanTimestamp = null) { $lexProject = new LexiconProjectModel($projectModel->id->asString()); if (!is_null($newerThanTimestamp)) { $startDate = new \MongoDate($newerThanTimestamp); parent::__construct(self::mapper($projectModel->databaseName()), array('isDeleted' => true, 'dateModified' => array('$gte' => $startDate)), array()); } else { parent::__construct(self::mapper($projectModel->databaseName()), array('isDeleted' => true), array()); } }
/** * * @param ProjectModel $projectModel * @param int $newerThanTimestamp * @param int $limit * @param int $skip */ public function __construct($projectModel, $newerThanTimestamp = null, $limit = 0, $skip = 0) { $lexProject = new LexiconProjectModel($projectModel->id->asString()); $this->_config = $lexProject->config; if (!is_null($newerThanTimestamp)) { $startDate = new \MongoDate($newerThanTimestamp); parent::__construct(self::mapper($projectModel->databaseName()), array('dateModified' => array('$gte' => $startDate), 'isDeleted' => false), array(), array(), $limit, $skip); } else { parent::__construct(self::mapper($projectModel->databaseName()), array('isDeleted' => false), array(), array(), $limit, $skip); } }
/** * * @param ProjectModel $projectModel * @param int $newerThanTimestamp * @param int $limit * @param int $skip */ public function __construct($projectModel, $newerThanTimestamp = null, $limit = 0, $skip = 0) { $this->entries = new ArrayOf(function ($data) use($projectModel) { return new LexCommentModel($projectModel); }); // sort ascending by creation date if (!is_null($newerThanTimestamp)) { $startDate = new \MongoDate($newerThanTimestamp); parent::__construct(self::mapper($projectModel->databaseName()), array('isDeleted' => false, 'dateModified' => array('$gte' => $startDate)), array(), array('dateCreated' => 1), $limit, $skip); } else { parent::__construct(self::mapper($projectModel->databaseName()), array('isDeleted' => false), array(), array('dateCreated' => 1), $limit, $skip); } }
public function __construct($projectModel, $textId) { parent::__construct(QuestionModelMongoMapper::connect($projectModel->databaseName()), array('description' => array('$regex' => ''), 'textRef' => MongoMapper::mongoID($textId)), array('description')); }
public function __construct($projectModel, $textId) { parent::__construct(QuestionModelMongoMapper::connect($projectModel->databaseName()), array('description' => array('$regex' => ''), 'textRef' => MongoMapper::mongoID($textId)), array('title', 'description', 'answers', 'isArchived'), array('dateCreated' => -1)); }
public function __construct() { parent::__construct(GlobalQuestionTemplateModelMongoMapper::instance(), array(), array('title', 'description')); }
public function __construct($projectModel) { $databaseName = $projectModel->databaseName(); parent::__construct(self::mapper($databaseName), array(), array('title', 'description')); }
public function __construct($projectModel) { parent::__construct(TextModelMongoMapper_sf_v0_9_18::connect('sf_jamaican_psalms'), array('title' => array('$regex' => '')), array('title')); }
/** * @param string $site */ public function __construct($site) { $this->_site = $site; parent::__construct(ProjectModelMongoMapper::instance()); }
public function __construct($projectModel) { parent::__construct(TextModelMongoMapper::connect($projectModel->databaseName()), array('title' => array('$regex' => '')), array('title')); }
public function __construct($projectId) { parent::__construct(UserModelMongoMapper::instance(), array('username' => array('$regex' => '\\w'), 'projects' => array('$in' => array(MongoMapper::mongoID($projectId)))), array('username', 'email', 'name')); }
public function __construct($projectModel) { // hardcoded to limit 100. TODO implement paging $this->entries = new MapOf(function ($data) use($projectModel) { return new ActivityModel($projectModel); }); parent::__construct(ActivityModelMongoMapper::connect($projectModel->databaseName()), array('action' => array('$regex' => '')), array(), array('dateCreated' => -1), 100); }
public function __construct() { parent::__construct(ProjectModelMongoMapper::instance(), array(), array('projectName', 'language')); }
/** * @param MongoMapper $term * @param string or array $projectIdOrIds * @param Website $website * @param bool $include */ public function __construct($term, $projectIdOrIds = '', $website, $include = false) { $query = array('$or' => array(array('name' => array('$regex' => $term, '$options' => '-i')), array('username' => array('$regex' => $term, '$options' => '-i')), array('email' => array('$regex' => $term, '$options' => '-i')))); if (!empty($projectIdOrIds)) { // Allow $projectIdOrIds to be either an array or a single ID if (is_array($projectIdOrIds)) { $idsForQuery = $projectIdOrIds; } else { $idsForQuery = array($projectIdOrIds); } // If passed string IDs, convert to MongoID objects $idsForQuery = array_map(function ($id) { if (is_string($id)) { return MongoMapper::mongoID($id); } else { return $id; } }, $idsForQuery); $inOrNotIn = $include ? '$in' : '$nin'; $query['projects'] = array($inOrNotIn => $idsForQuery); //error_log("Query: " . print_r($query, true)); } // Filter for only users on the current site $encodedDomain = $website->domain; MongoEncoder::encodeDollarDot($encodedDomain); $query['siteRole.' . $encodedDomain] = array('$exists' => true); parent::__construct(UserModelMongoMapper::instance(), $query, array('username', 'email', 'name', 'avatarRef')); // If we were called with a project filter that excluded certain users, also // return a list of specifically which users were excluded. Which happens to // be another typeahead search with the same query term, but *including* only // the ones matching this project. if ($projectIdOrIds && !$include) { $this->excludedUsers = new UserTypeaheadModel($term, $projectIdOrIds, $website, true); $this->excludedUsers->read(); } //echo("Result: " . print_r($this, true)); }
public function __construct($userId) { parent::__construct(CommunityModelMongoMapper::instance(), array('users' => array('$in' => array($userId))), array('communityname')); }