/** * @param string $databaseName */ public function __construct($databaseName) { $this->entries = new MapOf(function () 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 UTCDateTime(1000 * $newerThanTimestamp); parent::__construct(self::mapper($projectModel->databaseName()), array('dateModified' => array('$gte' => $startDate)), array(), array('key' => 1)); } else { parent::__construct(self::mapper($projectModel->databaseName()), array(), array(), array('key' => 1)); } }
/** * @param ProjectModel $projectModel * @param int $newerThanTimestamp */ public function __construct($projectModel, $newerThanTimestamp = null) { new LexProjectModel($projectModel->id->asString()); if (!is_null($newerThanTimestamp)) { $startDate = new UTCDateTime(1000 * $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) { $this->entries = new ArrayOf(function () use($projectModel) { return new LexCommentModel($projectModel); }); // sort ascending by creation date if (!is_null($newerThanTimestamp)) { $startDate = new UTCDateTime($newerThanTimestamp * 1000); 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); } }
/** * @param ProjectModel $projectModel * @param int $newerThanTimestamp * @param int $limit * @param int $skip */ public function __construct($projectModel, $newerThanTimestamp = null, $limit = 0, $skip = 0) { // for use with readAsModels() $this->entries = new ArrayOf(function () use($projectModel) { return new LexEntryModel($projectModel); }); $lexProject = new LexProjectModel($projectModel->id->asString()); $this->_config = $lexProject->config; if (!is_null($newerThanTimestamp)) { $startDate = new UTCDateTime(1000 * $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 string $term * @param string | 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() { parent::__construct(GlobalQuestionTemplateModelMongoMapper::instance(), array(), array('title', 'description')); }
/** * QuestionTemplateListModel constructor. * @param ProjectModel $projectModel */ public function __construct($projectModel) { $databaseName = $projectModel->databaseName(); parent::__construct(self::mapper($databaseName), array(), array('title', 'description')); }
/** * @param string $site */ public function __construct($site) { $this->_site = $site; parent::__construct(ProjectModelMongoMapper::instance()); }
public function __construct() { MapperListModel::__construct(UserModelMongoMapper::instance(), array(), array('username', 'id', 'email', 'name', 'emailPending', 'last_login', 'role', 'siteRole', 'validationExpirationDate')); }
public function __construct($projectModel) { parent::__construct(TextModelMongoMapper_sf_v0_9_18::connect('sf_jamaican_psalms'), array('title' => array('$regex' => '')), array('title')); }
/** * ActivityListModel constructor. * @param ProjectModel $projectModel */ public function __construct($projectModel) { // hardcoded to limit 100. TODO implement paging $this->entries = new MapOf(function () use($projectModel) { return new ActivityModel($projectModel); }); parent::__construct(ActivityModelMongoMapper::connect($projectModel->databaseName()), array('action' => array('$regex' => '')), array(), array('dateCreated' => -1), 100); }
/** * QuestionAnswersListModel constructor. * @param MapperModel $projectModel * @param array $textId */ 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(ProjectModelMongoMapper::instance(), array(), array('projectName', 'language', 'projectCode', 'siteName', 'appName')); }
/** * UserListProjectModel constructor. * @param string $projectId */ public function __construct($projectId) { parent::__construct(UserModelMongoMapper::instance(), array('username' => array('$regex' => '\\w'), 'projects' => array('$in' => array(MongoMapper::mongoID($projectId)))), array('username', 'email', 'name')); }
/** * @param ProjectModel $projectModel * @param string $textId */ public function __construct($projectModel, $textId) { parent::__construct(QuestionModelMongoMapper::connect($projectModel->databaseName()), array('description' => array('$regex' => ''), 'textRef' => MongoMapper::mongoID($textId)), array('description')); }
public function __construct() { parent::__construct(ProjectModelMongoMapper::instance(), array('featured' => true), array('projectName', 'language')); }
public function __construct() { parent::__construct(UserModelMongoMapper::instance(), array('username' => array('$regex' => '')), array('username', 'email', 'name', 'avatar_ref', 'role', 'projects', 'active')); }
/** * TextListModel constructor. * @param ProjectModel $project */ public function __construct($project) { parent::__construct(TextModelMongoMapper::connect($project->databaseName()), array('title' => array('$regex' => '')), array('title')); }