Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Doctrine2无法使用EntityManager()保存->;坚持_Php_Symfony1_Doctrine Orm - Fatal编程技术网

Php Doctrine2无法使用EntityManager()保存->;坚持

Php Doctrine2无法使用EntityManager()保存->;坚持,php,symfony1,doctrine-orm,Php,Symfony1,Doctrine Orm,我在symfony2框架中使用doctrine2。我在插入新值时遇到问题。下面给出了我的示例代码 $order = new Order(); $order->setUser($user); // $user is object from user table $order->setAmount($d['amount']); $order->setStatus($this->getStatusAsInteger($orderStatus)); $this->ge

我在symfony2框架中使用doctrine2。我在插入新值时遇到问题。下面给出了我的示例代码

$order = new Order(); 
$order->setUser($user); // $user is object from user table 
$order->setAmount($d['amount']); 
$order->setStatus($this->getStatusAsInteger($orderStatus));
$this->getEntityManager()->persist($order); 
$this->getEntityManager()->flush(); 

代码没有返回错误。任何人请帮助我解决此问题。

您可以发布您的
订单
实体吗?
$user
是否已持久化?我发现很难相信这不会在开发模式中产生任何错误。我可以在日志中看到根据条令生成的Insert查询,但它没有保存实体。你怎么知道它没有保存实体?这是我得到的日志。但它并没有存储到数据库中。在订单中插入(用户id、金额、状态、创建时间)值(?、?、?)({“1”:2,“2”:10000,“3”:“1”,“4”:{“日期”:“2011-11-15 00:00:00”,“时区类型”:3,“时区”:“亚洲\东京”})[]]您如何知道“它没有存储到数据库”?