我正在使用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\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 / __ CG__backendresourcesentitiesUser.php):无法打开流:/ www / htdocs / w00ebb23 / fokus / vendor / doctrine / common / lib / Doctrine / Common / Proxy / AbstractProxyFactory中没有此类文件或目录第207行的.php
致命错误:require():无法打开所需的' / tmp / __ CG__backendresourcesentitiesUser.php' (include_path ='。:/ usr / share / php:..')/www/htdocs/w00ebb23/fokus/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php在第207行
我必须使用几乎相同的内容添加该功能,但对于不同的实体运行良好。但这个没有。 当我使用getArrayResult而不是getResult或getSingleResult时,Id的简单查找工作正常。任何想法可能是错误?