English 中文(简体)
我如何在使用同义词的抗议中使用OR声明
原标题:How do I use the OR statement in a Propel query using Symfony

下面的法典现在看着提交人的面目和数据库中的“目标”目标,要求两者相匹配,并用询问加以反驳。 我想到的是:WHERE author_id=x >get_object_id= y ,而不是“prop”;andamp;按违约计算,这是以下守则。

我看着传教书和书状手册,他们不帮助我。

$c = new Criteria();
$c->add("type", GVCCommentPeer::TYPE_PRIVATE_MESSAGE);
$c->add("author_id", $this->myprofileid);
$c->add("target_object_id", $this->profile->getId());
最佳回答

您需要从您的标准中制造物体,并按以下条件将其合并:

//create your Criteria
$c = new Criteria();
$c->add("type", GVCCommentPeer::TYPE_PRIVATE_MESSAGE);

//create 2 Criterion objects
$c1 = $c->getNewCriterion("author_id", $this->myprofileid);
$c2 = $c->getNewCriterion("target_object_id", $this->profile->getId());

// merge the two fields on OR
$c1->addOr($c2);

//bind
$c->add($c1);

$result = YOURPEERHEREPeer::doSelect($c);
问题回答

暂无回答




相关问题
To populate select options at backend using Symfony?

the symfony form is, nation =>new sfWidgetFormChoice(array( choices => NationPeer::getAllNation())), township =>new sfWidgetFormChoice(array( choices => TownshipPeer::...

Seriously speeding up PHP?

I ve been writing PHP for years, and have used every framework under the sun, but one thing has always bugged me... and that s that the whole bloody thing has to be interpreted and executed every time ...

How to unit-test an enterprise symfony project?

I´m working on a huge project at my work. We have about 200 database tables, accordingly a huge number of Models, Actions and so on. How should I begin to write tests for this? My biggest problem ...

edit profile from frontend - symfony

I succeeded to create a register form, and now users can register my site. But I can t create a form where users can edit their profile. I have sf_guard_user and sf_guard_user_profile in my schema....

热门标签