I'm building a filter for some paginated lists, and i want to be able to show the elements created between two dates. But I'm not sure how to do it correctly.
The view:
<?php echo $this->Form->create('Logs');?>
<fieldset>
<?php
echo $this->Form->input('start',array('type'=>'date'));
echo $this->Form->input('end',array('type'=>'date'));
?>
</fieldset>
<?php echo $this->Form->end('Filter');?>
The controller:
...
$conditions['Logs.created BETWEEN ? AND ?'] = array( $this->data['Logs']['start'],$this->data['Logs']['end']);
...
the problem is that $this->data['Logs']['start']
and $this->data['Logs']['end']
are arrays and i need strings:
[Logs] => Array
(
[start] => Array
(
[month] => 04
[day] => 19
[year] => 2011
)
[end] => Array
(
[month] => 04
[day] => 19
[year] => 2011
)
)
I know that i could use some php functions to transform the array into string, but there must be some function or something in cake. I feel that i'm not constructing the view correctly
Thanks for your help.