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