[TYPO3-mvc] Connecting 2 objects results in blank output...
Franz Koch
typo3.RemoveForMessage at elements-net.de
Wed Sep 8 10:17:21 CEST 2010
Hey guys,
> My TCA , extending the fe_user tca is:
> 'addresses' => array(
> 'exclude' => 1,
> 'label' =>
> 'LLL:EXT:rm_community_user/Resources/Private/Language/locallang_db.xml:tx_rmcommunityuser_domain_model_user.addresses',
>
> 'config'
> => array(
> 'type' => 'inline',
> 'size'
> => '5',
> 'multiple' => 1,
> 'foreign_table' => 'tx_rmcommunityuser_user_address_mm',
> 'foreign_field' => 'uid_local',
> 'foreign_selector' => 'uid_foreign',
> 'foreign_sortby' => 'sorting',
> 'foreign_label' => 'uid_foreign',
> 'foreign_unique' => 'uid_foreign',
> 'appearance' => array(
> 'useCombination' => 1,
> 'useSortable' => 1,
> 'collapse' => 1,
> 'expandSingle' => 1,
> 'newRecordLinkPosition' => 'bottom',
> ),
> 'maxitems' => 9999
> )
> ),
Are your address records only related to fe_users, or do you also assign
them to other objects? And more important - do you need to assign THE
SAME address to multiple objects? If not, there is absolutely no need
for a MM table here and you could directly assign your addresses via
IRRE and foreign_field. If you assign them to various objects (users,
companies, ...) then you also would ahve to use the foreign_table_field
option of IRRE.
So for most flexibility you could do this:
-- ext-tables.sql --------------
CRATE TABLE tx_rmcommunityuser_domain_model_address {
parent_id int(11) unsigned NOT NULL,
sorting int(11) unsigned NOT NULL,
## only needed if address is getting assigned to different models
parent_table varchar(100) DEFAULT '' NOT NULL
}
-- TCA -------------------------
$TCA['tx_rmcommunity_domain_model_user']['columns']['addresses'] => array(
'exclude' => 1,
'label' => '...',
'config' => array(
type' => 'inline',
'foreign_table' => 'tx_rmcommunityuser_domain_model_address',
'foreign_field' => 'parent_id',
'foreign_sortby' => 'sorting',
'appearance' => array(
'useSortable' => 1,
'collapseAll' => 1,
'expandSingle' => 1,
),
// only needed if address is getting assigned to different models
'foreign_table_field' => 'parent_table',
),
);
HTH.
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list