[TYPO3-mvc] help to n:m relation

Ismaël Bidau bidau at ensci.com
Tue Feb 22 10:12:17 CET 2011


Hi,

I'm starting to learn Extbase an Fluid.
I would like to save a n:m relation.

For my project, I've create a student repository and university repository.
In setup.txt, I've persistence.classes{
	Tx_...Domain_Model_Student.mapping.tableName = tx_student_list
	Tx_...Domain_Model_University.mapping.tableName = tx_university_list
}


1:m relation works
————————————
in tca, type=>'select', 'foreign_table'=>'tx_university_list'
in my model
	/**
	 * The university
	 *
	 * @var Tx_EnsciParty_Domain_Model_University
	 * @lazy
	 */
	protected $university;

I've the getter/setter defined
	/**
	 * Sets the university value
	 *
	 * @param Tx_EnsciParty_Domain_Model_University $university
	 * @return void
	 */
	public function setUniversity(Tx_EnsciParty_Domain_Model_University 
$university) {
		$this->university = $university;
	}

	/**
	 * Returns the university value
	 *
	 * @return Tx_EnsciParty_Domain_Model_University
	 */
	public function getUniversity() {
		return $this->university;
	}


BUT I want to save university for a student with intermediate table.

n:m relation
————————————
in tca, type=>'inline', 'foreign_table'=>'tx_student_university', 
'foreign_field' => 'uid_local'

HOW TO ?

Thanks for your help

Ismaël BIDAU


More information about the TYPO3-project-typo3v4mvc mailing list