/**
  * Return the threshold notifications whose conditions are met by the given scalar.
  *
  * @param Tracker_ScalarDao $scalarDao scalar DAO
  * @return array threshold notification DAOs
  */
 public function getNotifications($scalarDao)
 {
     $sql = $this->database->select()->setIntegrityCheck(false)->where('trend_id = ?', $scalarDao->getTrend()->getKey());
     $rows = $this->database->fetchAll($sql);
     $thresholdNotificationDaos = array();
     /** @var Zend_Db_Table_Row_Abstract $row */
     foreach ($rows as $row) {
         /** @var Tracker_ThresholdNotificationDao $thresholdNotificationDao */
         $thresholdNotificationDao = $this->initDao('ThresholdNotification', $row, $this->moduleName);
         if ($this->testThreshold($scalarDao->getValue(), $thresholdNotificationDao)) {
             $thresholdNotificationDaos[] = $thresholdNotificationDao;
         }
     }
     return $thresholdNotificationDaos;
 }
Exemple #2
0
 /**
  * Delete the given scalar and any associations to items.
  *
  * @param Tracker_ScalarDao $scalarDao scalar DAO
  */
 public function delete($scalarDao)
 {
     $this->database->getDB()->delete('tracker_scalar2item', 'scalar_id = ' . $scalarDao->getKey());
     parent::delete($scalarDao);
 }
 /**
  * Convert the given scalar DAO to an array and prepend metadata.
  *
  * @param Tracker_ScalarDao $scalarDao scalar DAO
  * @return array associative array representation of the scalar DAO with metadata prepended
  */
 protected function _toArray($scalarDao)
 {
     $scalarArray = array('_id' => $scalarDao->getKey(), '_type' => 'Tracker_Scalar');
     return array_merge($scalarArray, $scalarDao->toArray());
 }