[TYPO3-ect] tcaObjects WAS: MVC Project

Jeff Segars jsegars at alumni.rice.edu
Mon Feb 6 20:31:07 CET 2006


Hey Elmar,
Thanks for posting your thoughts and for relating this to so many of the 
other projects discussed around here.

> I waited a few days, to think about the relation of MVC, tcaObjects, the tca
> driven forms library and Ernestos proposal of using cObjects as replacement of
> classic ###-markers.

Thanks for the pointer to Ernesto's proposal.  It seems like his 
approach may fit very well with atcaObject-created model.

> After all I think tcaObjects is related to MVC but it is not the same and it is
> not the opposite. It is simple another matter. I think tcaObjects are such
> important that they deserve their own thread.

I think the relationship between tcaObjects and MVC is the biggest 
question that needs discussing.  I view it as pretty complete solution 
to the model portion of MVC, but I may be missing some limitations. 
More comments on that below....

> +------------------------------------------------------
> Model:
> +------------------------------------------------------
> 
> * They partly define the model. One tcaObject contains information about the
> dataformat of one table.
> * They carray inormation of relations to other tables. Together they define all
> realations.
> * They can query one table.

tcaObjects can actually contain many child tcaObjects. As an example, a 
frontend user contains many groups.  Each of those groups is represented 
by a tcaObject that can be accessed through the parent object.

$user = tx_tcaobj::find(3);
$user->groups->getObjects() => Array of tcaObjects
$user=>groups->getObjcts()[0]->title->getValue() => "My Group Title"

> +------------------------------------------------------
> View:
> +------------------------------------------------------
> 
> * They define a part of the view. They contain informations how to transform the
> data to a human readable format and back again.
> * They contain information how to validate inputs.

My opinion is that tcaObjects live completely in the model.  You are 
correct that they do contain validation, but I view validation as part 
of the model (borrowing from Rails and ActiveRecord again).  Regardless 
of what view I'm accessing the data through, the same requirements for 
the model still hold so those requirments should be stored in the model.

Other than validation, are there any items in the TCA that would live in 
the view?

> +------------------------------------------------------
> Limitations:
> +------------------------------------------------------
> 
> * They can't build detailed complex joins themslevs, but thay could pack the
> results of join queries. That is the reason why they only can be one part of the
> model with complex queries.

This is correct.  Basic joins like you can already perform with 
TCEMain/TCEForms are possible, but more complex joins require custom code.

> * You could use them for 100% of TYPO3 BE form and for 80% - 95% of TYPO3 FE
> forms, but there keeps a rest, where it comes to comples joins.

One nice thing with the tcaObject approach, is that you can still use 
modified tcaObjects for that 20% that doesn't work automatically.  Since 
everything is object based, it is possible to override the default find 
methods or provide additional methods that use more complex queries.

> The important target you should allways have in mind is how we can integrate it
> all in the best way into TYPO3 development without doing work in double. We need
> to think of an overall organizational structure of this complex field.

Totally agree here!  This is definitely shared code between the core and 
extensions.



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