[TYPO3-dev] Defining relations for Model Object in extension builder
Rakesh Dodda
rakeshdodda.rd at gmail.com
Mon Jun 24 10:09:11 CEST 2013
Hi all,
I'm having some trouble defining relations for an extension I created.
The extension I created is named "MyExt" . It has a relation named as
"Department_Id" and is of type "m:n".
My intention is to map this relation to an already existing table without
creating any extra table. Hence, I did not give any table related to this
relation.
My extension now in the backend has these tables
1. MyExtTable
2. MyExtTable__mm
In my TCA form, for the "Depratment_Id", I assigned foreign_table to the
respective table I wanted to map to, that is DeparmentTable.
The MyExtTable has a column "Department_Id" and it contains the total
number of departments associated to the table.
*The Problem:*
*
*
The Problem is that, when I try to access or retrieve the records from
MyExtTable using the model created, I get an error retrieving the data for
"Department_Id" as it was never mentioned that "MyExtTable__mm" has
relation between "MyExtTable" and "DepartmentTable"
/**
* Returns the DepartmentId
*
* * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<> *departmentId
*/
public function getDepartmentId() {
return $this->departmentId;
}
In the above code, in the comments it can be seen that the model is not
defined and thus it does not know where to look for.
Where should I define this relation in the model ?
Thank you patiently reading the issue.
--
Regards,
Rakesh Dodda
More information about the TYPO3-dev
mailing list