Closed hgabka closed 4 years ago
An example error message with the current solution:
An exception has been thrown during the rendering of a template ("Property Proxies\__CG__\Hgabka\MediaBundle\Entity\Media::$currentLocale does not exist").
Can you provide a backtrace? The setReflectionPropertyValue
is only called from the postLoad
lifecycle event, and that event is never triggered on on a proxy but always on a real entity as it is being loaded.
Yes, but the entity has a lazily loaded connection that is translatable and is a proxy. You can check the trace here: https://dev.techfield.hu/
Backtrace:
ReflectionException:
Property Proxies\__CG__\Hgabka\MediaBundle\Entity\Media::$currentLocale does not exist
at vendor/prezent/doctrine-translatable/lib/Prezent/Doctrine/Translatable/EventListener/TranslatableListener.php:323
at ReflectionProperty->__construct('Proxies\\__CG__\\Hgabka\\MediaBundle\\Entity\\Media', 'currentLocale')
(vendor/prezent/doctrine-translatable/lib/Prezent/Doctrine/Translatable/EventListener/TranslatableListener.php:323)
at Prezent\Doctrine\Translatable\EventListener\TranslatableListener->setReflectionPropertyValue(object(Media), 'currentLocale', 'hu')
(vendor/prezent/doctrine-translatable/lib/Prezent/Doctrine/Translatable/EventListener/TranslatableListener.php:311)
at Prezent\Doctrine\Translatable\EventListener\TranslatableListener->postLoad(object(LifecycleEventArgs))
(vendor/symfony/doctrine-bridge/ContainerAwareEventManager.php:58)
at Symfony\Bridge\Doctrine\ContainerAwareEventManager->dispatchEvent('postLoad', object(LifecycleEventArgs))
(vendor/doctrine/orm/lib/Doctrine/ORM/Event/ListenersInvoker.php:117)
at Doctrine\ORM\Event\ListenersInvoker->invoke(object(ClassMetadata), 'postLoad', object(Media), object(LifecycleEventArgs), 4)
(vendor/doctrine/orm/lib/Doctrine/ORM/Internal/HydrationCompleteHandler.php:95)
at Doctrine\ORM\Internal\HydrationCompleteHandler->hydrationComplete()
(vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:3581)
at Doctrine\ORM\UnitOfWork->hydrationComplete()
(vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php:58)
at Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator->cleanup()
(vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php:155)
at Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll(object(PDOStatement), object(ResultSetMapping), array('doctrine.refresh' => true, 'doctrine.refresh.entity' => object(Media)))
(vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:726)
at Doctrine\ORM\Persisters\Entity\BasicEntityPersister->load(array('id' => '41'), object(Media))
(vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:736)
at Doctrine\ORM\Persisters\Entity\BasicEntityPersister->loadById(array('id' => '41'), object(Media))
(vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php:159)
at Doctrine\ORM\Proxy\ProxyFactory->Doctrine\ORM\Proxy\{closure}(object(Media), 'getUrl', array())
(var/cache/dev/doctrine/orm/Proxies/__CG__HgabkaMediaBundleEntityMedia.php:431)
at Closure->__invoke(object(Media), 'getUrl', array())
(var/cache/dev/doctrine/orm/Proxies/__CG__HgabkaMediaBundleEntityMedia.php:431)
at Proxies\__CG__\Hgabka\MediaBundle\Entity\Media->getUrl()
(vendor/twig/twig/src/Extension/CoreExtension.php:1499)
at twig_get_attribute(object(Environment), object(Source), object(Media), 'url', array(), 'any', false, false, false, 17)
(var/cache/dev/twig/de/de8924752e0b948dfd96ae0d24b25f01c402a307b862a7ff8eb9fc3db5c4fd2e.php:90)
at __TwigTemplate_c09a4060b6fd2c40091c688ad8061cb00e9968944f88f11e425cb91516c9aba6->doDisplay(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(NodeMenuItem), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true, '_parent' => array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(NodeMenuItem), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true, '_parent' => array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true), '_seq' => array(object(NodeMenuItem), object(NodeMenuItem), object(NodeMenuItem), object(NodeMenuItem)), 'loop' => array('parent' => array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true), 'index0' => 1, 'index' => 2, 'first' => false, 'revindex0' => 2, 'revindex' => 3, 'length' => 4, 'last' => false), 'key' => 1, 'children' => array(object(NodeMenuItem), object(NodeMenuItem))), '_seq' => array(object(NodeMenuItem), object(NodeMenuItem)), 'loop' => array('parent' => array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true), 'index0' => 1, 'index' => 2, 'first' => false, 'revindex0' => 2, 'revindex' => 3, 'length' => 4, 'last' => false), 'key' => 1, 'children' => array(object(NodeMenuItem), object(NodeMenuItem)), 'child' => object(NodeMenuItem), '_key' => 0, 'childPage' => object(ServicePage)), array())
(vendor/twig/twig/src/Template.php:407)
at Twig\Template->displayWithErrorHandling(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(NodeMenuItem), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true, '_parent' => array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true), '_seq' => array(object(NodeMenuItem), object(NodeMenuItem), object(NodeMenuItem), object(NodeMenuItem)), 'loop' => array('parent' => array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true), 'index0' => 1, 'index' => 2, 'first' => false, 'revindex0' => 2, 'revindex' => 3, 'length' => 4, 'last' => false), 'key' => 1, 'children' => array(object(NodeMenuItem), object(NodeMenuItem))), array())
(vendor/twig/twig/src/Template.php:380)
at Twig\Template->display(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(NodeMenuItem), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true, '_parent' => array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true), '_seq' => array(object(NodeMenuItem), object(NodeMenuItem), object(NodeMenuItem), object(NodeMenuItem)), 'loop' => array('parent' => array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true), 'index0' => 1, 'index' => 2, 'first' => false, 'revindex0' => 2, 'revindex' => 3, 'length' => 4, 'last' => false), 'key' => 1, 'children' => array(object(NodeMenuItem), object(NodeMenuItem))))
(var/cache/dev/twig/3f/3fe2d12d4fb34e7bbf65377616e859ef5d6ddfa2f725de4534680338b7f3b73a.php:118)
at __TwigTemplate_bebd7e693e3f052eb1dda75c7c9b05094875ed8442a784c5a87b50b8f6e28419->doDisplay(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(NodeMenuItem), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true, '_parent' => array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true), '_seq' => array(object(NodeMenuItem), object(NodeMenuItem), object(NodeMenuItem), object(NodeMenuItem)), 'loop' => array('parent' => array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true), 'index0' => 1, 'index' => 2, 'first' => false, 'revindex0' => 2, 'revindex' => 3, 'length' => 4, 'last' => false), 'key' => 1, 'children' => array(object(NodeMenuItem), object(NodeMenuItem))), array())
(vendor/twig/twig/src/Template.php:407)
at Twig\Template->displayWithErrorHandling(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true), array())
(vendor/twig/twig/src/Template.php:380)
at Twig\Template->display(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem), 'transparent' => true))
(var/cache/dev/twig/8c/8c9696593a92cfd585d0da57e4959e16c1b0c0f17911238bf3cc9ecbdc6940da.php:258)
at __TwigTemplate_39fd63d38b4e6e0f09bb60883f5b3aff46b867e2b57921e3dbb4746ffc55029d->block_header(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem)), array('title' => array(object(__TwigTemplate_39fd63d38b4e6e0f09bb60883f5b3aff46b867e2b57921e3dbb4746ffc55029d), 'block_title'), 'stylesheets' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_stylesheets'), 'header' => array(object(__TwigTemplate_39fd63d38b4e6e0f09bb60883f5b3aff46b867e2b57921e3dbb4746ffc55029d), 'block_header'), 'content' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_content'), 'javascripts' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_javascripts'), 'extra_body_classes' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_extra_body_classes'), 'breadcrumbs' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_breadcrumbs')))
(vendor/twig/twig/src/Template.php:184)
at Twig\Template->displayBlock('header', array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem)), array('title' => array(object(__TwigTemplate_39fd63d38b4e6e0f09bb60883f5b3aff46b867e2b57921e3dbb4746ffc55029d), 'block_title'), 'stylesheets' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_stylesheets'), 'header' => array(object(__TwigTemplate_39fd63d38b4e6e0f09bb60883f5b3aff46b867e2b57921e3dbb4746ffc55029d), 'block_header'), 'content' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_content'), 'javascripts' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_javascripts'), 'extra_body_classes' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_extra_body_classes'), 'breadcrumbs' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_breadcrumbs')))
(var/cache/dev/twig/8c/8c9696593a92cfd585d0da57e4959e16c1b0c0f17911238bf3cc9ecbdc6940da.php:164)
at __TwigTemplate_39fd63d38b4e6e0f09bb60883f5b3aff46b867e2b57921e3dbb4746ffc55029d->doDisplay(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'node' => object(Node), 'title' => 'SEO cím', 'homepagePageNode' => object(NodeMenuItem), 'activeSubnode' => object(NodeMenuItem)), array('title' => array(object(__TwigTemplate_39fd63d38b4e6e0f09bb60883f5b3aff46b867e2b57921e3dbb4746ffc55029d), 'block_title'), 'stylesheets' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_stylesheets'), 'header' => array(object(__TwigTemplate_39fd63d38b4e6e0f09bb60883f5b3aff46b867e2b57921e3dbb4746ffc55029d), 'block_header'), 'content' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_content'), 'javascripts' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_javascripts'), 'extra_body_classes' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_extra_body_classes'), 'breadcrumbs' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_breadcrumbs')))
(vendor/twig/twig/src/Template.php:407)
at Twig\Template->displayWithErrorHandling(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables)), array('title' => array(object(__TwigTemplate_39fd63d38b4e6e0f09bb60883f5b3aff46b867e2b57921e3dbb4746ffc55029d), 'block_title'), 'stylesheets' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_stylesheets'), 'header' => array(object(__TwigTemplate_39fd63d38b4e6e0f09bb60883f5b3aff46b867e2b57921e3dbb4746ffc55029d), 'block_header'), 'content' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_content'), 'javascripts' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_javascripts'), 'extra_body_classes' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_extra_body_classes'), 'breadcrumbs' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_breadcrumbs')))
(vendor/twig/twig/src/Template.php:380)
at Twig\Template->display(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables)), array('extra_body_classes' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_extra_body_classes'), 'breadcrumbs' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_breadcrumbs'), 'content' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_content'), 'stylesheets' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_stylesheets'), 'javascripts' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_javascripts')))
(var/cache/dev/twig/5a/5ab479d647e4ed7cf3805ddc238a5b1cfc1d546c3e74565a7d8a20592c5b0c5b.php:52)
at __TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d->doDisplay(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables)), array('extra_body_classes' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_extra_body_classes'), 'breadcrumbs' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_breadcrumbs'), 'content' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_content'), 'stylesheets' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_stylesheets'), 'javascripts' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_javascripts')))
(vendor/twig/twig/src/Template.php:407)
at Twig\Template->displayWithErrorHandling(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu), 'breadcrumb_manager' => object(BreadcrumbManager), 'wrap_fields_with_addons' => true, 'mail_builder' => object(MailBuilder), 'template_type_manager' => object(TemplateTypeManager), 'app' => object(AppVariable), 'nodebundleisactive' => true, 'publish_later_stepping' => '15', 'unpublish_later_stepping' => '15', 'upload_dir' => '/uploads/media/', 'mediabundleisactive' => true, 'mediamanager' => object(MediaManager), 'websitetitle' => 'Techfield', 'defaultlocale' => 'hu', 'requiredlocales' => 'hu', 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables)), array('extra_body_classes' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_extra_body_classes'), 'breadcrumbs' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_breadcrumbs'), 'content' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_content'), 'stylesheets' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_stylesheets'), 'javascripts' => array(object(__TwigTemplate_f5ffe7d3befa6fde55958cd1970e4c9d0703004a64b8ee235342652b5fb4c47d), 'block_javascripts')))
(vendor/twig/twig/src/Template.php:380)
at Twig\Template->display(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu)))
(vendor/twig/twig/src/Template.php:392)
at Twig\Template->render(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu)), array())
(vendor/twig/twig/src/TemplateWrapper.php:45)
at Twig\TemplateWrapper->render(array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu)))
(vendor/twig/twig/src/Environment.php:318)
at Twig\Environment->render('Pages/HomePage/view.html.twig', array('nodetranslation' => object(NodeTranslation), 'slug' => '', 'page' => object(HomePage), 'resource' => object(HomePage), 'nodemenu' => object(NodeMenu)))
(vendor/sensio/framework-extra-bundle/src/EventListener/TemplateListener.php:103)
at Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener->onKernelView(object(ViewEvent), 'kernel.view', object(TraceableEventDispatcher))
(vendor/symfony/event-dispatcher/Debug/WrappedListener.php:126)
at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(ViewEvent), 'kernel.view', object(TraceableEventDispatcher))
(vendor/symfony/event-dispatcher/EventDispatcher.php:264)
at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener)), 'kernel.view', object(ViewEvent))
(vendor/symfony/event-dispatcher/EventDispatcher.php:239)
at Symfony\Component\EventDispatcher\EventDispatcher->callListeners(array(object(WrappedListener), object(WrappedListener)), 'kernel.view', object(ViewEvent))
(vendor/symfony/event-dispatcher/EventDispatcher.php:73)
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch(object(ViewEvent), 'kernel.view')
(vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:168)
at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch(object(ViewEvent), 'kernel.view')
(vendor/symfony/http-kernel/HttpKernel.php:163)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/http-kernel/HttpKernel.php:80)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/http-kernel/Kernel.php:201)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(public/index.php:25)
@hgabka I can't quite make out your entity graph from your comments and the backtrace. You're saying that your Media
entity has a (lazy) association to another entity B
, and B
is a translatable and has a oneToMany to BTranslation
? Or is Media
the translatable?
From the backtrace it looks like you call getUrl
on a proxy of your Media entity.
No, childPage in twig is an entity that has a lazy connection media, and media entity is translatable. And the code worked fine until I ran composer update. And it also works with the fix I posted earlier. But produces the error without it.
Page entity:
`class ServicePage extends AbstractPage implements HasPageTemplateInterface { /**
class Media implements TranslatableInterface { use TranslatableTrait; use TimestampableEntity; ...
In twig the code childPage.media.url
triggers the error, where childPage is a ServicePage.
Downgrading to 1.2.1 fixes the problem
It took a while to get to the bottom of this, but it should be fixed with 2.2.3!
@hgabka I am facing the same issue,. Is there anyway to fix this issue without applying the fix inside bundle? i mean by doing some changes inside entity or twig
@smuralidharan Is there a particular reason that you cannot update to 2.2.3?
@sandermarechal Unfortunately the problem still persists with 2.2.3. @smuralidharan You can try to switch to eager fetch for the relation whose inversed side is translatable.
@sandermarechal In 'setReflectionPropertyValue' you still use get_class($object)
that is the problem. You should pass at least $class
to the method and use that instead of the get_class.
I have added an extra check to load proxy objects before setting properties on it. It's on dev-master. Can you confirm if that works? If so I will tag a new release.
Hello, unfortunately it still does not work. Proxy::__load does not alter the class of the object just loads the data for it. So the class of $object remains the proxy class, and thus, when reflected, the corresponding property for it still cannot be found. You should reflect the real class instead, which is grabbed in the method and loaded into the $class variable. Calling the reflection on that one will work flawlessly.
Sorry it took me some time to get back to this. How about now? Does this work?
Hello,
I found a bug in Translatable listener, as the ReflectionProperty in 'setReflectionPropertyValue' method fails for Proxy classes.
The fix could be to use the metadata to get the real class in the method:
$reflection = new \ReflectionProperty($em->getClassMetadata(get_class($object))->getName(), $property);
Of course for this to work the entity manager ($em) should be passed to the method from the postLoad method (it can be acquired from the $args argument).