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