[TYPO3-mvc] Left join query

Daniel Dimitrov danielsd_bg at yahoo.fr
Fri Jun 25 16:05:57 CEST 2010


Hey Franz,

"Franz Koch" <typo3.RemoveForMessage at elements-net.de> wrote in message 
news:mailman.1.1277470576.16502.typo3-project-typo3v4mvc at lists.typo3.org...
> Hi,
>
>>>> /**
>>>> *
>>>> * @var Tx_BwShop_Domain_Model_Products
>>>> * @lazy
>>>>
>>>> */
>>>> protected $products;
> ...
>>> Hm. Maybe it got lost, but from above you need to at least change your
>>> annotations for $products:
>>> ---
>>> erm, as there is more then one product it would make sense to use an
>>> objectStorage ;-)
>> what should be my annotation? If I set it to objectStorage - is extbase
>> going to return an array with all objects?
>
> * @var 
> Tx_Extbase_Persistence_ObjectStorage<Tx_BwShop_Domain_Model_Product>
> * @lazy
>
>> If you look at my previous e-mail the vard dump of $products is showing
>> this:
>> ["propertyName:private"]=>
>> string(8) "products"
>> ["fieldValue:private"]=>
>> string(1) "7"
>>
>> what is FieldValue here? I'm asking because the products with the
>> keyword searched for are exactly 7.
>
> possible - as long as you don't have a annotation extbase can deal with 
> you'll get the raw DB value - which in case of TYPO3 is the number of 
> relations.
>
>> Also even if I manage to show all products for a keyword I'm really
>> concerned with the performance.
>> For a single keyword I can have 10 000 products - is extbase going to
>> return them all?
>
> Yes, you will get ALL objects, as all objects are related to that keyword. 
> If that doesn't work for you with having 10.000 products on a keyword, you 
> have to find a different way, maybe by using a productsService returning 
> only a limited subset of the assigned products using a special method of 
> your productRepository (like 
> $this->productRepository->findByKeyword($keyword, $offset, $limit)).
Ok, that is actually the problem

if I write my own function findByKeyword - i have to make somehow a join 
there.
keyword -> mm_table -> products.

with this
$keyword = $this->keywordsRepository->findByUid($this->filter['kw']);
$products = $keyword->getProducts();
extbase resolved the products on its own. Now if I wish to use repository 
function I have to write
that join query and this is something that I don't understand how to do.

>
> -- 
> kind regards,
> Franz Koch

Regards,
Daniel 



More information about the TYPO3-project-typo3v4mvc mailing list