私はこのコードを使用したかったのですが、例外メッセージなしで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メッセージを取得する方法は?