0

href リンクから列を変更したいのですが、変更することはできますが、この変更はデータベースに保存されず、役に立ちませんか? 私のコントローラーで:

public function updateAlertesAction()
{  
   $date=$this->getRequest()->query->get('date');
   $CI=$this->getRequest()->query->get('CI');
   $cell=$this->getRequest()->query->get('cell');

   $kpi_name=$this->getRequest()->query->get('cmts');

   $KPI = $this->getDoctrine()
               ->getEntityManager()
               ->getRepository('AdminBlogBundle:StatAlert')
                ->findBy(array('cell' => '$idKPI', 'ci' => '$CI', 'dat' => '$date'));

         $KPI->setCmts($kpi_name);
         $em = $this->getDoctrine()->getEntityManager();
         $em->persist($KPI);
         $em->flush();

     return new Response ($kpi_name.' Updaate Ok : '.$KPI->getCmts());
}

彼はこのエラーメッセージを表示します

致命的なエラー: 44目の D:\EasyPHP-5.3.3.1\www\alerteurs1\vendor\doctrine-dbal\lib\Doctrine\DBAL\Types\DateType.phpの非オブジェクトに対するメンバー関数 format() の呼び出し

検索を置き換える場合 ->find(array('cell' => 'TUN1196S1')); 警告があります: array_combine() [function.array-combine]: Both parameters should have equal number of elements in D:\EasyPHP-5.3.3.1\www\alerteurs1\vendor\doctrine\lib\Doctrine\ORM\EntityRepository. PHP126行目

4

2 に答える 2

0

配列宣言で変数を囲む一重引用符を削除する必要があると思います。

->findBy(array('cell' => '$idKPI', 'ci' => '$CI', 'dat' => '$date'));

むしろ次のようになります。

->findBy(array('cell' => $idKPI, 'ci' => $CI, 'dat' => $date));
于 2012-11-09T08:30:21.037 に答える