[TYPO3-mvc] Multiple constraints result in query error

Henjo Hoeksma me at henjohoeksma.nl
Thu Oct 20 11:31:40 CEST 2011


Hi Sebastian,

of course, but as stated: the code works fine.
I messed up somewhere else and it called upon an old method from the
repository with wrong arguments...

Kind regards,

Henjo

Problems are small because we learned how to deal with them.

Problems are big because we need to learn how to deal with them.




On Thu, Oct 20, 2011 at 08:13, Sebastian Schreiber <me at schreibersebastian.de
> wrote:

> Am 19.10.2011 23:38, schrieb Henjo Hoeksma:
>
>  Hi Franz,
>>
>> found the problem. Code works great. It was something else that was in the
>> way…
>>
>> One of those great moments ;-)
>>
>> Thanks though!
>>
>> Henjo
>> On 2011-10-19 09:47:13 +0000, Franz Koch said:
>>
>>  Hi Henjo,
>>>
>>>  I try to parse an array of fields dynamically to a logicalAnd statement,
>>>> but somehow my query gets messed up...
>>>> I don't see where it goes wrong, I hope you can help me!
>>>>
>>>> This is a snippet of my repository function:
>>>>
>>> ...
>>>
>>>> $constraints_array = array();
>>>> foreach ($fields as $key => $value) {
>>>> $constraints_array[] = $query->like($key, '%'.$value.'%');
>>>> }
>>>> $query->matching($query->**logicalAnd($constraints_array)**);
>>>>
>>>
>>> code looks good.
>>>
>>>  For a single entry in the $fields array this works fine.
>>>> When using a second entry in my filter box that adds a second entry in
>>>> the array, somehow the query get's messed up and makes it like:
>>>>
>>>> tx_extension_domain_model_**objet.key1_and_key2
>>>>
>>>> So the keys get combined instead of 2 seperate ones:
>>>>
>>>> tx_extension_domain_model_**objet.key1 LIKE ''
>>>> AND
>>>> tx_extension_domain_model_**objet.key2 LIKE ''
>>>>
>>>> Does anyone have a clue on why this happens?
>>>>
>>>
>>> what version of Extbase are you using? 1.4dev? What happens if you try
>>>
>>> $query->matching(
>>>    $query->logicalAnd(
>>>        $query->like($key, '%foo%'),
>>>        $query->line($key, '%bar%')
>>>    )
>>> );
>>>
>>
>>
>> ______________________________**_________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc@**lists.typo3.org<TYPO3-project-typo3v4mvc at lists.typo3.org>
>> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**
>> project-typo3v4mvc<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc>
>>
> Dear Henjo,
> it is always nice to share your solutions ;-)
>
> --
> Sebastian Schreiber
> (Medieninformatiker B.Sc.)
> (TYPO3 Certified Integrator)
>
> Schanzenstraße 27, Schlosserei 4
> D-51063 Köln
>
> T  0221 677 88 541
> M  0176 431 05 790
>
> Skype schreibersebastian.de
>
> me at schreibersebastian.de
> www.schreibersebastian.de
>
> Steuernummer: 217 / 5269 / 4675
>
>
> ______________________________**_________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc@**lists.typo3.org<TYPO3-project-typo3v4mvc at lists.typo3.org>
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**
> project-typo3v4mvc<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc>
>


More information about the TYPO3-project-typo3v4mvc mailing list