[FLOW3-general] Getting all Values of some Objects Property
marc neuhaus
apocalip at googlemail.com
Thu Jan 21 14:01:56 CET 2010
But that wouldn't change anything about the nee to iterate over all objects
to find all values.
For Example:
There are 4 Posts:
1. Post with the date 01-01-2010
1. Post with the date 05-01-2010
1. Post with the date 01-01-2010
1. Post with the date 04-01-2010
And as a result i want to have a List of Dates like:
01-01-2010
04-01-2010
05-01-2010
I Can achieve this by Iterating over all Objects but the time needed to
compile this list will grow quite significantly with the number of Posts. In
the past i would have done something like this through a SQL Grouping like i
wrote in the First post. I just can't imagine, that this is the supposed way
to deal with something like this. Just image you have a Repository with 10
000 Objects, some with big Textfields or other Big Data and you have to load
all of them in order to Get all used values for 1 Property.
Greetings Marc
2010/1/21 Julian Kleinhans <jk at marketing-factory.de>
> Hi marc,
>
> humm, you can write your own findBy* method in the repository and use the
> createQuery object..
>
>
> cheers
> julian
>
>
>
> Am 21.01.2010 13:17, schrieb marc neuhaus:
>
> Hey!
>>
>> I was wondering how i would accomplish something equivalent to this:
>> "SELECT date FROM posts GROUP BY date;"
>>
>> My first idea was to get All Objects through findAll() an iterate over all
>> of them and compiling an array of the Used Properties:
>> for($posts as $post)
>> $dates[$post->getDate()]++;
>>
>> Problem with this is, that this would take way to long if there are lots
>> of
>> $posts.
>>
>> Is this the only way to do something like this at the moment?
>> Is something planned/specified to provide a better way to retrieve
>> something
>> like this?
>>
>> Greetings Marc
>>
>
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
>
More information about the FLOW3-general
mailing list