I've got a problem of how statment in array is translated into sql
Below is my function that is supposed to find records od certain day.
field creaded is day+hour dormat yyyy-mm-dd 00:00:00; in variable
$created there's only yyyy-mm-dd. I would like to find all records
that start with $creaded
function indexdate($created = null) {
$this->Audit->created = $created;
$conditions = array('Audit.created START WITH' => $this->Audit-
>created)
// $conditions = array('START WITH'=> array('Audit.created',
$this->Audit->created));
//$this->set('audits', $this->Audit->findAllByCreated(array
('conditions' => $conditions)));
$this->set('audits',$this->Audit->find('all', array('conditions'
=> $conditions)));
// $this->set('audits',$this->Audit->find('threaded',
array('conditions' => $conditions)));
$data=$this->paginate($this->Audit->read());
}
When i use version with
$conditions = array('START WITH'=> array('Audit.created',$this->Audit-
>created));
that i found http://old.nabble.com/findAll-with-OR,-AND,-and-BETWEEN-td15175585.html
i get
WHERE START WITH IN ('Audit.created', '2010-01-16')
when i use
$conditions = array('Audit.created START WITH' => $this->Audit-
>created);
found http://book.cakephp.org/view/808/find-all
i got additional =
WHERE `Audit`.`created START` WITH = '2010-01-16'
if i use , in stead of => i got additional AND, can't use nothing of
course
i'd be grateful for solution or any hint..
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment