[TYPO3-mvc] 1 to many relation

Kay Strobach typo3 at kay-strobach.de
Thu Jan 17 06:26:54 CET 2013


Hello Federico,

ok, if a product just can have a single categorie, take a look on the
solution of Christian - hi simply adds a categorie property to each
product and uses find by value ...

In the TCA docs are example on how to store nested categories etc. so
you may also use the predefined tree selector ;)

Regards
Kay

Am 16.01.13 11:21, schrieb Federico Bernardin:
> Hi Key,
> I don't think is a m:n relations because product can have only one category.
> 
> I should create  a menu with all category and show all products inside each category. The category tree is one level depth.
> The problem is in TCA because I want to have a selectbox into product object to choose its category. But I don't want to have anything into category object. The relation should be product->category and extbase should extract related products when I execute a select in category repository. 
> I think this could not be possible, isn'it?
> 
> Thanks
> Federico
> 
> 
> Il giorno 16/gen/2013, alle ore 09:44, Kay Strobach <typo3 at kay-strobach.de> ha scritto:
> 
>> It is an m to n relation. Is possible in flow / extbase i doubt there
>> was an example in the docs.
>>
>> I think you need to store e.g. the categorie id's in the product.
>> Than you can iterate over the products to show all products of a
>> category. Additionally the product nows all it's categories.
>>
>> To improve speed it could also be sensefull to just store the
>> information in the categorie and do it vice versa.
>>
>> Regards
>> Kay
>>
>> Am 15.01.13 14:36, schrieb Federico Bernardin:
>>> Hi,
>>> I develop a plugin with 2 entities:
>>> category and product.
>>> I need to know what is the category when a product is chosen and I need to know what are products related when one category is chosen.
>>> The relation is 1 category many products.
>>> I have created category property into product entity.
>>>
>>> How can access the list of product when I know only category entity?
>>> Should I create a property to map the relation between category and product in category entity?
>>>
>>> Thanks
>>> Federico
>>>
>>
>>
>> -- 
>> http://www.kay-strobach.de - Open Source Rocks
>>
>> TYPO3 .... inspiring people to share!
>> Get involved: http://typo3.org
>>
>> Answer was useful - feel free to donate:
>>  -
>> https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KPM9NAV73VDF2
>>  - https://flattr.com/profile/kaystrobach
>>
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
> 


-- 
http://www.kay-strobach.de - Open Source Rocks

TYPO3 .... inspiring people to share!
Get involved: http://typo3.org

Answer was useful - feel free to donate:
  -
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KPM9NAV73VDF2
  - https://flattr.com/profile/kaystrobach



More information about the TYPO3-project-typo3v4mvc mailing list