/** * @param ProjectModel $projectModel * @param string $id */ public function __construct($projectModel, $id = '') { $this->id = new Id(); $this->projectRef = new IdReference($projectModel->id->asString()); $this->textRef = new IdReference(); $this->questionRef = new IdReference(); $this->userRef = new IdReference(); $this->userRef2 = new IdReference(); $this->entryRef = new IdReference(); $this->action = $this::UNKNOWN; $this->date = new \DateTime(); // set the timestamp to now $this->actionContent = new MapOf(); // strings $this->addContent($this::PROJECT, $projectModel->projectName); $databaseName = $projectModel->databaseName(); parent::__construct(ActivityModelMongoMapper::connect($databaseName), $id); }
/** * 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); }