[TYPO3-ect] Best way to access request parameters from model?

Daniel Pötzinger operation-lan at gmx.de
Wed Oct 3 19:51:46 CEST 2007


> A) Accessing the paramaters directly:
> =====================================
of course not :-)
> 
> 
> B) Taking parameters from a given request object:
> =================================================
> 
> $uid = $this->parameters->get('uid');
> $title = $this->parameters->get('title');

I also like this most.
Its also like planned in 5.0 like I understand -> so you have a request 
Object, which holds all the datas which are relevant for the request.


> B) SPL Style:
> =============
> 
> In the controller something like this:> 
> $model->exchangeArray($validator); // Validated parameters in there.

I dont like this:
- not very clear and readable in my eyes to have parameters in the model 
called by $this['something']
- $this[] maybe reserved to have other things (like list of sub models)

Overall I dont get used - using the iterator everywhere in lib/div 
objects (like in view/ model classes) just because its more clear to 
read something like
$this->listItems[]  (where listItem is object with spl array)
or
$this->data[] (where data is object with spl array)

> C) Let's call it traditional:
> =============================
> 
> For example with dedicated setter methods:
> 
> $model->setUid(...);
> $model->setTitle(...);
> ....
Hmm I also like it because:

The class will be more maintainable if using a well defined API of 
getter and setters - instead of reading everywhere in the model form 
$this->parameters

 > D)
Dont like this.


More information about the TYPO3-team-extension-coordination mailing list