/** Constructor. */ public function __construct() { parent::__construct(); $this->_name = 'tracker_scalar'; $this->_key = 'scalar_id'; $this->_mainData = array('scalar_id' => array('type' => MIDAS_DATA), 'trend_id' => array('type' => MIDAS_DATA), 'user_id' => array('type' => MIDAS_DATA), 'submission_id' => array('type' => MIDAS_DATA), 'official' => array('type' => MIDAS_DATA), 'build_results_url' => array('type' => MIDAS_DATA), 'params' => array('type' => MIDAS_DATA), 'extra_urls' => array('type' => MIDAS_DATA), 'branch' => array('type' => MIDAS_DATA), 'submit_time' => array('type' => MIDAS_DATA), 'value' => array('type' => MIDAS_DATA), 'producer_revision' => array('type' => MIDAS_DATA), 'trend' => array('type' => MIDAS_MANY_TO_ONE, 'model' => 'Trend', 'module' => $this->moduleName, 'parent_column' => 'trend_id', 'child_column' => 'trend_id'), 'submission' => array('type' => MIDAS_MANY_TO_ONE, 'model' => 'Submission', 'module' => $this->moduleName, 'parent_column' => 'submission_id', 'child_column' => 'submission_id'), 'user' => array('type' => MIDAS_MANY_TO_ONE, 'model' => 'User', 'parent_column' => 'user_id', 'child_column' => 'user_id')); $this->initialize(); }
/** Constructor. */ public function __construct() { parent::__construct(); $this->_name = 'tracker_submission'; $this->_key = 'submission_id'; $this->_mainData = array('submission_id' => array('type' => MIDAS_DATA), 'producer_id' => array('type' => MIDAS_DATA), 'name' => array('type' => MIDAS_DATA), 'uuid' => array('type' => MIDAS_DATA), 'submit_time' => array('type' => MIDAS_DATA), 'producer' => array('type' => MIDAS_MANY_TO_ONE, 'model' => 'Producer', 'module' => $this->moduleName, 'parent_column' => 'producer_id', 'child_column' => 'producer_id')); $this->initialize(); }
/** Constructor. */ public function __construct() { parent::__construct(); $this->_name = 'tracker_threshold_notification'; $this->_daoName = 'ThresholdNotificationDao'; $this->_key = 'threshold_id'; $this->_mainData = array('threshold_id' => array('type' => MIDAS_DATA), 'trend_id' => array('type' => MIDAS_DATA), 'value' => array('type' => MIDAS_DATA), 'comparison' => array('type' => MIDAS_DATA), 'action' => array('type' => MIDAS_DATA), 'recipient_id' => array('type' => MIDAS_DATA), 'trend' => array('type' => MIDAS_MANY_TO_ONE, 'model' => 'Trend', 'module' => $this->moduleName, 'parent_column' => 'trend_id', 'child_column' => 'trend_id'), 'recipient' => array('type' => MIDAS_MANY_TO_ONE, 'model' => 'User', 'parent_column' => 'recipient_id', 'child_column' => 'user_id')); $this->initialize(); }
/** * Delete the given trend and all associated scalars. * * @param Tracker_TrendDao $trendDao trend DAO * @param null|ProgressDao $progressDao progress DAO */ public function delete($trendDao, $progressDao = null) { /** @var Tracker_ScalarModel $scalarModel */ $scalarModel = MidasLoader::loadModel('Scalar', $this->moduleName); /** @var Tracker_ThresholdNotificationModel $notificationModel */ $notificationModel = MidasLoader::loadModel('ThresholdNotification', $this->moduleName); if (!is_null($progressDao)) { /** @var ProgressModel $progressModel */ $progressModel = MidasLoader::loadModel('Progress'); $progressDao->setMessage('Counting scalar points...'); $progressModel->save($progressDao); } $scalarDaos = $trendDao->getScalars(); $scalarIndex = 0; if (!is_null($progressDao)) { $progressDao->setMaximum(count($scalarDaos)); /** @noinspection PhpUndefinedVariableInspection */ $progressModel->save($progressDao); } /** @var Tracker_ScalarDao $scalarDao */ foreach ($scalarDaos as $scalarDao) { if (!is_null($progressDao)) { ++$scalarIndex; $message = 'Deleting scalars: ' . $scalarIndex . ' of ' . $progressDao->getMaximum(); /** @noinspection PhpUndefinedVariableInspection */ $progressModel->updateProgress($progressDao, $scalarIndex, $message); } $scalarModel->delete($scalarDao); } $notificationModel->deleteByTrend($trendDao); parent::delete($trendDao); }