2012-04-13 45 views
0

我想利用這個代碼,它的flush()沒有任何異常的消息打破:Symfony2的&Doctrine2 PDOException沒有說明

1. at PDOStatement ->execute (null) 
in ../vendor/doctrine-dbal/lib/Doctrine/DBAL/Statement.php at line 131  
2. at Statement ->execute() 
in ../vendor/doctrine/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php at line 237  
3. at BasicEntityPersister ->executeInserts() 
in ../vendor/doctrine/lib/Doctrine/ORM/UnitOfWork.php at line 726  
4. at UnitOfWork ->executeInserts (object(ClassMetadata)) 
in ../vendor/doctrine/lib/Doctrine/ORM/UnitOfWork.php at line 292  
5. at UnitOfWork ->commit() 
in ../vendor/doctrine/lib/Doctrine/ORM/EntityManager.php at line 334  
6. at EntityManager ->flush() 
in ../src/Tools/TFIBundle/Model/CSVImport.php at line 136  
7. at CSVImport ->addCategory ('fundusz obligacji') 
in ../src/Tools/TFIBundle/Model/CSVImport.php at line 114 

addCategory()方法如下:

public function addCategory($categoryName) 
{ 
    $category = new Category(); 
    $category->setName($categoryName); 

    $this->em->persist($category); 
    $this->em->flush(); 
    $this->counter['category']++; 

    return $category; 
} 

任何想法哪裏不對?或者如何在symfony2中獲得PDOException消息?

+0

您確定您正在開發模式下運行嗎? – Cerad 2012-04-13 13:28:51

+0

也許這條消息隱藏在你的html頁面源代碼中。 – greg0ire 2012-04-13 18:00:06

回答

0

我剛剛在幾秒鐘前遇到同樣的問題。當我進入生產模式並關閉會話時它已經修復。它看起來像開發模式有會話的問題,當你做一些事情,如在會話仍然活着的時候,用很多更改替換整個文件夾。

嘗試清除會話,它可能會工作。

+0

這根本不起作用,但是我在代碼中發現了一些導致此問題的錯誤。感謝努力。 – nysander 2012-05-22 06:56:02