我爲這個新問題提前道歉,但我一直在努力尋找正確的結果。Symfony 1.4:如何將索引操作的結果限制爲僅登錄用戶的結果
我有兩個表:
sf_guard_user:
Columns
id
name
recipe:
Columns:
id:
user_id:
name:
relations:
sf-guard_user: { local: user_id, foreign: id; foreign_alias: recipes }
配方模塊,indexSuccess: 這種形式,我想限制我的結果只有已登錄的用戶。
這裏是我的食譜的actions.class.php文件:
public function executeIndex(sfWebRequest $request)
{
$this->recipe = Doctrine_Core::getTable('recipe')
->createQuery('a')
->whereStatement: user_id = logged-in/posted user (this is where I'm struggling with the syntax... do I use a join statement? Or where statement? ...I'm lost. I can get the result I want in basic MySql, but not in DQL)
->execute();
}
任何幫助深表感謝。
您應該將解決方案作爲答案發布並接受它,而不是編輯問題。這樣,其他讀者就會更容易理解問題和答案。 –
我試過......論壇不讓我B/C它不是8個小時。我將以答案格式重新發布。感謝您的建議和幫助。 – Patrick