php - Can I use a dynamic model in variable settings? -


i have code

 $this->loadmodel($model);  $this->task->id = $id;  $this->task->save($this->data[$model]); 

how can setup "task" model can make dynamic because doesn't work:

 $this->loadmodel($model);  $this->$model->id = $id;  $this->$model->save($this->data[$model]); 

i tried no luck:

 $this->loadmodel($model);  $this->currentmodel = $model;  $this->currentmodel->id = $id;  $this->currentmodel->save($this->data[$model]); 

try one...

<?php  // dynamic model app::import('model', $model); $this->dynamicmodel = new $model;  // usage example  function getmodelcolumns($model){ app::import('model', $model); $this->dynamicmodel = new $model; print_r($this->dynamicmodel->getcolumntypes());exit(); }  ?> 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -