簡體   English   中英

可捕獲的致命錯誤:傳遞給Doctrine \\ DBAL \\ Connection :: update()的參數3必須為數組類型,在symfony2 update中沒有給出

[英]Catchable Fatal Error: Argument 3 passed to Doctrine\DBAL\Connection::update() must be of the type array, none given in symfony2 update Action

當我采取一個陣列時,它的工作正常,但當我采取

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

這是我的控制器

  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'));   
 }  

我不明白。謝謝

需要有關DBAL更新方法的第三個元素。 它必須在關聯數組(字段值)中包含更新條件。 例如:

$conn->update(
    'teams',
     array(     
         'company_name'=> 'NewCompanyName'
         ),
     array(
         'company_name' => 'CurrentCompanyName'
         )
  );

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM