dououde4065 2013-10-21 05:39
浏览 216
已采纳

可捕获的致命错误:传递给Doctrine \ DBAL \ Connection :: update()的参数3必须是类型数组,在symfony2 update Action中没有给出

when i take one array it`s working fine but when i take

Catchable Fatal Error: Argument 3 passed to Doctrine\DBAL\Connection::update() must be of the type array, none given, called in D:\wamp\www\JPL\src\Jotun\TeamManagmentBundle\Controller\DefaultController.php on line 180 and defined in D:\wamp\www\JPL\vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php line 497

Here is my Controller

  public function updateAction()
 {



    $request = $this->getRequest();
    $company_name = $request->get('company_name');
    $team_name = $request->get('teamname');
    $mobileno = $request->get('mobileno');
    $email = $request->get('email');
    $em = $this->getDoctrine()->getManager();
    $conn = $this->get('database_connection');

    $conn->update('teams',array( 'company_name'=>$company_name,'team_name'=>$team_name,'mobile_no'=>$mobileno,'email_id'=>$email));

    return $this->redirect($this->generateUrl('jotun_teams'));   
 }  

i am not getting it.Thanks In advance

  • 写回答

1条回答 默认 最新

  • duanpuchun5275 2014-08-28 19:36
    关注

    Third element on DBAL update method is needed. It must contains the update criteria in an associative array (field-value). For example:

    $conn->update(
        'teams',
         array(     
             'company_name'=> 'NewCompanyName'
             ),
         array(
             'company_name' => 'CurrentCompanyName'
             )
      );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 WPF使用Canvas绘制矢量图问题
  • ¥15 用三极管设计一个单管共射放大电路
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'
  • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)
  • ¥15 怎么把多于硬盘空间放到根目录下
  • ¥15 Matlab问题解答有两个问题
  • ¥15 LCD12864中文显示
  • ¥15 在使用CH341SER.EXE时不小心把所有驱动文件删除了怎么解决
  • ¥15 gsoap生成onvif框架