Here's my code:
$c = new Criteria();
$c->addAscendingOrderByColumn(ItemPeer::ITEM_DATE);
$c->add(ItemPeer::ITEM_DATE, $item->getItemDate(), Criteria::GREATER_THAN);
$this->next = ItemPeer::doSelectOne($c);
This works fine except when multiple dates are the same, for example: 3/1/2013 and 3/1/2013
When this happens it doesn't select the next one. For example (sorted by date):
Apple 2/27/2013
Banana 2/28/2013
Kiwi 3/1/2013
Dolphin 3/1/2013
ICBM 3/1/2013
If the current item is Banana
, the next one will be correctly chosen as Kiwi
. However, if the current item is Kiwi
, it will be unable to find the next one. I'd like it to always choose the next one in date, even if the next date is the same. How can I do this?