Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

JMS\Serializer error #74

Closed
RSalo opened this issue Oct 23, 2020 · 0 comments
Closed

JMS\Serializer error #74

RSalo opened this issue Oct 23, 2020 · 0 comments

Comments

@RSalo
Copy link
Contributor

RSalo commented Oct 23, 2020

Environment

Symfony: 4.4.15
PHP: 7.4

Symfony packages

brick/math                                 0.9.1   Arbitrary-precision arithmetic library
cocur/slugify                              v4.0.0  Converts a string into a slug.
composer/package-versions-deprecated       1.11.99 Composer plugin that provides efficient querying for installed packa...
dantleech/glob-finder                      1.0.0   Library offering object location from hierarchrical persistent stora...
doctrine/annotations                       1.10.4  Docblock Annotations Parser
doctrine/cache                             1.10.2  PHP Doctrine Cache library is a popular cache implementation that su...
doctrine/collections                       1.6.7   PHP Doctrine Collections library that adds additional functionality ...
doctrine/common                            2.13.3  PHP Doctrine Common project is a library that provides additional fu...
doctrine/data-fixtures                     1.4.4   Data Fixtures for all Doctrine Object Managers
doctrine/dbal                              2.12.0  Powerful PHP database abstraction layer (DBAL) with many features fo...
doctrine/doctrine-bundle                   2.1.2   Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle          3.3.2   Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle        3.0.1   Symfony DoctrineMigrationsBundle
doctrine/event-manager                     1.1.1   The Doctrine Event Manager is a simple PHP event system that was bui...
doctrine/inflector                         1.4.3   PHP Doctrine Inflector is a small library that can perform string ma...
doctrine/instantiator                      1.3.1   A small, lightweight utility to instantiate objects in PHP without i...
doctrine/lexer                             1.2.1   PHP Doctrine Lexer parser library that can be used in Top-Down, Recu...
doctrine/migrations                        3.0.1   PHP Doctrine Migrations project offer additional functionality on to...
doctrine/orm                               2.7.4   Object-Relational-Mapper for PHP
doctrine/persistence                       1.3.8   The Doctrine Persistence project is a set of shared interfaces and f...
doctrine/phpcr-bundle                      2.1.2   Symfony DoctrinePHPCRBundle
doctrine/phpcr-odm                         1.5.2   Object-Document-Mapper for PHPCR
doctrine/reflection                        1.2.1   The Doctrine Reflection project is a simple library used by the vari...
doctrine/sql-formatter                     1.1.1   a PHP SQL highlighting library
egulias/email-validator                    2.1.22  A library for validating emails against several RFCs
friendsofsymfony/jsrouting-bundle          2.6.0   A pretty nice way to expose your Symfony2 routing to client applicat...
friendsofsymfony/user-bundle               v2.1.2  Symfony FOSUserBundle
jackalope/jackalope                        1.4.2   Jackalope PHPCR library
jackalope/jackalope-doctrine-dbal          1.5.1   Jackalope Transport library for Doctrine DBAL
jms/metadata                               2.3.0   Class/method/property metadata management in PHP
jms/serializer                             3.9.0   Library for (de-)serializing data of any complexity; supports XML, J...
jms/serializer-bundle                      3.7.0   Allows you to easily serialize, and deserialize data of any complexity
knplabs/knp-menu                           2.6.0   An object oriented menu library
knplabs/knp-menu-bundle                    v2.3.0  This bundle provides an integration of the KnpMenu library
laminas/laminas-code                       3.4.1   Extensions to the PHP Reflection API, static code scanning, and code...
laminas/laminas-eventmanager               3.3.0   Trigger and listen to events within a PHP application
laminas/laminas-zendframework-bridge       1.1.1   Alias legacy ZF class names to Laminas Project equivalents.
monolog/monolog                            1.25.5  Sends your logs to files, sockets, inboxes, databases and various we...
nikic/php-parser                           v4.10.2 A PHP parser written in PHP
ocramius/proxy-manager                     2.8.0   A library providing utilities to generate, instantiate and generally...
phpcr/phpcr                                2.1.6   PHP Content Repository interfaces
phpcr/phpcr-utils                          1.5.1   PHP Content Repository implementation independant utilities
phpdocumentor/reflection-common            1.0.1   Common reflection classes used by phpdocumentor to reflect the code ...
phpdocumentor/reflection-docblock          3.3.2   With this component, a library can provide support for annotations v...
phpdocumentor/type-resolver                0.4.0  
psr/cache                                  1.0.1   Common interface for caching libraries
psr/container                              1.0.0   Common Container Interface (PHP FIG PSR-11)
psr/link                                   1.0.0   Common interfaces for HTTP links
psr/log                                    1.1.3   Common interface for logging libraries
ramsey/collection                          1.1.1   A PHP 7.2+ library for representing and manipulating collections.
ramsey/uuid                                4.1.1   A PHP library for generating and working with universally unique ide...
ramsey/uuid-doctrine                       1.6.0   Allow the use of ramsey/uuid as a Doctrine field type.
sensio/framework-extra-bundle              v5.6.1  This bundle provides a way to configure your controllers with annota...
sonata-project/admin-bundle                3.74.0  The missing Symfony Admin Generator
sonata-project/block-bundle                3.20.0  Symfony SonataBlockBundle
sonata-project/cache                       2.0.1   Cache library
sonata-project/core-bundle                 3.20.0  Symfony SonataCoreBundle (abandoned)
sonata-project/datagrid-bundle             2.5.0   Symfony SonataDatagridBundle
sonata-project/doctrine-extensions         1.10.1  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle   3.24    Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/doctrine-phpcr-admin-bundle 2.3.0   Symfony Sonata / Integrate Doctrine PHPCR into the SonataAdminBundle
sonata-project/easy-extends-bundle         2.5.0   Symfony SonataEasyExtendsBundle
sonata-project/exporter                    2.4.1   Lightweight Exporter library
sonata-project/form-extensions             0.1.2   Symfony form extensions
sonata-project/twig-extensions             0.1.1   Sonata twig extensions
sonata-project/user-bundle                 4.8.0   Symfony SonataUserBundle
swiftmailer/swiftmailer                    v6.2.3  Swiftmailer, free feature-rich PHP mailer
symfony-cmf/block-bundle                   2.1.1   Symfony CMF Block Bundle
symfony-cmf/content-bundle                 2.1.0   Symfony CMF Content Bundle
symfony-cmf/core-bundle                    2.1.1   Symfony CMF Core Bundle
symfony-cmf/menu-bundle                    2.2.0   Symfony CMF Menu Bundle
symfony-cmf/resource                       1.1.0   Bundle which facilitates document resource location via Puli
symfony-cmf/resource-bundle                1.1.0   Bundle which facilitates document resource location
symfony-cmf/resource-rest-bundle           1.1.1   Bundle which provides a REST API for resources
symfony-cmf/routing                        2.3.3   Extends the Symfony routing component for dynamic routes and chainin...
symfony-cmf/routing-bundle                 2.4.0   Symfony RoutingBundle
symfony-cmf/symfony-cmf                    2.1.0   Symfony Content Management Framework
symfony-cmf/tree-browser-bundle            2.1.1   Symfony CMF Tree Browser Bundle
symfony/asset                              v4.4.15 Symfony Asset Component
symfony/browser-kit                        v4.4.15 Symfony BrowserKit Component
symfony/cache                              v4.4.15 Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts                    v2.2.0  Generic abstractions related to caching
symfony/config                             v4.4.15 Symfony Config Component
symfony/console                            v4.4.15 Symfony Console Component
symfony/css-selector                       v4.4.15 Symfony CssSelector Component
symfony/debug                              v4.4.15 Symfony Debug Component
symfony/debug-bundle                       v4.4.15 Symfony DebugBundle
symfony/dependency-injection               v4.4.15 Symfony DependencyInjection Component
symfony/doctrine-bridge                    v4.4.15 Symfony Doctrine Bridge
symfony/dom-crawler                        v4.4.15 Symfony DomCrawler Component
symfony/dotenv                             v4.4.15 Registers environment variables from a .env file
symfony/error-handler                      v4.4.15 Symfony ErrorHandler Component
symfony/event-dispatcher                   v4.4.15 Symfony EventDispatcher Component
symfony/event-dispatcher-contracts         v1.1.9  Generic abstractions related to dispatching event
symfony/expression-language                v4.4.15 Symfony ExpressionLanguage Component
symfony/filesystem                         v4.4.15 Symfony Filesystem Component
symfony/finder                             v4.4.15 Symfony Finder Component
symfony/flex                               v1.9.10 Composer plugin for Symfony
symfony/form                               v4.4.15 Symfony Form Component
symfony/framework-bundle                   v4.4.15 Symfony FrameworkBundle
symfony/http-client                        v4.4.15 Symfony HttpClient component
symfony/http-client-contracts              v2.3.1  Generic abstractions related to HTTP clients
symfony/http-foundation                    v4.4.15 Symfony HttpFoundation Component
symfony/http-kernel                        v4.4.15 Symfony HttpKernel Component
symfony/inflector                          v4.4.15 Symfony Inflector Component
symfony/intl                               v4.4.15 A PHP replacement layer for the C intl extension that includes addit...
symfony/mailer                             v4.4.15 Symfony Mailer Component
symfony/maker-bundle                       v1.22.0 Symfony Maker helps you create empty commands, controllers, form cla...
symfony/mime                               v4.4.15 A library to manipulate MIME messages
symfony/monolog-bridge                     v4.4.15 Symfony Monolog Bridge
symfony/monolog-bundle                     v3.6.0  Symfony MonologBundle
symfony/options-resolver                   v4.4.15 Symfony OptionsResolver Component
symfony/phpunit-bridge                     v5.1.7  Symfony PHPUnit Bridge
symfony/polyfill-intl-grapheme             v1.19.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu                  v1.19.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn                  v1.19.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer           v1.19.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring                  v1.19.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72                     v1.19.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP ver...
symfony/polyfill-php73                     v1.19.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP ver...
symfony/polyfill-php80                     v1.19.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP ver...
symfony/process                            v4.4.15 Symfony Process Component
symfony/property-access                    v4.4.15 Symfony PropertyAccess Component
symfony/property-info                      v4.4.15 Symfony Property Info Component
symfony/routing                            v4.4.15 Symfony Routing Component
symfony/security-acl                       v3.1.0  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle                    v4.4.15 Symfony SecurityBundle
symfony/security-core                      v4.4.15 Symfony Security Component - Core Library
symfony/security-csrf                      v4.4.15 Symfony Security Component - CSRF Library
symfony/security-guard                     v4.4.15 Symfony Security Component - Guard
symfony/security-http                      v4.4.15 Symfony Security Component - HTTP Integration
symfony/serializer                         v4.4.15 Symfony Serializer Component
symfony/service-contracts                  v2.2.0  Generic abstractions related to writing services
symfony/stopwatch                          v4.4.15 Symfony Stopwatch Component
symfony/string                             v5.1.7  Symfony String component
symfony/templating                         v4.4.15 Symfony Templating Component
symfony/translation                        v4.4.15 Symfony Translation Component
symfony/translation-contracts              v2.3.0  Generic abstractions related to translation
symfony/twig-bridge                        v4.4.15 Symfony Twig Bridge
symfony/twig-bundle                        v4.4.15 Symfony TwigBundle
symfony/validator                          v4.4.15 Symfony Validator Component
symfony/var-dumper                         v4.4.15 Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter                       v4.4.15 A blend of var_export() + serialize() to turn any serializable data ...
symfony/web-link                           v4.4.15 Symfony WebLink Component
symfony/web-profiler-bundle                v4.4.15 Symfony WebProfilerBundle
symfony/yaml                               v4.4.15 Symfony Yaml Component
twig/extensions                            v1.5.4  Common additional features for Twig that do not directly belong in core
twig/extra-bundle                          v3.1.0  A Symfony bundle for extra Twig extensions
twig/string-extra                          v3.1.0  A Twig extension for Symfony String
twig/twig                                  v2.14.0 Twig, the flexible, fast, and secure template language for PHP
webimpress/safe-writer                     2.1.0   Tool to write files safely, to avoid race conditions
webmozart/assert                           1.9.1   Assertions to validate method input/output with nice error messages.
webmozart/path-util                        2.3.0   A robust cross-platform utility for normalizing, comparing and modif...
willdurand/jsonp-callback-validator        v1.1.0  JSONP callback validator.

