setModel() public method

Associate view with a model. Additionally may initialize a controller which would copy fields from the model into the View.
public setModel ( object | string $model, array | string | null $actual_fields = UNDEFINED ) : AbstractModel
$model object | string Class without "Model_" prefix or object
$actual_fields array | string | null List of fields in order to populate
return AbstractModel object
Exemplo n.º 1
0
 function setModel($m)
 {
     $m = parent::setModel($m);
     if ($m instanceof filestore\Model_Image) {
         $this->initializeTemplate(null, array($this->addon . './view/thumb'));
     } else {
         $this->initializeTemplate(null, array($this->addon . './view/file'));
     }
     $this->uploader = $this->add($this->addon . '/View_Uploader');
     $this->uploader->addHook('afterUpload', $this);
 }