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]:两个参数在 D:\EasyPHP-5.3.3.1\www\alerteurs1\vendor\doctrine\lib\Doctrine\ORM\EntityRepository 中应该有相同数量的元素。第 126 行

4

2 回答 2

1

也许你的 $date 应该是一个\Datetime对象?

于 2012-11-09T09:27:36.437 回答
0

我认为您应该在数组声明中删除变量周围的单引号:

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

应该看起来像:

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