Symfony1 推进标准

Symfony1 推进标准,symfony1,criteria,propel,Symfony1,Criteria,Propel,我尝试使用条件和推进创建以下语句: AND unix_timestamp(table.last_action) > unix_timestamp(table.last_action) -1800 但我似乎没能做对 $kriterien->add(sfGuardUserProfilePeer::LAST_ACTION, 'unix_timestamp(table.last_action)-90', Criteria::GREATER_THEN); sfGuardUserProfil

我尝试使用条件和推进创建以下语句:

AND unix_timestamp(table.last_action) > unix_timestamp(table.last_action) -1800
但我似乎没能做对

$kriterien->add(sfGuardUserProfilePeer::LAST_ACTION, 'unix_timestamp(table.last_action)-90', Criteria::GREATER_THEN);

sfGuardUserProfilePeer::LAST_ACTION
不是unix_时间戳。我怎样才能改变它,使之成为现实?我已经试图简单地更改
BasesGuardUserProfilePeer.php
LAST\u ACTION
的值,但它抛出了一个错误。

没有
Criteria::GREATER\u THEN
这样的常量-也许你的意思是
Criteria::GREATER\u THAN
?但是,如果使用该参数,
add()
的第二个参数必须是字符串或整数值-尝试使用列名或SQL函数将不起作用

相反,试试这个(显然你可能需要调整-我不确定你到底想要实现什么):


最后,不推荐使用
标准
方法。您没有说您正在使用哪一版本的Propel(这个细节应该在您的问题中),但最好使用最新版本(1.5或1.6)并迁移到查询方法。

为什么要这样做?数据库将无法使用任何索引来解析查询的这一部分,因为您不必要地应用了函数;您不需要使用UNIX时间戳来修改日期<代码>某物>某物-间隔1800秒。当然,按原样查询毫无意义,因为列不能大于自身…什么?:-)查询工作得非常好。从现在到半小时前,something>something-1800秒是每一个something,而
something>something-1800是每一行。所有数字都大于自身减去其他数字<代码>某物>当前时间戳-1800
将是从现在到半小时前的每一行。是的,你是对的。但是timestamp1>timestamp2是否适用于unix\u时间戳?因为它有点不…好吧,我知道为什么(虽然我不明白)。查询结果是和sf_guard_user_profile.LETZTE_AKTION>(当前时间戳-间隔90秒)它是这样工作的,sf_guard_user_profile.LETZTE_AKTION>(当前时间戳-间隔90秒)。我怎么才能把车开出去?
$kriterien->add(
    sfGuardUserProfilePeer::LAST_ACTION,
    'unix_timestamp(sf_guard_user_profile.last_action) > 90',
    Criteria::CUSTOM
);