Subject

Resource rest bundle by following the officially manual from Sonata "DOCTRINE2 PHPCR ADMIN"

Steps to reproduce

Following this manual https://sonata-project.org/bundles/doctrine-phpcr-admin/master/doc/reference/document_tree.html

Expected results

It should work.

Actual results

Symfony\Component\ErrorHandler\Error\UndefinedMethodError: Attempted to call an undefined method named "accept" of class "JMS\Serializer\SerializationContext".

at vendor/symfony-cmf/resource-rest-bundle/src/Serializer/Jms/Handler/ResourceHandler.php:82
at Symfony\Cmf\Bundle\ResourceRestBundle\Serializer\Jms\Handler\ResourceHandler->serializeResource(object(JsonSerializationVisitor), object(PhpcrOdmResource), array('name' => 'Puli\Repository\Api\Resource\PuliResource', 'params' => array()), object(SerializationContext))
(vendor/jms/serializer/src/GraphNavigator/SerializationGraphNavigator.php:198)
at JMS\Serializer\GraphNavigator\SerializationGraphNavigator->accept(object(PhpcrOdmResource), array('name' => 'Puli\Repository\Api\Resource\PuliResource', 'params' => array()))
(vendor/jms/serializer/src/Serializer.php:249)
at JMS\Serializer\Serializer->visit(object(SerializationGraphNavigator), object(JsonSerializationVisitor), object(SerializationContext), object(PhpcrOdmResource), 'json', null)
(vendor/jms/serializer/src/Serializer.php:162)
at JMS\Serializer\Serializer->serialize(object(PhpcrOdmResource), 'json', object(SerializationContext))
(vendor/symfony-cmf/resource-rest-bundle/src/Controller/ResourceController.php:206)
at Symfony\Cmf\Bundle\ResourceRestBundle\Controller\ResourceController->createResponse(object(PhpcrOdmResource))
(vendor/symfony-cmf/resource-rest-bundle/src/Controller/ResourceController.php:85)
at Symfony\Cmf\Bundle\ResourceRestBundle\Controller\ResourceController->getResourceAction(object(Request), 'default', '/cms/blocks')
(vendor/symfony/http-kernel/HttpKernel.php:158)
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)

It doesn't work. We need to update JMS\Serializer package version to 2.1+. For now, we have in this package ^1.2. We have no possibilities downgrade JSM to 1.2 another way we crashing sonata-core package where is using JMS 2.1+. It's related with this PR #symfony-cmf/routing-auto/pull/122
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant