[TYPO3-mvc] Storing related records via MM table won't work

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Sat Jun 2 02:24:54 CEST 2012


Hi guys,

trying now for several hours with different
combinations of TCA configurations but my
records relations via MM table won't work.

The properties relating the records to
each other are match_log.result and match_result.log.

Here is my configuration.
Can you maybe spot a mistake?

Did I miss something to enable
working relations via MM table with extbase?

PS: I also tried using type "select" instead
of type "group/db" - same result. This is what
happens:

MM table stays empty. (no records)
Field match_result.log is populated with the foreign match_log.uid.
Field match_log.result stays empty. (value: 0)

Thanks a lot!

SQL
--------------------------------------------------
# Match Log
CREATE TABLE tx_hypegaming_domain_model_match_log (
	uid int(11) NOT NULL auto_increment,
	pid int(11) DEFAULT '0' NOT NULL,

	result int(11) unsigned DEFAULT '0' NOT NULL,

	tstamp int(11) unsigned DEFAULT '0' NOT NULL,
	crdate int(11) unsigned DEFAULT '0' NOT NULL,
	cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
	deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
	hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
	starttime int(11) unsigned DEFAULT '0' NOT NULL,
	endtime int(11) unsigned DEFAULT '0' NOT NULL,
	edit_lock tinyint(1) unsigned DEFAULT '0' NOT NULL,

	t3ver_oid int(11) DEFAULT '0' NOT NULL,
	t3ver_id int(11) DEFAULT '0' NOT NULL,
	t3ver_wsid int(11) DEFAULT '0' NOT NULL,
	t3ver_label varchar(255) DEFAULT '' NOT NULL,
	t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
	t3ver_stage int(11) DEFAULT '0' NOT NULL,
	t3ver_count int(11) DEFAULT '0' NOT NULL,
	t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
	t3ver_move_id int(11) DEFAULT '0' NOT NULL,

	t3_origuid int(11) DEFAULT '0' NOT NULL,
	sys_language_uid int(11) DEFAULT '0' NOT NULL,
	l10n_parent int(11) DEFAULT '0' NOT NULL,
	l10n_diffsource mediumblob,

	PRIMARY KEY (uid),
	KEY parent (pid),
	KEY t3ver_oid (t3ver_oid,t3ver_wsid),
	KEY language (l10n_parent,sys_language_uid)
);

# Match Result
CREATE TABLE tx_hypegaming_domain_model_match_result (
	uid int(11) NOT NULL auto_increment,
	pid int(11) DEFAULT '0' NOT NULL,
	
	log int(11) DEFAULT '0' NOT NULL,

	tstamp int(11) unsigned DEFAULT '0' NOT NULL,
	crdate int(11) unsigned DEFAULT '0' NOT NULL,
	cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
	deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
	hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
	starttime int(11) unsigned DEFAULT '0' NOT NULL,
	endtime int(11) unsigned DEFAULT '0' NOT NULL,
	edit_lock tinyint(1) unsigned DEFAULT '0' NOT NULL,

	t3ver_oid int(11) DEFAULT '0' NOT NULL,
	t3ver_id int(11) DEFAULT '0' NOT NULL,
	t3ver_wsid int(11) DEFAULT '0' NOT NULL,
	t3ver_label varchar(255) DEFAULT '' NOT NULL,
	t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
	t3ver_stage int(11) DEFAULT '0' NOT NULL,
	t3ver_count int(11) DEFAULT '0' NOT NULL,
	t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
	t3ver_move_id int(11) DEFAULT '0' NOT NULL,

	t3_origuid int(11) DEFAULT '0' NOT NULL,
	sys_language_uid int(11) DEFAULT '0' NOT NULL,
	l10n_parent int(11) DEFAULT '0' NOT NULL,
	l10n_diffsource mediumblob,

	PRIMARY KEY (uid),
	KEY parent (pid),
	KEY t3ver_oid (t3ver_oid,t3ver_wsid),
	KEY language (l10n_parent,sys_language_uid)
);

#
# Match Log <-> Match Result
#
CREATE TABLE tx_hypegaming_relation_matchlog_matchresult (
	uid int(11) NOT NULL auto_increment,
	pid int(11) DEFAULT '0' NOT NULL,
	uid_local int(11) DEFAULT '0' NOT NULL,
	uid_foreign int(11) DEFAULT '0' NOT NULL,
	tablenames varchar(64) DEFAULT '' NOT NULL,
	sorting int(11) DEFAULT '0' NOT NULL,
	sorting_foreign int(11) DEFAULT '0' NOT NULL,

	PRIMARY KEY (uid),
	KEY parent (pid)
);
--------------------------------------------------

TCA
--------------------------------------------------
# Match Log
$TCA['tx_hypegaming_domain_model_match_log'] = array(
   'columns' => array(
     'result' => array(
       'config' => array(
         'type' => 'group',
         'internal_type' => 'db',
         'allowed' => 'tx_hypegaming_domain_model_match_result',
         'foreign_table' => 'tx_hypegaming_domain_model_match_result',
         'MM' => 'tx_hypegaming_relation_matchlog_matchresult',
         'size' => 1,
         'minitems' => 0,
         'maxitems' => 1,
       ),
     ),
   ),
);

# Match Result
$TCA['tx_hypegaming_domain_model_match_result'] = array(
   'columns' => array(
     'log' => array(
       'config' => array(
         'type' => 'group',
         'internal_type' => 'db',
         'allowed' => 'tx_hypegaming_domain_model_match_log',
         'foreign_table' => 'tx_hypegaming_domain_model_match_log',
         'MM' => 'tx_hypegaming_relation_matchlog_matchresult',
         'MM_opposite_field' => 'result',
         'size' => 1,
         'minitems' => 1,
         'maxitems' => 1,
       ),
     ),
   ),
);
--------------------------------------------------

TYPOSCRIPT
--------------------------------------------------
config.tx_extbase {
   features {
     skipDefaultArguments = 1
     rewrittenPropertyMapper = 1
   }

   persistence {
     classes {
       Tx_HypeGaming_Domain_Model_MatchLog {
         mapping {
           tableName = tx_hypegaming_domain_model_match_log

           columns {
             starttime.mapOnProperty = startTime
             endtime.mapOnProperty = endTime
             cruser_id.mapOnProperty = creationUser
             crdate.mapOnProperty = creationDate
             tstamp.mapOnProperty = modificationDate
             sys_language_uid.mapOnProperty = language
             fe_group.mapOnProperty = frontendUsergroups
           }
         }
       }

       Tx_HypeGaming_Domain_Model_MatchResult {
         mapping {
           tableName = tx_hypegaming_domain_model_match_result

           columns {
             starttime.mapOnProperty = startTime
             endtime.mapOnProperty = endTime
             cruser_id.mapOnProperty = creationUser
             crdate.mapOnProperty = creationDate
             tstamp.mapOnProperty = modificationDate
             sys_language_uid.mapOnProperty = language
             fe_group.mapOnProperty = frontendUsergroups
           }
         }
       }
     }
   }
}
--------------------------------------------------

Regards,
Thomas


More information about the TYPO3-project-typo3v4mvc mailing list