我正在尝试生成实体的CRUD,但我有几个问题,我不知道这是正常的比赛还是错误。
我应用命令:
我在routing.yml中添加路由,就像询问一样。
现在,当我测试这个问题时,只需创建派对工作。
更新不起作用,它是updateAction:
public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('IFppoGestionPersonnelBundle:TableTest')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find TableTest entity.');
}
$deleteForm = $this->createDeleteForm($id);
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('tabletest_edit', array('id' => $id)));
}
return $this->render('IFppoGestionPersonnelBundle:TableTest:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
我不知道为什么它不添加“em-> persist($ entity)”,但是如果我添加这一行,它就不会更新......
我对deleteAction有同样的错误。 当我创建一个新的元组,并返回列表时,最后一个元组没有显示。
这可能是班上的一个错误:
IFppo\GestionPersonnelBundle\Entity\TableTest:
type: entity
table: tabletest
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
nom:
type: string
length: 255
column: nom
prenom:
type: string
length: 255
column: prenom
lifecycleCallbacks: { }
在日志中,我没有任何更新痕迹...
[编辑] 在向日志写入任何错误时,请使用 $ editForm-> getErrors()和 $ editForm-返回一个空数组> getErrorsAsString()返回:
nom:没有错误prenom:没有错误提交:没有错误[] []
非常感谢。