[TYPO3-mvc] Need a little more help to show some mm-relation info
Thomas "Thasmo" Deinhamer
thasmo at gmail.com
Fri Apr 16 00:18:20 CEST 2010
Did you set a property 'departments' inside the person model?
Thomas
Am 16.04.2010 00:01, schrieb Mario Beiser:
> Hi there,
>
> have to stress the list again with some mm-relation problems.
> I looked through the blogexample and some other extensions, but at the
> moment I can't manage it
> to show some mm-relational data in my fe-extension.
>
> Following table structure:
>
> 1. Model: person
> 2. Model: department
> MM-Relational-Table: department_person_mm
>
> Goal: Got a PersonController and print all persons in a listview.
> Now I want to print the name of all departments the person belongs to
> below the name of the person.
> --> index.html of PersonController
>
> Model person:
>
> /**
> * @var Tx_Test_Domain_Model_Department
> * @lazy
> */
> protected $department
>
> /**
> * Sets the department this person belongs to
> *
> * @param Tx_Test_Domain_Model_Department $department The department
> * @return void
> */
> public function setDepartment(Tx_Test_Domain_Model_Department
> $department) {
> $this->department = $department;
> }
>
> /**
> * Returns the department this person belongs to
> *
> * @return Tx_Test_Domain_Model_Department
> */
> public function getDepartment() {
> if ($this->department instanceof Tx_Extbase_Persistence_LazyLoadingProxy) {
> $this-> department->_loadRealInstance();
> }
> return $this-> department;
> }
>
> TCA of Tx_Test_Domain_Model_Person:
>
> 'department' => Array (
> 'exclude' => 1,
> 'label' => 'Department', // Just example code
> 'config' => Array (
> 'type' => 'select',
> 'foreign_table' => 'tx_blogexample_domain_model_department',
> 'maxitems' => 1,
> )
> ),
>
> Now I added {person.department.name} in my template, but nothing is shown.
> Do I have to configure anything else? ATM I just stuck a little bit.
>
> Perhaps someone can help me...
> Mario
More information about the TYPO3-project-typo3v4mvc
mailing list