Since there was not reply, I want to post my solution:

1. I added two input field 'date_before', 'date_after'

2. I created another component class 'myfilter' which extends the
filter component

3. In this class I handle 'date_before' and 'date_after' and set them
to $data['date']['BETWEEN'] = array( date_before, date_after ) and
call Parent Filter Components processor.

4. This way my query still fails, since filter component in my version
will try to add 'date_before' as fields to the query, but these fields
do not exist

5. In order to have date_before and date_after saved in session but
not in my query, I extended my filter components with an option
saveToSessionOnly which will be saved but ignored in the filter
creation loop

Probably not the best solution, but in the end the only solution I
found so far.

On 1 Dez., 18:29, web_rene <[email protected]> wrote:
> I am quite new to CakePHp and the MVC way of thinking.
>
> Up to know I was able to create resultsetfiltering by the use of the Filter
> Component by Nik Chankov.
>
> The way I am using it, is to call it in my Controller, saving the condition
> statement and passing it to the Paginator.
>
> Now, I have one column which holds a 'created_at' date and I want to give
> the user a possibility to enter a start date and an end date and to pass it
> to the filter component.
>
> I tried creating two input text fields 'created_after' and 'created_before'
> and to join these to an array[created_at][BETWEEN] in my controller since
> the Filter Component handles 'BETWEEN' arrays.
>
> Unfortunatelly, if I do not unset the original values I get a SQL Error
> since the component will create a statement including 'created_after' and
> created_before' which are not defined in my database. But if I do unset
> created_before and _after, they won't be saved to the session ( this is
> handled byfilteringcomponent aswell ) and I can not use Paginator anymore.
>
> What would be the correct way of doing this? Please give me advise how and
> into which direction I should proceed to solve this issue... I am kind of
> stuck and I would love to somehow add this to theFilteringand not to
> create a hack in my Controller...
>
> thanks!
>
> --
> View this message in 
> context:http://cakephp.1045679.n5.nabble.com/Filtering-Component-Correct-way-...
> Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to