小编Gab*_*Kid的帖子

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

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
Run Code Online (Sandbox Code Playgroud)

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

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

if($dummy)
{
   //column exists!
}
Run Code Online (Sandbox Code Playgroud)

这可能吗?

php symfony doctrine-orm

10
推荐指数
2
解决办法
2万
查看次数

HTML5:输入类型范围有"onrelease"之类的事件吗?

我需要在释放滑块时调用函数,"onchange"会在更改时更改值.这有解决方案吗?

像这样

<input type="range" min="0" max="1000" onrelease="callfunction()">
Run Code Online (Sandbox Code Playgroud)

html

4
推荐指数
1
解决办法
4684
查看次数

如何在Symfony2上将Repository对象作为Json返回

我试图像这样返回用户,但当然它不起作用,我需要数据作为JSon,因为我正在使用BackboneJs

/**
* @Route("/mytest",name="ajax_user_path")
*/
public function ajaxAction()
{
    $em = $this->get('doctrine')->getManager();
    $users = $this->get('doctrine')->getRepository('GabrielUserBundle:Fosuser')->findAll();

    $response = array("users"=>$users);            
    return new Response(json_encode($response));
}
Run Code Online (Sandbox Code Playgroud)

json symfony

1
推荐指数
2
解决办法
9602
查看次数

标签 统计

symfony ×2

doctrine-orm ×1

html ×1

json ×1

php ×1