Configuration needed in the model

View: New views
4 Messages — Rating Filter:   Alert me  

Configuration needed in the model

by Walter Seeberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello there,

I do have another question refering to push the config through the whole building process. I do need some configs for creeating a dynamic php-data-file in the model. Is there any chance to have the config in the model?

Do need your help.

Greets
Walter
--
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
_______________________________________________
TYPO3-team-extension-coordination mailing list
TYPO3-team-extension-coordination@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-extension-coordination

Re: Configuration needed in the model

by Franz Koch-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

walk2moon wrote:
> Hello there,
>
> I do have another question refering to push the config through the whole building process. I do need some configs for creeating a dynamic php-data-file in the model. Is there any chance to have the config in the model?
>
> Do need your help.

everything is available inside the controller, which itself should be
available in all your models (if not, create a reference to the calling
controller in your model) and then do:

$this->controller->configurations->get('whatever');

Just have a look at the documentation of lib (typo3conf/ext/lib/doc/*.txt)

--
kind regards,
Franz Koch

---------------------------------------------------
PayPal-Account: 'paypal _at_ elements-net _dot_ de'
---------------------------------------------------
_______________________________________________
TYPO3-team-extension-coordination mailing list
TYPO3-team-extension-coordination@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-extension-coordination

Re: Configuration needed in the model

by Bastian Waidelich-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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/)
_______________________________________________
TYPO3-team-extension-coordination mailing list
TYPO3-team-extension-coordination@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-extension-coordination

Parent Message unknown Re: Configuration needed in the model

by Walter Seeberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

@Franz and Bastion:

I thank you very much for solving my problem mentioned above.
I succeeded to have the configuration-things were I need them.

Although I do have another question:
It's just to understand that whole thing. If I need something from the model, I'll have to define a get-function in the model, makeInstance() in the view of my model and call the get-function.
Or is there another faster way?

Thank you very much for your help :-)
Walter
--
Aufgepasst: Sind Ihre Daten beim Online-Banking auch optimal geschützt?
Jetzt absichern: https://homebanking.gmx.net/?mc=mail@...
_______________________________________________
TYPO3-team-extension-coordination mailing list
TYPO3-team-extension-coordination@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-extension-coordination