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

mario chiari m at mariochiari.net
Sun Jun 19 18:41:56 CEST 2011


Dear Franz

thanks so much for your reply.
Indeed, I start to be able to do something.
A few comments, maybe they could be useful to some other newbie. 

On Fri, 2011-06-17 at 10:02 +0200, Franz Koch wrote:
> 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.

Yes, of course. I was just trying a basic example. Anyway, I have
modified it. Now I have:

Object: Author  (entity); Properties: Name and Comment; relation Book
m:n to Book.
Object: Book (entity); Properties: Title and Comment; (no relation)

then something like the following works pretty well:

Resources/Private/Templates/Author/List.html
<f:for each="{authors}" as="author">
	... {author.name} ...
<f:for each="{author.book}" as="book">  
... {book.title} ...
</f:for>
</f:for>

Very Nice!!


> > 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.
> 

Ext Builder does not provide a flexForm (or at least I don't see that it
does). Looking at
https://svn.typo3.org/TYPO3v4/Extensions/ballroom_dancing/ 
(not on TER? not at http://git.typo3.org/?), I hacked their
flexform .xml file. It seems I need to insert a few lines within
ext_table.php too (do I?)

$pluginSignature = str_replace('_','',$_EXTKEY) . '_' . <myext>;
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
t3lib_extMgm::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' .
$_EXTKEY . '/Configuration/FlexForms/flexform_' .<myext>. '.xml');

Indeed Ext Builder provides these lines, you just need to uncomment
them. 


> 
> > -- 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.)

Ext Builder does the latter. For the former TCA issue, I need to look at
how to configure the foreign_selector, don't I?  


> 
> > 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/

Books

    * [German] Up to date german book on ExtBase
    * [German] TYPO3 Extension development book with big ExtBase area
    * [German] Great free ExtBase Book by Mittwald


aachhhh - perchè scrivete ancora in tedesco? :-)
Looking for the complete translations.


I hope to have some more questions soon
My best wishes and regards

mario






More information about the TYPO3-project-typo3v4mvc mailing list