当我使用$product->getId()
系统返回时HTTP Error 500
代码
$poduct = new Product();
//....
$em->persist($poduct);
$em->flush();
return new Response('Created product id '.$product->getId());
错误:
Server error
The website encountered an error while retrieving http://127.0.0.1/art/web/app_dev.php/product/add. It may be down for maintenance or configured incorrectly.
::编辑::
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest". [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\FragmentListener::onKernelRequest". [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest". [] []
[2013-04-27 09:14:24] request.INFO: Matched route "product_add" (parameters: "_controller": "Dot\ArtBundle\Controller\ProductController::addAction", "_route": "product_add") [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest". [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". [] []
[2013-04-27 09:14:24] security.DEBUG: Read SecurityContext from the session [] []
[2013-04-27 09:14:24] security.DEBUG: Reloading user from user provider. [] []
[2013-04-27 09:14:24] doctrine.DEBUG: SELECT t0.id AS id1, t0.username AS username2, t0.password AS password3, t0.salt AS salt4, t0.email AS email5, t0.avatar AS avatar6, t0.name AS name7, t0.sex AS sex8, t0.father AS father9, t0.bdate AS bdate10, t0.description AS description11, t0.idno AS idno12, t0.melicode AS melicode13, t0.bank_number AS bank_number14, t0.bank_shaba AS bank_shaba15, t0.bank_cart AS bank_cart16, t0.bank_customer AS bank_customer17, t0.postcode AS postcode18, t0.address AS address19, t0.telephone AS telephone20, t0.cellphone AS cellphone21, t0.webpage AS webpage22, t0.type AS type23, t0.is_active AS is_active24, t0.bank_id AS bank_id25, t0.provinc_id AS provinc_id26, t0.city_id AS city_id27 FROM User t0 WHERE t0.id = ? [1] []
[2013-04-27 09:14:24] security.DEBUG: Username "" was reloaded from user provider. [] []
[2013-04-27 09:14:24] security.INFO: No expression found; abstaining from voting. [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest". [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\Fragment\FragmentHandler::onKernelRequest". [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DeprecationLoggerListener::injectLogger". [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController". [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController". [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController". [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController". [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.controller" to listener "Acme\DemoBundle\EventListener\ControllerListener::onKernelController". [] []
[2013-04-27 09:14:24] event.DEBUG: Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController". [] []
[2013-04-27 09:14:24] security.INFO: No expression found; abstaining from voting. [] []
[2013-04-27 09:14:24] doctrine.DEBUG: SELECT c0_.id AS id0, c0_.name AS name1, c0_.active AS active2, c0_.parent_id AS parent_id3 FROM Category c0_ WHERE c0_.id IN (?) ORDER BY c0_.id ASC [["1"]] []
[2013-04-27 09:14:24] doctrine.DEBUG: SELECT u0_.id AS id0, u0_.username AS username1, u0_.password AS password2, u0_.salt AS salt3, u0_.email AS email4, u0_.avatar AS avatar5, u0_.name AS name6, u0_.sex AS sex7, u0_.father AS father8, u0_.bdate AS bdate9, u0_.description AS description10, u0_.idno AS idno11, u0_.melicode AS melicode12, u0_.bank_number AS bank_number13, u0_.bank_shaba AS bank_shaba14, u0_.bank_cart AS bank_cart15, u0_.bank_customer AS bank_customer16, u0_.postcode AS postcode17, u0_.address AS address18, u0_.telephone AS telephone19, u0_.cellphone AS cellphone20, u0_.webpage AS webpage21, u0_.type AS type22, u0_.is_active AS is_active23, u0_.bank_id AS bank_id24, u0_.provinc_id AS provinc_id25, u0_.city_id AS city_id26 FROM User u0_ WHERE (u0_.type = 1 AND u0_.id = 1) AND u0_.id IN (?) ORDER BY u0_.name ASC [["1"]] []
[2013-04-27 09:14:24] doctrine.DEBUG: "START TRANSACTION" [] []
[2013-04-27 09:14:24] doctrine.DEBUG: INSERT INTO Product (name, slug, description, picture, length, width, high, weight, real_price, price, balance, shelf_no, produce_order, produce_day, produce_volum, active, category_id, user_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) {"1":"زتدین زتی دزتندی زتندیسزنتدسیز","2":"زتدین-زتی-دزتندی-زتندیسزنتدسیز","3":"sx cv1f32v1 32df1v23 f1v32","4":"4d19c2036d678867e8bcab0893 [...]","5":"10 سانتیمتر","6":"10 سانتیمتر","7":"10 سانتیمتر","8":"100 گرم","9":6000,"10":6300,"11":1,"12":"NULL","13":"NULL","14":"NULL","15":"NULL","16":"true","17":1,"18":1} []
[2013-04-27 09:14:24] doctrine.DEBUG: "COMMIT" [] []