public function noise() { //grab the noise values from the systemref table $q = Doctrine_Query::create()->select('s.name')->from('SystemRef s')->where("s.refType = 'noise'"); $q->execute(); $result = $q->execute(array(), Doctrine::HYDRATE_ARRAY); //Check for existing record $q2 = Doctrine_Query::create()->select('n.orgID')->from('NoiseValue n')->where("n.orgID = ?", $this->getOrgID()); $q2->execute(); if ($result2 = $q2->execute(array(), Doctrine::HYDRATE_ARRAY)) { } else { //insert values into the noise table foreach ($result as $key => $value) { //return $key."-".$value['name']; //insert into noise value table $noise = new NoiseValue(); $noise->orgID = $this->getOrgID(); $noise->noiseName = $value['name']; $noise->isActive = 1; $noise->rTime = $this->getDateFormat(); $noise->rUser = $this->getUserID(); $noise->save(); } } }
/** * @remotable */ public function defaultNoiseSetup() { //grab the location values from the systemref table $q = Doctrine_Query::create()->select('s.name')->from('SystemRef s')->where("s.refType = 'noise'"); $q->execute(); $result = $q->execute(array(), Doctrine::HYDRATE_ARRAY); //insert values into the noise table foreach ($result as $key => $value) { //return $key."-".$value['name']; //insert into noise value table $noise = new NoiseValue(); $noise->orgID = 16; $noise->noiseName = $value['name']; $noise->isActive = 1; $noise->rTime = date("d/m/y : H:i:s", time()); $noise->rUser = $this->getUserID(); $noise->save(); } }