我正在尝试使使用symfony2构建的旧php项目工作。当我想用以下工具装载夹具时:
php app/console doctrine:fixtures:load --env=test
我收到此错误:
[Gedmo\Exception\UnsupportedObjectManagerException]
Given object manager is not managed by wrapper
完整跟踪:
# php app/console doctrine:fixtures:load --verbose
Careful, database will be purged. Do you want to continue Y/N ?y
> purging database
> loading [1] Muzich\UserBundle\DataFixtures\ORM\LoadUserData
[Gedmo\Exception\UnsupportedObjectManagerException]
Given object manager is not managed by wrapper
Exception trace:
() at /muzich/vendor/gedmo/doctrine-extensions/lib/Gedmo/Tool/Wrapper/AbstractWrapper.php:65
Gedmo\Tool\Wrapper\AbstractWrapper::wrap() at /muzich/vendor/gedmo/doctrine-extensions/lib/Gedmo/Sluggable/Mapping/Event/Adapter/ORM.php:26
Gedmo\Sluggable\Mapping\Event\Adapter\ORM->getSimilarSlugs() at /muzich/vendor/gedmo/doctrine-extensions/lib/Gedmo/Sluggable/SluggableListener.php:461
Gedmo\Sluggable\SluggableListener->makeUniqueSlug() at /muzich/vendor/gedmo/doctrine-extensions/lib/Gedmo/Sluggable/SluggableListener.php:402
Gedmo\Sluggable\SluggableListener->generateSlug() at /muzich/vendor/gedmo/doctrine-extensions/lib/Gedmo/Sluggable/SluggableListener.php:218
Gedmo\Sluggable\SluggableListener->onFlush() at /muzich/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php:61
Symfony\Bridge\Doctrine\ContainerAwareEventManager->dispatchEvent() at /muzich/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:306
Doctrine\ORM\UnitOfWork->commit() at /muzich/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:355
Doctrine\ORM\EntityManager->flush() at /muzich/src/Muzich/UserBundle/DataFixtures/ORM/LoadUserData.php:98
Muzich\UserBundle\DataFixtures\ORM\LoadUserData->load() at /muzich/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/AbstractExecutor.php:121
Doctrine\Common\DataFixtures\Executor\AbstractExecutor->load() at /muzich/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php:83
Doctrine\Common\DataFixtures\Executor\ORMExecutor->Doctrine\Common\DataFixtures\Executor\{closure}() at n/a:n/a
call_user_func() at /muzich/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:223
Doctrine\ORM\EntityManager->transactional() at /muzich/app/cache/dev/jms_diextra/doctrine/EntityManager_5b969a4da5b1d.php:31
EntityManager5b969a4da5b1d_546a8d27f194334ee012bfe64f629947b07e4919\__CG__\Doctrine\ORM\EntityManager->transactional() at /muzich/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php:85
Doctrine\Common\DataFixtures\Executor\ORMExecutor->execute() at /muzich/vendor/doctrine/doctrine-fixtures-bundle/Command/LoadDataFixturesDoctrineCommand.php:105
Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand->execute() at /muzich/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:242
Symfony\Component\Console\Command\Command->run() at /muzich/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:200
Symfony\Component\Console\Application->doRun() at /muzich/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:83
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /muzich/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:106
Symfony\Component\Console\Application->run() at /muzich/app/console:16
doctrine:fixtures:load [--fixtures[="..."]] [--append] [--em="..."] [--purge-with-truncate]
源代码为here。有什么问题以及如何解决?
答案 0 :(得分:0)
使用v2.3.6
的{{1}}版本解决了问题。