I wanted to use this code, and it break on flush() without any exception message:
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() method looks:
public function addCategory( $categoryName )
{
$category = new Category();
$category->setName( $categoryName );
$this->em->persist( $category );
$this->em->flush();
$this->counter['category']++;
return $category;
}
any idea what is wrong? or how to get PDOException message within symfony2 ?
I had the same problem just seconds ago. It got fixed when I went to the production mode and and closed the session. It looks like development mode has problems with sessions when you do things like replacing the entire folder with a lot of changes while session still alive.
Try clearing your session, it may work.