[TYPO3-ect] Configuration needed in the model
Bastian Waidelich
bastian at typo3.org
Tue Mar 17 18:11:56 CET 2009
walk2moon wrote:
Hi walk2moon*,
> Is there any chance to have the config in the model?
As Franz pointed out, you can access the controllers configurations via
$this->controller->configurations
But you should consider setting only options you really need from the
controller to minimize dependencies.
That could look something like this:
// this method is called automatically by lib/div before each action
public function doPreActionProcessings() {
$modelClassName =
tx_div::makeInstanceClassName($this->configurations['modelClassName']);
$this->model = new $modelClassName($this);
$this->model->setStoragePID($this->configurations['storagePID'])
...
}
So you can more easily reuse the model from another controller, hook,
api whatsoever.
Good luck,
Bastian
* the TYPO3 mailing list guidelines suggests to use real names (see
http://typo3.org/community/mailing-lists/mailing-list-rules-guidelines/)
More information about the TYPO3-team-extension-coordination
mailing list