Hi everyone,
I have an issue related to query an object using a date as criteria I used ta test to check my problem :
Model.
<?php
class TestDate extends \Phalcon\Mvc\Model
{
protected $tDate;
public function getTDate(){
return $this->tDate;
}
public function setTDate($date){
$this->tDate = $date;
}
public function getSource()
{
return "testDate";
}
}
and a test method in the controller
public function testDateAction(){
$theDate = new \DateTime("2015-01-25");
$myDate = \TestDate::findFirst(array('tDate'=> $theDate->format('Y-m-d') ));
var_dump($myDate->getTDate()); die; // Returns null
}
The database has the following entry
id | tdate |
---|---|
0 | 2015-01-25 |