내 애플리케이션과 데이터베이스를 연결해야합니다. 이렇게하려면 doctrine:generate:entity
인 개체를 생성했습니다. 그것은 매핑을위한 적절한 주석이있는 엔티티를 생성합니다. 나는 또한 doctrine:schema:update --force
을 사용하여 데이터베이스 서버에 스키마를 실제로 만들었습니다. phpMyAdmin으로이 작업이 완료되었음을 확인할 수 있습니다. 내 컨트롤러에서 Symfony 엔티티를 저장할 때 서버 오류가 발생했습니다.
public function testAction() {
$file = new File();
$file->setTest('A Foo Bar');
$em = $this->getDoctrine()->getManager();
$em->persist($file);
$em->flush();
return new JsonResponse(array('foo' => 'bar'));
}
문자열 길이 255의 난이 URL을 요청하면 AJAX를 통해 만 test
하나 개의 필드를 촉구했다 엔티티 내 응용 프로그램의 요청은, 그것은 매우 가치가없는 500 내부 서버 오류가 다시 발생 :
Oops! An Error Occurred
The server returned a "500 Internal Server Error".
Something is broken. Please e-mail us at [email] and let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
PHP의 오류 로그는 오류 정보가 없습니다. 데이터베이스 조작 항목을 제거하면이 컨트롤러 조치가 작동합니다. 응용 프로그램은 또한 dev 환경에서 실행됩니다.
무엇이 잘못되었는지 더 자세히 설명하는 오류 메시지가 표시 될 수 있습니까?
보통 Symfony 전체 백 추적 오류가 발생합니까? onPersist 또는 다른 Doctrine 이벤트를 트리거하는 EventListener를 만들었습니까? –
캐시를 지운 후에 다시 시도하십시오 !!! –
프로덕션 환경에서 응용 프로그램을 실행합니까? 그렇다면 loggin을 설정해보십시오 ([여기] (http://symfony.com/doc/current/cookbook/logging/monolog.html#using-several-handlers)를 클릭하면 [docs] (http : /symfony.com/doc/current/cookbook/logging/monolog.html#using-several-handlers)) – acrobat