[TYPO3-ect] MVC Project
Michael Scharkow
mscharkow at gmx.net
Wed Feb 1 21:39:40 CET 2006
Jeff Segars wrote:
> The general idea with our mapper (called tcaObj) is that the TCA already
> contains the info we need to read and write data from the database
> (table name, field names, field types, validation requirements, etc).
> The backend proves this with the use of TCEMain and TCEForms.
Yes, I've also mentioned this in the past discussions.
> What we're doing is very similar to what the backend does, but is
> wrapped in objects instead. Each tables within the TCA is available as
> an object, and each column within a TCA entry is a dynamically created
> object with getters and setters. find(), findAll() and save() methods
> are available to transfer the data between the database and the object
> model.
>
> I've put a couple code examples below to try to demonstrate the
> direction we're heading. Does this match up with anything you've been
> thinking about for possible use in the MVC project?
Jeff, this is awesome news! I was going to work on exactly this after my
thesis is done (still a long way to go), but the similarities are really
striking (btw. even my class is called TCAobject ;)).
I'd be very curious to see more of your code and I am really confident
that this will be a nice base for 5.0 core. As I am not in the R&D-Team,
I can't give any official statement, but I know that Kasper very much
supports this approach.
I don't know how far you are with this, but it looks absolutely promising.
> $user = tx_tcaobj::find(3); // Returns the user object with ID 3
> $user->username->getValue() => "jeff"
> $user->email->getValue() => "jeff at email.com"
>
> $user->username->setValue() => "jsegars"
> $user->save(); // Saves user object back to database
My (dummy) code looks extremely similar to this, although the above
misses the table parameter in the constructor (which TCA should be used
for the model).
Second, do you have separate classes for every column? E.g. wouldn't it
be even more elegant if you could just do
$user->username = "michael";
$user->save();
Anyway, these are details. We should definitely move this issue out of
ECT and into -dev, as it is a core issue.
Ethusiastic greetings,
Michael
More information about the TYPO3-team-extension-coordination
mailing list