[TYPO3-mvc] Extensionbuilder relation question
Jan Kornblum
jan.kornblum at gmx.de
Thu May 2 17:27:00 CEST 2013
Hi all,
i think i've found the solution to get a n:1 relation work from the
opposite side:
> 1. Adding the missing "int(11) not null default 0" field to
> "tx_domain_model_category"
>
> 2. Adding $this->products, SetProducts(), GetProducts(), AddProduct(),
> RemoveProduct() methods in the CategoryModel.php
>
> 3. Adding a field (config->type = passthrough) to the "Category"-TCA
"config->type" must be "inline" or "select".
> I've recognized that when the additional TCA field
> "products" inside the TCA of "Category" is changed to "inline" instead of
> "passthrough", and Product-records are created inside the category-record
> using the IRRE form, they can be accessed by $category->getProducts()
> correctly. But when i just create a "Product" record and choose a "Category"
> by the selectbox, this Product cannot be accessed by
> $category->getProducts()...
Both "foreign_table" AND "foreign_field" must be set inside the
config-section of the "Category" model TCA.
Regards, Jan
More information about the TYPO3-project-typo3v4mvc
mailing list