Closed t-works closed 2 years ago
After adding this to ckeditor.xml the above bug disappears: <service id="sonata.formatter.ckeditor.extension.controller" class="%sonata.formatter.ckeditor.extension.controller.class%" public="true">
<tag name="container.service_subscriber" />
<tag name="controller.service_arguments" />
<call method="setContainer">
<argument type="service" id="Psr\Container\ContainerInterface"/>
</call>
</service>
You may check my fork here: https://github.com/t-works/SonataFormatterBundle/tree/5.x I also fixed a number of issues in twig templates that triggered errors with symfony 6 however the upload does not work at the moment - seems that file is not sent with request: /admin/app/sonatamediamedia/ckeditor_upload?provider=sonata.media.provider.image&context=my-context&format=my-big&CKEditor=s629d71329f98c_body&CKEditorFuncNum=3&langCode=en
Indeed, we should add the config similar to MediaBundle: https://github.com/sonata-project/SonataMediaBundle/blob/4.x/src/Resources/config/controllers.php#L24-L27
Do you want to provide a PR @t-works ?
We should also migrate the config to the php one. I added this TODO here https://github.com/sonata-project/dev-kit/issues/1715 then we should create a pre-release.
Sure, I can provide a PR. Sorry it was busy week. I will look into that during weekend.
wt., 7 cze 2022, 10:25 użytkownik Vincent Langlet @.***> napisał:
Indeed, we should add the config similar to MediaBundle:
Do you want to provide a PR @t-works https://github.com/t-works ?
We should also migrate the config to the php one. I added this TODO here sonata-project/dev-kit#1715 https://github.com/sonata-project/dev-kit/issues/1715 then we should create a pre-release.
— Reply to this email directly, view it on GitHub https://github.com/sonata-project/SonataFormatterBundle/issues/669#issuecomment-1148357573, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJDRXYO4N4NDHGS536HUHMTVN4BQNANCNFSM5X3Y3HWA . You are receiving this because you were mentioned.Message ID: @.***>
I had to do some more work to make it functional. Especially in the twig templates. Some lines triggered syntax errors. Also some references to variables in admin object passed to template were incorrect. It appears template was written with phpcr admin in mind (used variables/function calls that exist in phpcr model admin manager but not in ModelManagerInterface and not in SonataDoctrineORMAdminBundle ModelManager)
Now the bundle tests browser and upload routes, with functional tests using doctrine orm admin bundle, from 4.4 up to 6.1 versions of Symfony.
Can you check the 5.x-dev (without your PR) on your project to see if everything works?
Anyway this error should not be reported anymore, let's close this issue and focus on the next problems (if there are any)
Environment
Sonata packages
show
```sonata-project/admin-bundle 4.12.0 4.12.0 The missing Symfony Admin Generator sonata-project/block-bundle 4.13.0 4.13.0 Symfony SonataBlockBundle sonata-project/cache 2.2.0 2.2.0 Cache library Package sonata-project/cache is abandoned, you should avoid using it. No replacement was suggested. sonata-project/doctrine-extensions 1.17.0 1.17.0 Doctrine2 behavioral extensions sonata-project/doctrine-orm-admin-bundle 4.3.0 4.3.0 Integrate Doctrine ORM into the SonataAdminBundle sonata-project/exporter 2.12.0 2.12.0 Lightweight Exporter library sonata-project/form-extensions 1.16.1 1.16.1 Symfony form extensions sonata-project/formatter-bundle 5.x-dev e1c640c 5.x-dev e1c640c Symfony SonataFormatterBundle sonata-project/media-bundle 4.1.5 4.1.5 Symfony SonataMediaBundle sonata-project/twig-extensions 1.10.0 1.10.0 Sonata twig extensions ```
Symfony packages
show
``` symfony/asset v6.1.0 v6.1.0 Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files symfony/cache v6.1.0 v6.1.0 Provides an extended PSR-6, PSR-16 (and tags) implementation symfony/cache-contracts v3.1.0 v3.1.0 Generic abstractions related to caching symfony/config v6.1.0 v6.1.0 Helps you find, load, combine, autofill and validate configuration values of any kind symfony/console v6.1.0 v6.1.0 Eases the creation of beautiful and testable command line interfaces symfony/dependency-injection v6.1.0 v6.1.0 Allows you to standardize and centralize the way objects are constructed in your application symfony/deprecation-contracts v3.1.0 v3.1.0 A generic function and convention to trigger deprecation notices symfony/doctrine-bridge v6.1.0 v6.1.0 Provides integration for Doctrine with various Symfony components symfony/dotenv v6.1.0 v6.1.0 Registers environment variables from a .env file symfony/error-handler v6.1.0 v6.1.0 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher v6.1.0 v6.1.0 Provides tools that allow your application components to communicate with each other by dispatching events and listening to them symfony/event-dispatcher-contracts v3.1.0 v3.1.0 Generic abstractions related to dispatching event symfony/expression-language v6.1.0 v6.1.0 Provides an engine that can compile and evaluate expressions symfony/filesystem v6.1.0 v6.1.0 Provides basic utilities for the filesystem symfony/finder v6.1.0 v6.1.0 Finds files and directories via an intuitive fluent interface symfony/flex v2.1.8 v2.2.0 Composer plugin for Symfony symfony/form v6.1.0 v6.1.0 Allows to easily create, process and reuse HTML forms symfony/framework-bundle v6.1.0 v6.1.0 Provides a tight integration between Symfony components and the Symfony full-stack framework symfony/http-client v6.1.0 v6.1.0 Provides powerful methods to fetch HTTP resources synchronously or asynchronously symfony/http-client-contracts v3.1.0 v3.1.0 Generic abstractions related to HTTP clients symfony/http-foundation v6.1.0 v6.1.0 Defines an object-oriented layer for the HTTP specification symfony/http-kernel v6.1.0 v6.1.0 Provides a structured process for converting a Request into a Response symfony/maker-bundle v1.43.0 v1.43.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code. symfony/mime v6.1.0 v6.1.0 Allows manipulating MIME messages symfony/options-resolver v6.1.0 v6.1.0 Provides an improved replacement for the array_replace PHP function symfony/password-hasher v6.1.0 v6.1.0 Provides password hashing utilities symfony/polyfill-intl-grapheme v1.25.0 v1.26.0 Symfony polyfill for intl's grapheme_* functions symfony/polyfill-intl-icu v1.25.0 v1.26.0 Symfony polyfill for intl's ICU-related data and classes symfony/polyfill-intl-idn v1.25.0 v1.26.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer v1.25.0 v1.26.0 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring v1.25.0 v1.26.0 Symfony polyfill for the Mbstring extension symfony/property-access v6.1.0 v6.1.0 Provides functions to read and write from/to an object or array using a simple string notation symfony/proxy-manager-bridge v6.1.0 v6.1.0 Provides integration for ProxyManager with various Symfony components symfony/routing v6.1.0 v6.1.0 Maps an HTTP request to a set of configuration variables symfony/runtime v6.1.0 v6.1.0 Enables decoupling PHP applications from global state symfony/security-acl v3.3.1 v3.3.1 Symfony Security Component - ACL (Access Control List) symfony/security-bundle v6.1.0 v6.1.0 Provides a tight integration of the Security component into the Symfony full-stack framework symfony/security-core v6.1.0 v6.1.0 Symfony Security Component - Core Library symfony/security-csrf v6.1.0 v6.1.0 Symfony Security Component - CSRF Library symfony/security-http v6.1.0 v6.1.0 Symfony Security Component - HTTP Integration symfony/service-contracts v3.1.0 v3.1.0 Generic abstractions related to writing services symfony/stopwatch v6.1.0 v6.1.0 Provides a way to profile code symfony/string v6.1.0 v6.1.0 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way symfony/translation v6.1.0 v6.1.0 Provides tools to internationalize your application symfony/translation-contracts v3.1.0 v3.1.0 Generic abstractions related to translation symfony/twig-bridge v6.1.0 v6.1.0 Provides integration for Twig with various Symfony components symfony/twig-bundle v6.1.0 v6.1.0 Provides a tight integration of Twig into the Symfony full-stack framework symfony/validator v6.1.0 v6.1.0 Provides tools to validate values symfony/var-dumper v6.1.0 v6.1.0 Provides mechanisms for walking through any arbitrary PHP variable symfony/var-exporter v6.1.0 v6.1.0 Allows exporting any serializable PHP data structure to plain PHP code symfony/web-link v6.1.0 v6.1.0 Manages links between resources symfony/yaml v6.1.0 v6.1.0 Loads and dumps YAML files PS C:\var\projects\stronaklubu2> $ composer show --latest 'sonata-project/*' $ : The term '$' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + ~ + CategoryInfo : ObjectNotFound: ($:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\var\projects\stronaklubu2> composer show --latest 'sonata-project/*' Info from https://repo.packagist.org: #StandWithUkraine Color legend: - patch or minor release available - update recommended - major release available - update possible - up to date version sonata-project/admin-bundle 4.12.0 4.12.0 The missing Symfony Admin Generator sonata-project/block-bundle 4.13.0 4.13.0 Symfony SonataBlockBundle sonata-project/cache 2.2.0 2.2.0 Cache library Package sonata-project/cache is abandoned, you should avoid using it. No replacement was suggested. sonata-project/doctrine-extensions 1.17.0 1.17.0 Doctrine2 behavioral extensions sonata-project/doctrine-orm-admin-bundle 4.3.0 4.3.0 Integrate Doctrine ORM into the SonataAdminBundle sonata-project/exporter 2.12.0 2.12.0 Lightweight Exporter library sonata-project/form-extensions 1.16.1 1.16.1 Symfony form extensions sonata-project/formatter-bundle 5.x-dev e1c640c 5.x-dev e1c640c Symfony SonataFormatterBundle sonata-project/media-bundle 4.1.5 4.1.5 Symfony SonataMediaBundle sonata-project/twig-extensions 1.10.0 1.10.0 Sonata twig extensions PS C:\var\projects\stronaklubu2> composer show --latest 'symfony/*' Info from https://repo.packagist.org: #StandWithUkraine Color legend: - patch or minor release available - update recommended - major release available - update possible - up to date version symfony/asset v6.1.0 v6.1.0 Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files symfony/cache v6.1.0 v6.1.0 Provides an extended PSR-6, PSR-16 (and tags) implementation symfony/cache-contracts v3.1.0 v3.1.0 Generic abstractions related to caching symfony/config v6.1.0 v6.1.0 Helps you find, load, combine, autofill and validate configuration values of any kind symfony/console v6.1.0 v6.1.0 Eases the creation of beautiful and testable command line interfaces symfony/dependency-injection v6.1.0 v6.1.0 Allows you to standardize and centralize the way objects are constructed in your application symfony/deprecation-contracts v3.1.0 v3.1.0 A generic function and convention to trigger deprecation notices symfony/doctrine-bridge v6.1.0 v6.1.0 Provides integration for Doctrine with various Symfony components symfony/dotenv v6.1.0 v6.1.0 Registers environment variables from a .env file symfony/error-handler v6.1.0 v6.1.0 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher v6.1.0 v6.1.0 Provides tools that allow your application components to communicate with each other by dispatching events and listening to them symfony/event-dispatcher-contracts v3.1.0 v3.1.0 Generic abstractions related to dispatching event symfony/expression-language v6.1.0 v6.1.0 Provides an engine that can compile and evaluate expressions symfony/filesystem v6.1.0 v6.1.0 Provides basic utilities for the filesystem symfony/finder v6.1.0 v6.1.0 Finds files and directories via an intuitive fluent interface symfony/flex v2.1.8 v2.2.0 Composer plugin for Symfony symfony/form v6.1.0 v6.1.0 Allows to easily create, process and reuse HTML forms symfony/framework-bundle v6.1.0 v6.1.0 Provides a tight integration between Symfony components and the Symfony full-stack framework symfony/http-client v6.1.0 v6.1.0 Provides powerful methods to fetch HTTP resources synchronously or asynchronously symfony/http-client-contracts v3.1.0 v3.1.0 Generic abstractions related to HTTP clients symfony/http-foundation v6.1.0 v6.1.0 Defines an object-oriented layer for the HTTP specification symfony/http-kernel v6.1.0 v6.1.0 Provides a structured process for converting a Request into a Response symfony/maker-bundle v1.43.0 v1.43.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code. symfony/mime v6.1.0 v6.1.0 Allows manipulating MIME messages symfony/options-resolver v6.1.0 v6.1.0 Provides an improved replacement for the array_replace PHP function symfony/password-hasher v6.1.0 v6.1.0 Provides password hashing utilities symfony/polyfill-intl-grapheme v1.25.0 v1.26.0 Symfony polyfill for intl's grapheme_* functions symfony/polyfill-intl-icu v1.25.0 v1.26.0 Symfony polyfill for intl's ICU-related data and classes symfony/polyfill-intl-idn v1.25.0 v1.26.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer v1.25.0 v1.26.0 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring v1.25.0 v1.26.0 Symfony polyfill for the Mbstring extension symfony/property-access v6.1.0 v6.1.0 Provides functions to read and write from/to an object or array using a simple string notation symfony/property-info v6.1.0 v6.1.0 Extracts information about PHP class' properties using metadata of popular sources symfony/proxy-manager-bridge v6.1.0 v6.1.0 Provides integration for ProxyManager with various Symfony components symfony/routing v6.1.0 v6.1.0 Maps an HTTP request to a set of configuration variables symfony/runtime v6.1.0 v6.1.0 Enables decoupling PHP applications from global state symfony/security-acl v3.3.1 v3.3.1 Symfony Security Component - ACL (Access Control List) symfony/security-bundle v6.1.0 v6.1.0 Provides a tight integration of the Security component into the Symfony full-stack framework symfony/security-core v6.1.0 v6.1.0 Symfony Security Component - Core Library symfony/security-csrf v6.1.0 v6.1.0 Symfony Security Component - CSRF Library symfony/security-http v6.1.0 v6.1.0 Symfony Security Component - HTTP Integration symfony/serializer v6.1.0 v6.1.0 Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON. symfony/service-contracts v3.1.0 v3.1.0 Generic abstractions related to writing services symfony/stopwatch v6.1.0 v6.1.0 Provides a way to profile code symfony/string v6.1.0 v6.1.0 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way symfony/translation v6.1.0 v6.1.0 Provides tools to internationalize your application symfony/translation-contracts v3.1.0 v3.1.0 Generic abstractions related to translation symfony/twig-bridge v6.1.0 v6.1.0 Provides integration for Twig with various Symfony components symfony/twig-bundle v6.1.0 v6.1.0 Provides a tight integration of Twig into the Symfony full-stack framework symfony/validator v6.1.0 v6.1.0 Provides tools to validate values symfony/var-dumper v6.1.0 v6.1.0 Provides mechanisms for walking through any arbitrary PHP variable symfony/var-exporter v6.1.0 v6.1.0 Allows exporting any serializable PHP data structure to plain PHP code symfony/web-link v6.1.0 v6.1.0 Manages links between resources symfony/yaml v6.1.0 v6.1.0 Loads and dumps YAML files ```
PHP version
Subject
Clicking on the Browse Server in FCK editor causer error
Minimal repository with the bug
https://github.com/t-works/sonataFCKeditor_formatter_bug
Steps to reproduce
Expected results
Have the FCK upload/browse server
Actual results
"Sonata\FormatterBundle\Controller\CkeditorAdminController" has no container set, did you forget to define it as a service subscriber? ExceptionStack Trace LogicException in [project path]vendor\symfony\framework-bundle\Controller\ControllerResolver.php (line 36) ControllerResolver->instantiateController('Sonata\FormatterBundle\Controller\CkeditorAdminController') in [project path]vendor\symfony\http-kernel\Controller\ControllerResolver.php (line 109) ControllerResolver->createController('Sonata\FormatterBundle\Controller\CkeditorAdminController::browserAction') in [project path]vendor\symfony\http-kernel\Controller\ControllerResolver.php (line 77) ControllerResolver->getController(object(Request)) in [project path]vendor\symfony\http-kernel\Controller\TraceableControllerResolver.php (line 38) TraceableControllerResolver->getController(object(Request)) in [project path]vendor\symfony\http-kernel\HttpKernel.php (line 135) HttpKernel->handleRaw(object(Request), 1) in [project path]vendor\symfony\http-kernel\HttpKernel.php (line 74) HttpKernel->handle(object(Request), 1, true) in [project path]vendor\symfony\http-kernel\Kernel.php (line 202) Kernel->handle(object(Request)) in [project path]vendor\symfony\runtime\Runner\Symfony\HttpKernelRunner.php (line 35) HttpKernelRunner->run() in [project path]vendor\autoload_runtime.php (line 29) require_once('C:\var\projects\stronaklubu2\vendor\autoload_runtime.php') in [project path]public\index.php (line 5)
Notes
check in symfony/framework-bundle/Controller/ControllerResolver.php fails because the container is not set in Sonata\FormatterBundle\Controller\CkeditorAdminController
CkeditorAdminController does not implement ContainerAwareInterface
Container is not injected in any other way during the initialization
I didn't find any information in the sonata formatter docs describing a way or a need to inject container manually