[TYPO3-mvc] Record Relation to tt_content

Matthias Krappitz matthias at nospam.aemka.de
Wed Jul 27 16:10:21 CEST 2011


Hi,

I'm doing my first extbase project. I'm having project records that contain 
tt_content records for description. So far so good. As I can't just relate 
my project records to tt_content in EXT:extension_kickstarter, I created a 
dummy table "content" in the kickstarter, did the relation from a project to 
this dummy table and in TCA and Typoscript I changed the table to 
tt_content. When I assign tt_content to the project via IRRE, it saves. But 
when I just want to output the uids of the assigned records in fluid there 
is no tt_content in the ObjectStorage.

Classes/Domain/Model/Project.php:
----------------
class Tx_Nhb_Domain_Model_Project extends 
Tx_Extbase_DomainObject_AbstractEntity {

...

	/**
	 * Content
	 *
	 * @var Tx_Extbase_Persistence_ObjectStorage<Tx_Nhb_Domain_Model_Content> 
$content
	 */
	protected $content;

...

                /**
	 * Returns the content
	 *
	 * @return 
Tx_Extbase_Persistence_ObjectStorage<Tx_Nhb_Domain_Model_Content> $content
	 */
	public function getContent() {
		return $this->content;
	}

...

}

Classes/Domain/Model/Content.php:
----------------
class Tx_Nhb_Domain_Model_Content extends 
Tx_Extbase_DomainObject_AbstractValueObject {

	/**
	 * __construct
	 *
	 * @return void
	 */
	public function __construct() {

	}

}

Typoscript:

plugin.tx_nhb {
	persistence {
		classes {
			Tx_Nhb_Domain_Model_Content {
				mapping {
					tableName = tt_content
					recordType = Tx_Nhb_Domain_Model_Content
					columns {
					}
				}
			}
		}
	}
}

TCA:
----------------
$TCA['tx_nhb_domain_model_project'] = array(
...
	'columns' => array(
...
		'content' => array(
			'exclude' => 0,
			'label' => 
'LLL:EXT:nhb/Resources/Private/Language/locallang_db.xml:tx_nhb_domain_model_project.content',
			'config' => array(
				'type' => 'inline',
				'foreign_table' => tt_content',
				'foreign_field' => 'project',
				'maxitems'      => 9999,
				'appearance' => array(
					'collapse' => 0,
					'levelLinksPosition' => 'top',
					'showSynchronizationLink' => 1,
					'showPossibleLocalizationRecords' => 1,
					'showAllLocalizationLink' => 1
				),
			),
		),

...

	),
);

SQL:
----------------
CREATE TABLE tt_content (
	project int(11) unsigned DEFAULT '0' NOT NULL
);

ext_tables.php:
----------------
t3lib_div::loadTCA('tt_content');
$TCA['tt_content']['columns']['project']['config']['type'] = 'passthrough'; 



More information about the TYPO3-project-typo3v4mvc mailing list