/** * @param LexProjectModel $project * @param int $newerThanTimestamp */ public function __construct($project, $newerThanTimestamp = null) { if (!is_null($newerThanTimestamp)) { $startDate = new UTCDateTime(1000 * $newerThanTimestamp); parent::__construct(self::mapper($project->databaseName()), array('dateModified' => array('$gte' => $startDate)), array()); } else { parent::__construct(self::mapper($project->databaseName()), array('name' => array('$regex' => ''))); } }
/** * @param ProjectModel|LexProjectModel $projectModel * @param string $id */ public function __construct($projectModel, $id = '') { $this->setReadOnlyProp('authorInfo'); $this->setReadOnlyProp('replies'); $this->setReadOnlyProp('score'); $this->setReadOnlyProp('status'); $this->setPrivateProp('isDeleted'); $this->id = new Id(); $this->entryRef = new IdReference(); $this->isDeleted = false; $this->replies = new ArrayOf(function () { return new LexCommentReply(); }); $this->status = self::STATUS_OPEN; $this->score = 0; $this->authorInfo = new LexAuthorInfo(); $this->regarding = new LexCommentFieldReference(); $databaseName = $projectModel->databaseName(); parent::__construct(self::mapper($databaseName), $id); }
public function testCreateProject_LexProject_IndexesCreated() { self::$environ = new LexiconMongoTestEnvironment(); self::$environ->clean(); $user1Id = self::$environ->createUser("user1name", "User1 Name", "*****@*****.**"); $user1 = new UserModel($user1Id); $srProject = null; $projectId = ProjectCommands::createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE, LexProjectModel::LEXICON_APP, $user1->id->asString(), self::$environ->website, $srProject); $project = new LexProjectModel($projectId); $databaseName = $project->databaseName(); $collectionName = LexEntryModel::mapper($databaseName)->getCollectionName(); $indexCount = iterator_count(MongoStore::getCollectionIndexes($databaseName, $collectionName)); $this->assertTrue($indexCount >= 3); $index = ['key' => ['guid' => 1]]; $this->assertTrue(MongoStore::isAllIndexFieldNamesInCollection($index, $databaseName, $collectionName)); $collectionName = LexOptionListModel::mapper($databaseName)->getCollectionName(); $indexCount = iterator_count(MongoStore::getCollectionIndexes($databaseName, $collectionName)); $this->assertTrue($indexCount >= 2); $index = ['key' => ['code' => 1]]; $this->assertTrue(MongoStore::isAllIndexFieldNamesInCollection($index, $databaseName, $collectionName)); }