[TYPO3-mvc] two objects, I see only one

Franz Koch typo3.RemoveForMessage at elements-net.de
Fri Jun 17 10:02:18 CEST 2011


Hi Mario,

> Object: Book (entity); Properties: Title and Comment; relation: Author
> 1:1 to Author;
> Object: Author  (entity); Properties: Name and Comment; relation Book
> 1:1 to Book.

Using a 1:1 relation doesn't make sense in my eyes - a author can write 
more then one book, so it's more a 1:n relation.

> Thanks to Ext Builder, I am able to list Books in the FE, each with its
> title, comment, author.name, and author.comment.
>
> So far so good. Now, I miss to see:
>
> -- which piece of code is such that Book object is rendered, instead of
> the Author one;

Have a look at the ext_localconf.php. There your plugin is registered 
with all allowed controllers and actions. Extbase is by default 
rendering the first action of the first configured controller. If you 
like to change this, you can either configure 
"switchableControllerActions" manually for TS-only plugins instances, or 
configure those in your flexForm, by simply adding a select field with 
the XML tagname "switchableControllerActions". The select values 
themselfs have to look like 
"Controller1->Action1;Controller1->Action2;Controller2->Action1". You 
have to define all actions there you like to make use of in your plugin. 
So if you need a list and a detail view, you have to allow both there.


> -- a way to configure the plugin as to render either one of the two
> objects, or even both;

Use either the "switchableControllerActions" for this and add two select 
options allowing to switch between the "bookController" and the 
"authorController", or create a custom controller that can handle both 
and just add the necessary configuration fields to the flexForm.

> -- a way to configure the BE form as to select the author of a new book
> from the records of the Author table (is this just a TCA issue?)

This is a pure TCA issue. BUT - as mentioned above, an author could 
write more then a book, so you should change the type of relation in 
your author model+TCA (make the "books" property of the author model a 
Tx_Extbase_Persistence_ObjectStorage and configure the "books" column in 
TCA as "inline"/IRRE field.

> ps I am looking at
> http://flow3.typo3.org/documentation/manuals/fluid/fluid.usermanual/
> is there any other intro?

You could have a look at the wiki [1] or the official Extbase/Fluid book 
[2] (it's currently beeing translated to English)

[1] http://forge.typo3.org/projects/typo3v4-mvc/wiki
[2] 
http://www.amazon.de/Zukunftssichere-TYPO3-Extensions-mit-Extbase-Fluid/dp/3897219654/

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list