加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 是否可以在Doctrine和Symfony2中使用多个值查找列?

发布时间:2020-12-13 13:12:27 所属栏目:PHP教程 来源:网络整理
导读:image我有以下数据库结构 class voters{ protected $voterid; protected $imageid; protected $action;}// $voterid = is the current voter// $imageid = is the id of the voted image// $action = is upvote/downvote,delete 如果我想一次查找几个项目,检
image我有以下数据库结构
class voters
{
    protected $voterid;
    protected $imageid;
    protected $action;
}

// $voterid = is the current voter
// $imageid = is the id of the voted image
// $action = is upvote/downvote,delete

如果我想一次查找几个项目,检查列是否存在,会发生什么
就像是

$dummy = findOneBy('voterid'=>1,'imageid'=>2,action=>"upvote");

if($dummy)
{
   //column exists!
}

这可能吗?

见 Databases and Doctrine

如果要检索产品,关于某些属性,您只需使用方法findOneBy作为参数作为数组:

$product = $repository->findOneBy(array('name' => 'foo','price' => 19.99));

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读