[TYPO3-mvc] Question about relations

Kai kai.tallafus at gmx.at
Thu Mar 18 18:42:24 CET 2010


Hi Christine,

thank you, that helped! You were totally right and since this is a many to many relation i created an intermediate table and the TCA setup now looks like this:

'price' => array (
                    'exclude' => 0,
                    'label' => 'LLL:EXT:foo/Resources/Private/Language/locallang_db.xml:tx_foo_domain_model_product.price',
                    'config' => array (
                        'type' => 'select',
                        'foreign_table' => 'tx_foo_domain_model_bonusdollar',
                        'size' => 5,
                        'minitems' => 0,
                        'maxitems' => 99,
                        'multiple' => '1',
                        "MM" => "tx_foo_product_bonusdollar_mm",
                    )
                ),

In the product model class i further had to change the price property from Tx_Extbase_Persistence_ObjectStorage to ArrayObject, since ObjectStorage still gave me the 50 + 10 instead of 50 + 50 + 10. Is the ObjectStorage intended to behave like that?

Kai



Wednesday, March 17, 2010, 2:05:32 AM, you wrote:

> Hi Kai,

> In your Price class, is the bonusDollars property an ObjectStorage?  Object storages are only meant to contain one
> instance of an object, in which case you can change it to an array.  This has at least worked for me with MM tables
> defined in the TCA (and in your case.. shouldn't this also use a many to many table?)


> Hope that helps,
> Christine

> 2010/3/15 Kai 
> Hi all,

> I am building a small shop with extbase. Despite of paying a product with money, the customer can redeem sort of bonus points and and pay with them.
> The price of a product is composed of multiple "bonus point units", letŽs call them "BonusDollars". So if a product
> costs 110 bonus points the price is composed of 50 BonusDollars + 50 BonusDollars + 10 BonusDollars. (Each of them are
> displayed as coin icons in the shop)

> So we have the following structure: product HAS MANY bonusdollars

> To add the same units multiple times, I defined it as select with 'multiple' => '1':

'price' =>> array(
>                         'exclude' => 0,
>                         'label'   =>
> 'LLL:EXT:colteneshop/Resources/Private/Language/locallang_db.xml:tx_myshop_domain_model_product.price',
>                         'config'  => array(
>                                 'type' => 'select',
>                                 'foreign_table' => 'tx_myshop_domain_model_bonusdollar',
>                                 'maxitems'      => 9999,
>                             'size' => '5',
>                             'multiple' => '1',
>                         )
>                 ),


> My problem is how extbase collects the data for the related dollars during the mapping process.
> For a product which has 50 + 50 + 10 dollars i only get the relations for 50 and 10. As far as I can see this is
> due the fact that relations are fetched with a single sql statement like SELECT ... FROM table WHERE uid IN (...).

> Do I miss something or is there currently no solution for this?

> Btw. extbase is fun :-)

> Greets
> Kai
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc





  


More information about the TYPO3-project-typo3v4mvc mailing list