예제 #1
0
파일: model.php 프로젝트: nephie/Moya
 /**
  * This function will return a object filled with the data contained in the array given as parameter
  *
  */
 public function fillObject($data)
 {
     $objecttype = inflector::getObjectfromcontext($this);
     $object = new $objecttype();
     foreach ($data as $field => $value) {
         $objectfield = $this->getObjectfieldfor($field);
         $func = 'set' . ucfirst($objectfield);
         $object->{$func}($value);
     }
     return $object;
 }