Symfony2&没有描述的Doctrine2 PDOException

时间:2012-04-13 11:26:03

标签: exception symfony pdo doctrine-orm

我想使用这段代码,它在flush()上中断而没有任何异常消息:

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消息?

1 个答案:

答案 0 :(得分:0)

几秒钟前我遇到了同样的问题。当我进入生产模式并关闭会话时,它得到修复。当您执行诸如在会话仍然活动时用大量更改替换整个文件夹时,开发模式看起来像会话有问题。

尝试清除会话,它可能会有效。