protected function _getPrototypeModel()
 {
     if ($this->prototypeModel === null) {
         $this->prototypeModel = parent::create();
         // カラム情報を取得する
         $mapper =& Pengin_Database_MySqlColumnMapper::getInstance();
         $columns = $mapper->getColumns($this->table);
         foreach ($columns as $column) {
             $data = $mapper->getTypeSize($column['Type']);
             $this->prototypeModel->val($column['Field'], $data['type'], $column['Default'], $data['size']);
         }
     }
     return $this->prototypeModel;
 }
예제 #2
0
 /**
  * モデルのデータを入力値に反映する.
  * 
  * @access public
  * @param Pengin_Model_AbstractModel $model
  * @return Pengin_Form
  */
 public function useModelData(Pengin_Model_AbstractModel $model)
 {
     $values = $model->getVars();
     foreach ($this->properties as $property) {
         $name = $property->getName();
         if (array_key_exists($name, $values) === true) {
             $property->importValue($values[$name]);
         }
     }
     return $this;
 }