Пример #1
0
 public static function addResult($json)
 {
     $result = new Result();
     $result->sessionId = $json['session'];
     $result->param = $json['param'];
     $result->value = $json['value'];
     $result->save();
     if (isset($json['tags'])) {
         /** @var Session $session */
         $session = Session::find($result->sessionId);
         $tagIds = array();
         foreach ($json['tags'] as $tagName) {
             $tag = new Tag();
             $tag->name = $tagName;
             $tag->findOrSave();
             $tagIds[] = $tag->id;
         }
         $series = new Series();
         $series->sessionId = $session->id;
         $series->hostId = $session->hostId;
         $series->suiteId = $session->suiteId;
         sort($tagIds);
         $series->tagIds = implode(',', $tagIds);
         $series->findOrSave();
         foreach ($tagIds as $tagId) {
             $seriesTag = new SeriesTag();
             $seriesTag->tagId = $tagId;
             $seriesTag->seriesId = $series->id;
             $seriesTag->findOrSave();
         }
     }
     return true;
 }
Пример #2
0
 /**
  * Setup column types in provided columns object
  * @param $columns static|\stdClass
  */
 static function setUpColumns($columns)
 {
     $columns->id = Column::AUTO_ID;
     $columns->sessionId = Session::columns()->id;
     $columns->seriesId = Series::columns()->id;
     $columns->value = Column::FLOAT;
     $columns->param = Column::FLOAT;
 }
Пример #3
0
 public static function migrate()
 {
     $migrationManager = new Manager();
     $migrationManager->setLog(new Log('colored-stdout'));
     $migrationManager->add(Host::table()->migration());
     $migrationManager->add(Tag::table()->migration());
     $migrationManager->add(Result::table()->migration());
     $migrationManager->add(Suite::table()->migration());
     $migrationManager->add(ResultTag::table()->migration());
     $migrationManager->add(Session::table()->migration());
     $migrationManager->add(Series::table()->migration());
     $migrationManager->add(SeriesTag::table()->migration());
     $migrationManager->run();
 }
Пример #4
0
 public static function session()
 {
     $layout = new Layout();
     $id = $_GET['id'];
     if (!$id) {
         return self::notFound();
     }
     /** @var Session $session */
     $session = Session::find($id);
     if (!$session) {
         return self::notFound();
     }
     /** @var Tag[] $tags */
     $tags = Series::find()->select(Tag::columns())->leftJoin('? ON ? = ?', SeriesTag::table(), SeriesTag::columns()->seriesId, Series::columns()->id)->leftJoin('? ON ? = ?', Tag::table(), Tag::columns()->id, SeriesTag::columns()->tagId)->where('? = ?', Series::columns()->sessionId, $session->id)->groupBy(Tag::columns()->id)->bindResultClass(Tag::className())->query()->fetchAll();
     $layout->setList(new TagsFilter($tags));
     $layout->render();
     return true;
 }
Пример #5
0
 /**
  * Required setup column types in provided columns object
  * @param $columns static|\stdClass
  */
 static function setUpColumns($columns)
 {
     $columns->seriesId = Series::columns()->id;
     $columns->tagId = Tag::columns()->id;
 }