[TYPO3-mvc] IRRE and intermediate tables

Dominique Feyer dominique.feyer at reelpeek.net
Sun Sep 4 17:09:53 CEST 2011


When i read this message i think that extbase work with an IRRE
intermediate table, but not ... wiht me ;)

Here is my TCA:

'tours' => array(
	'exclude' => 0,
	'l10n_mode' => 'exclude',
	'label' => 'Tours',
	'config' => array(
		'type' => 'inline',
		'foreign_table' => 'tx_pucapi_domain_model_tourperformance',
		'foreign_field' => 'uid_foreign',
		'foreign_label' => 'uid_local',
		'maxitems' => 99999
	),
),

The backend work nicely, but in FE, I have an SQL error:

Unknown column 'tx_pucapi_domain_model_tour.uid_foreign' in 'where clause'

So extbase is searching in the destination table the field uid_foreign,
but this field is on the intermediate table.

Any hints ?

Thanks


Jochen Rau wrote:
> Hi.
> 
> There were several discussions in this group about how to configure IRRE
> with intermediate tables.
> 
> [TYPO3-mvc] IRRE intermediate tables
> [TYPO3-mvc] IRRE foreign_selector ("associative entity")
> [TYPO3-mvc] Attributes on irre-relations possible?
> 
> With the latest revision of Extbase the problems related to these topics
> are (hopefully) resolved.
> 
> IRRE allows two ways to use an "intermediate" table. Let's see how the
> "tags" column of the table tx_blogexample_domain_model_post can be
> configured using IRRE. Keep in mind that we have a m:n-relation (a post
> may have several tags and a tag may be assigned to several posts) and
> that these configurations are minimalistic.
> 
> 1)
> 
> 'tags' => array(
>     'label' => 'Tags',
>     'config' => array(
>         'type' => 'inline',
>         'foreign_table' => 'tx_blogexample_post_tag_mm',
>         'foreign_field' => 'uid_local',
>         'foreign_selector' => 'uid_foreign'
>     )
> ),
> 
> 
> 2)
> 
> 'tags' => array(
>     'label' => 'Tags',
>     'config' => array(
>         'type' => 'inline',
>         'foreign_table' => 'tx_blogexample_domain_model_tag',
>         'foreign_field' => 'tx_blogexample_post_tag_mm',
>     )
> ),
> 
> 1) is described in the irre_tutorial, 2) in core documentation. Both are
> working in FE and BE now with Extbase. Some notes:
> 
> - The intermediate table in 1) isn't really an intermediate table. It's
> a foreign key relation where the foreign key (uid_local) is stored on
> the foreign table tx_blogexample_post_tag_mm. Only IRRE considers this
> as an "intermediate" table that can hold additional (domain related)
> fields.
> 
> - Using 1) you have to specify a foreign_selector (uid_foreign) to be
> able to edit the associated table tx_blogexample_domain_model_tag
> "through" the "intermediate" table tx_blogexample_post_tag_mm. Extbase
> doesn't support additional domain related data on an intermediate table.
> Implement a real domain model in this case (see thread [TYPO3-mvc] IRRE
> foreign_selector ("associative entity")).
> 
> - Having defined a foreign_label doesn't have any effect in Extbase now.
> 
> - It's recommend to use always the second configuration. Unfortunately,
> I didn't find a way in IRRE to have a foreign_selector in combination
> with real intermediate tables.
> 
> Please test the latest rev. of Extbase and report your results.
> 
> Regards
> Jochen
> 
> 


More information about the TYPO3-project-typo3v4mvc mailing list