Php Doctrine2 ORM-使用getResult时出错
我正在使用DoctrineORM及其querybuilder更新mySQL数据库中的一些数据。请看下面的代码,我无法识别错误Php Doctrine2 ORM-使用getResult时出错,php,mysql,doctrine-orm,doctrine,Php,Mysql,Doctrine Orm,Doctrine,我正在使用DoctrineORM及其querybuilder更新mySQL数据库中的一些数据。请看下面的代码,我无法识别错误 public function update($id, Request $request){ $em = new em(); // fetch the document to be updated $updatedDocument = $em->getEm()->find('backend\resources\entities\Doc
public function update($id, Request $request){
$em = new em();
// fetch the document to be updated
$updatedDocument = $em->getEm()->find('backend\resources\entities\Document', $id);
$document = $request->request->all();
$translator = new Translator('de_de');
$validator = new Validation\Validator($translator, $document, $this->rules);
if($validator->passes()){
$updatedDocument->setTitle($document['title']);
$updatedDocument->setWorkflow($document['workflow']);
$updatedDocument->setDocClass($document['docClass']);
$em->getEm()->persist($document);
$em->getEm()->flush();
$response = json_encode($document);
return new Response($response, 200, array('Content-Type' => 'json'));
}
$response = json_encode(array('Error' => 'Could not be updated.'));
return new Response($response, 200, array('Content-Type' => 'json'));
}
现在,当我尝试调用此函数时,我收到以下消息:
警告:require(/tmp/\uuuuu CG\uuuu backendResourceSentiesUser.php):无法打开流:第207行的/www/htdocs/w00ebb23/fokus/vendor/doctor/common/lib/doctor/common/Proxy/AbstractProxyFactory.php中没有此类文件或目录
致命错误:require():无法在第207行的/www/htdocs/w00ebb23/fokus/vendor/doctor/common/lib/doctor/common/Proxy/AbstractProxyFactory.php中打开所需的“/tmp/\uuuuu CG\uuuu backendResourcesentiesUser.php”(包括路径=”:/usr/share/php:…”)
我必须用几乎相同的内容添加该函数,但是对于不同的实体,它工作得很好。但是这个没有。
当我使用getArrayResult而不是getResult或getSingleResult时,一个简单的按Id查找就可以了。知道可能是什么错误吗?尝试清理服务器缓存、代理/元数据缓存这看起来很奇怪:$em=new em();通常,您会从容器中提取这类内容,或者使用getDoctrine()@Cerad。这个em()是我创建的一个简单的entityManager助手类。。。这在其他地方也适用。@Rufinus如何清理服务器缓存?此应用程序旨在用于简单的Web主机…@RajK。