[TYPO3-workspace] IRRE + workspace

Stephan Ude ude at mediatis.de
Mon Mar 4 16:19:48 CET 2013


Hello List,

I am trying to figure out how to use IRRE in combination with workspaces.

My environment:
typo3 4.5.22
extbase 1.3.4, fluid 1.3.1 (my problem-extension doesn't use it though)
version 4.5.20



I have built an extension (no extbase/fluid) with a record which contains content elements (tt_content) via IRRE, so it's an inline 1:n relation. I am using an mm table for these relations to fix another problem I've had. Here is the TCA of the attribute in my record:

	'contentelements' => array(
		'exclude' => 1,
		'label' => 'content elements',
		'config' => array(
			'type' => 'inline',
			'foreign_table' => 'tt_content',
			'MM' => 'tx_foo_bar_mm_content',
			'MM_match_fields' => array(
				'tablenames' => 'tt_content',
			),
			'minitems' => 0,
			'maxitems' => 999,
			'appearance' => array(
			'showAllLocalizationLink' => 1,
				'showPossibleLocalizationRecords' => 1,
				'showRemovedLocalizationRecords' => 1,
			),
			'behaviour' => array(
				'localizeChildrenAtParentLocalization' => true,
				'localizationMode' => 'select',
			),
		),
	),


I'm also adding the column to the TCA of tt_content (even though it's not shown in the backend or stored in the database!). I needed to do this so that the relation is updated when a content element is being published.

	$newColumn = array(
		'tx_foo_bar' => array(
			'label' => 'bar',
			'config' => array(
				'type' => 'select',
				'foreign_table' => 'tx_foo_bar',
				'MM_opposite_field' => 'contentelements',
				'MM' => 'tx_foo_bar_mm_content',
				'MM_match_fields' => array(
					'tablenames' => 'tt_content',
				),
				'size' => 5,
				'maxitems' => 999,
			),
		    )
	);
	t3lib_extMgm::addTCAcolumns('tt_content', $newColumn, 1);
	t3lib_extMgm::addToAllTCAtypes('tt_content', 'tx_foo_bar', '1');


Last but not least I am using an IRRE patch which I described here:
http://forge.typo3.org/issues/38703#note-2


It took some time to figure out this configuration and I hope, it is correct so far.
Unfortunately the above patch alone does not do the trick. Here are the problems, I am facing:


When I enter a workspace, edit a record with an inline content element and save the record, everything seems to be okay.
Then - when I publish first the content element and then the record, it's still all good. Same thing if I first publish the record and then the content element.
But when I bulk-publish both together then afterwards the mm table holds a row with a pointer to the live version of the record (still correct) and to an old version of the content element (pid=-1, t3ver_wsid=0, not correct).

The difference between the workflows, I figured out so far, lies in t3lib_TCEmain::version_remapMMForVersionSwap, where the (live) ID of the content element is chosen to be swapped in the bulk-publish while it is not if I publish record and content element one by one.
This decision is made by the class t3lib_loadDBGroup (a "dbAnalyzer"). But for me it's a little bit weird in there and I couldn't get very deep into it, yet.


If I leave out the additional TCA configuration for tt_content, this bug is gone but the relation for content elements which are created in a workspace and then be published have this same problem (mm table points to the old version of the content element, which - as far as I know - doesn't even exist in the database anymore). So I think the table tt_content must know that there is this relation and that it has to update it on publishing a content element.


That's pretty much all I got. I'm not sure how to get on this problem. Not sure if my configuration is correct and debugging is hard because sometimes I can't really say if a behavior is intended or if it is part of the problem.
I am thankful for hints in any direction.


Regards
Stephan



More information about the TYPO3-team-workspace mailing list