[Typo3-dev] RFC Forms, validation, etc. in 5.0

Michael Scharkow mscharkow at gmx.net
Mon Nov 21 11:01:14 CET 2005


Kasper Skårhøj wrote:

> Anyway, the approach I have been thinking of is to center forms generation, 
> validation etc. around data objects. 
> 
> Today we do:
> 
> $row = ....SELECT * FROM table WHERE uid=123
> print $row[$TCA['table']['ctrl']['title']]
> 
> Tomorrow we do:
> 
> $rowObj = new dataObject(table, uid)
> print $rowObj->getTitle()
> 
> The data object can also be used like this:
> 
> $rowObj->setField('title', 'My new title value');
> 
> or:
> 
> $rowObj->getFormElement('title');
> 
> As you can see the data object is the interface to updating, rendering forms, 
> reading out data, basically anything. And the data object knows its own TCA 
> structure (we might call it something different in the future).
> 
> Internally, there are of course other objects which do the actual form 
> rendering, validation etc., possibly by some design pattern which allows the 
> flexibility we need to use such objects at other locations separately - or 
> simply exchange them with something customized. 
> 
> Finally it should work the same in frontend and backend.
> 
> These are just my sketches for now. I'm not at all settled on a specific 
> solution, just wanted to let you know we are thinking in very alternative 
> direction. But it is long term and not something that will happen tomorrow 
> (5.0 this means, at earliest!)

Kasper, actually this is *completely* how I see this issue, too. So we 
are thinking in exactly the same direction. I am currently working on 
this MVC design, and I'm afraid a clean rewrite of the necessary 
components is necessary (because my brain explodes half-way through 
TCEMAIN).

This object-relational-mapping is the way to go, and very successfully 
done in Ruby on Rails (I wholeheartedly recommmend the book to anyone 
interested). The only difficulty if that with PHP you can't do all the 
niceness as

$rowobj->getTitle (because we can't have dynamic method calls)

but only

$rowobj->get('title')

but this is cool enough already. And working here with a <100 lines 
prototype.

Greetings,
Michael




More information about the TYPO3-dev mailing list