[TYPO3-english] Extbase file listing based on sys_category Typo3 6.2

Falk Gebauer fgebauer at 3pc.de
Fri May 22 11:40:34 CEST 2015


Please read again:

"The \TYPO3\CMS\Core\Category\Collection\CategoryCollection classe 
provides the API for retrieving records related to a given category. 
Since TYPO3 CMS 6.2, it is extended by 
class\TYPO3\CMS\Frontend\Category\Collection\CategoryCollection which 
does the same job but in the frontend, i.e. respecting all enable fields 
and performing version and language overlays."

But some thougts later i have a better solution, using the 
CategoryBasedFileCollection class.

Maybe like this:

// e.g. for category with uid 1
$categoryId = 1;

$collection = 
\TYPO3\CMS\Core\Resource\Collection\CategoryBasedFileCollection::load(
         $categoryId,
         TRUE
);

if ($collection->count() > 0) {
         foreach ($collection as $file) {

         }
}


Falk




Am 21.05.15 um 20:23 schrieb Arun Chandran:
> Hi Falk,
>
> I checked here, but here we get the category ids. I need the sys_file datas
> based on category. Is there any way to join the tables in extbase
> repository method?
>
> Thanks & Regards,
> Arun
>
> On Thu, May 21, 2015 at 10:03 PM, Falk Gebauer <fgebauer at 3pc.de> wrote:
>
>> Hi Arun,
>>
>> look here
>> http://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Categories/Index.html#categories-collections
>> .
>> This should help.
>>
>> Kind regards
>> Falk
>>
>>
>>
>> Am 21.05.15 um 18:10 schrieb Arun Chandran:
>>
>>   Hi Guys,
>>> I am trying to create a custom extension which can be used to display
>>> files
>>> in frontend based on sys_category. I can see that there is an
>>> "sys_category_record_mm" table managing the category assignment of files.
>>> This table contains uid_local ( uid of the category ) and uid_foreign (
>>> uid
>>> of the file ).
>>>
>>>
>>> I got all the sys_category uids from the table and I want to fetch the
>>> files from sys_file table based on sys_category_record_mm relation. I am
>>> using Typo3 Extbase Repository method and is there any default function to
>>> fetch these data from sys_file?
>>>
>>> $query = $this->createQuery();
>>> $query->statement();
>>>
>>> I know using $query->statement(), we can write manual queries. But is
>>> there
>>> any other method to join these tables to get the data by passing
>>> sys_category uid as an argument?
>>>
>>> Thanks,
>>> Arun.
>>> _______________________________________________
>>> TYPO3-english mailing list
>>> TYPO3-english at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>>>
>> --
>> Falk Gebauer
>> fgebauer at 3pc.de
>>
>> -----------------------------------------------
>> 3pc GmbH
>> Neue Kommunikation
>>
>> Prinzessinnenstraße 1
>> 10969 Berlin
>> Tel.: 030 - 28 51 98 - 0
>> Fax: 030 - 28 51 98 - 28
>> info at 3pc.de
>> 3pc.de
>>
>>
>> -----------------------------------------------
>> 3pc GmbH
>> Neue Kommunikation
>> Büro Süd
>>
>> Andreas-Hofer-Straße 11
>> 73730 Esslingen
>> Tel.: 0711 - 16 12 15 31
>> sued at 3pc.de
>>
>> -----------------------------------------------
>> Geschäftsführer
>> Armin Berger
>>
>> Amtsgericht Berlin Charlottenburg
>> HRB 794 28
>> USt-IdNr.: DE217652890
>>
>> -----------------------------------------------
>> facebook.com/3pc.de
>> plus.3pc.de
>> twitter.com/3pc
>> flickr.com/photos/3pc
>>
>>
>> _______________________________________________
>> TYPO3-english mailing list
>> TYPO3-english at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>>
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english

-- 
Falk Gebauer
fgebauer at 3pc.de

-----------------------------------------------
3pc GmbH
Neue Kommunikation

Prinzessinnenstraße 1
10969 Berlin
Tel.: 030 - 28 51 98 - 0
Fax: 030 - 28 51 98 - 28
info at 3pc.de
3pc.de


-----------------------------------------------
3pc GmbH
Neue Kommunikation
Büro Süd

Andreas-Hofer-Straße 11
73730 Esslingen
Tel.: 0711 - 16 12 15 31
sued at 3pc.de

-----------------------------------------------
Geschäftsführer
Armin Berger

Amtsgericht Berlin Charlottenburg
HRB 794 28
USt-IdNr.: DE217652890

-----------------------------------------------
facebook.com/3pc.de
plus.3pc.de
twitter.com/3pc
flickr.com/photos/3pc



More information about the TYPO3-english mailing list