Im trying to do something pretty simple in Propel ORM which I just cant seem to work out or find the answer to.
Basically I have a table called post and a table called post_history. Every time someone makes an edit to a post, the previous version is saved to post_history first.
I have an 'undo' button against each post where I simply want to select the last 'post_history' record for the post and revert the post data from the history. To select the last history that is older than my post how do I select GREATER or LESS than in propel?
If I do something like this:
$postHistory = PostHistoryQuery::create()
->filterByPostId($post->getId())
->filterByCreated(array("max" => $post->getUpdated()))
->orderById("DESC")
->limit(1);
the filterByCreated with the 'max' specified does indeed select the last 'post_history' but if you click undo again it selects the same record because the max seems to specify less or equal to rather just less than. It may require a custom query? I think im missing a trick that I cant find the answer too. My search for the answer hasn't helped so far.
Any help is much appreciated.