I am using the Readbean ORM. I am trying to import some emails into a mysql table using imap. The following code imports an array from imap. One of the fields is $reply_bean->date;
$imap_array=$this->retrieve_message($inbox, $email);
$reply_bean = R::dispense('reply');
$reply_bean->setMeta("buildcommand.unique" , array(array('date')));
$reply_bean->date("Y-m-d H:i:s");
$reply_bean->import($imap_array);
try {
$id = R::store($reply_bean);
} catch (Exception $exc) {
echo ' DUPLICATE';
}
The problem I'm having is that I am having trouble casting the date field as type 'date' instead it remains varchar and is sorted in lexicographical order.
How can I fix this?