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