symfony 4.4 sonata admin and sonata user compatible issue - symfony

I tried to install symfony 4.4 instead. after the installation, I tried to install sonata user bundle and got this error:
The child node "db_driver" at path "fos_user" must be configured.
then I followed this link
https://stackoverflow.com/a/49034641 to create fos_user.yaml
and I got this error:
The service "fos_user.mailer.default" has a dependency on a non-existent service "templating".
then I followed this link
FriendsOfSymfony/FOSUserBundle#2679 (comment)
and I got this error:
The service "sonata.user.admin.user" has a dependency on a non-existent service "sonata.admin.manager.orm".
and I followed this link:
#1050 (comment)
and I got this error:
There is no extension able to load the configuration for "fos_user" (in "/fsys1/home/public_html/mycel7/config/packages/fos_user.yaml"). Looked for namespace "fos_user", found ""framework", "sensio_framework_extra","twig", "web_profiler", "monolog", "debug", "maker", "doctrine", "doctrine_migrations", "security", "twig_extra", "knp_menu", "sonata_doctrine", "sonata_twig", "sonata_form", "sonata_block", "sonata_exporter", "sonata_admin","sonata_doctrine_orm_admin"" in /fsys1/home/public_html/mycel7/config/packages/fos_user.yaml (which is loaded in resource "/fsys1/home/public_html/mycel7/config/packages/fos_user.yaml").
at this step I am not sure what to do then.
This is my config/packages/fos_user.yaml :
fos_user: db_driver: orm firewall_name: main user_class: Entity\User from_email: address: "test#gmail.com" sender_name: "test"
This is my config/packages/framework.yaml:
framework: secret: '%env(APP_SECRET)%' session: handler_id: null cookie_secure: auto cookie_samesite: lax #esi: true #fragments: true php_errors: log: true templating: engines: twig
symfony version is 4.4.
other files are un-touched

Related

Error while installing friendsofsymfony/user-bundle and friendsofsymfony/oauth-server-bundle

I was following this tutorial. Problem for me occured when i was trying to install friends of symfony user-bundle and/or oauth-server-bundle via composer.
Only thing I found out googling was someone asking same question 12 days ago https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/issues/638
I would not recommend FOSUserBundle. Nowaydays it's not really necessary anymore as Symfony's security component together with the docs or the MakerBundle delivers most of what you need the bundle for.
If you insist on using it, try setting up the bundle configuration in your config.yml and then try composer require again. In your case the problem is the missing configuration for the bundle, see Step 5: Configure the FOSUserBundle in the docs.
# app/config/config.yml
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
user_class: AppBundle\Entity\User
from_email:
address: "%mailer_user%"
sender_name: "%mailer_user%"
As you can see the missing first section db_driver is exactly what your error message complains about.

Symfony3 + Assetic : ParameterNotFoundException

I'm working on a Symfony 3.4 application. Assetic bundle wasn't installed, so I made :
$ composer require symfony/assetic-bundle
and add it in the appKernel.php :
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
It worked perfect. Then, in my app/config/config.yml, I added :
# app/config/config.yml
assetic:
debug: '%kernel.debug%'
use_controller: '%kernel.debug%'
filters:
cssrewrite: ~
# ...
and now my front-end is no more available, this is the error displayed with app_dev.php :
ParameterNotFoundException You have requested a non-existent parameter
"templating.engines".
Even if I remove the Assetic configuration out of the config.yml the error is here. I have been searching in all my *.yml files I do not find any property "templating.engines" .... any idea ?
Try adding the following in the config.yml
framework:
...
templating:
engines: ['twig']

Symfony3: The service "security.firewall.map.context.main" has a dependency on a non-existent service "security.csrf.token_manager"

Symfony 3.0.7
I trying to disable csrf protection globally:
framework:
csrf_protection: false
And then I have exception:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "security.firewall.map.context.main" has a dependency on a non-existent service "security.csrf.token_manager".
But service "security.csrf.token_manager" exists if I trying use it directly in code.
Full error backtrace:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "security.firewall.map.context.main" has a dependency on a non-existent service "security.csrf.token_manager".
/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:58
/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:42
/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:53
/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:51
/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:42
/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:36
/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:104
/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:545
/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:477
/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:117
/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:146
/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php:33
/var/www/studio.lc/src/Studio/Bundle/AdminBundle/Tests/Controller/SecuredAreaControllerWebTestCase.php:21
How can I fix it?
This is the following syntax in the config.yml :
csrf_protection:
enabled: false
And if you just go to your security.yml file and remove the csrf_provider or csrf_token_generator from the form_login directive.

Symfony2 CMF: Using Doctrine ORM instead of PHPCR ODM

I'm working in a project in Symfony2 and i want to use Symfony CMF with Doctrine ORM.
In my config.yml:
knp_menu:
twig: true
cmf_routing:
dynamic:
persistence:
orm:
enabled: true
manager_name: ~
I'm getting this error:
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
You have requested a non-existent parameter "None of the managerParameters
resulted in a valid name".
Im triying to use Doctrine ORM instead of PHPCR ODM
Someone knows what can i do?
Thanks!

Setting Up Symfony 2 - Cannot Load app.php Resource

I'm having trouble with setting up my Symfony2 production environment. The dev environment through app_dev.php works fine, but production through app.php leades to a 500 Internal Server Error, and this message in the Symfony error log:
[2011-08-28 10:09:11] request.CRITICAL: Symfony\Component\Config\Exception\FileLoaderLoadException: Cannot load resource ".". (uncaught exception) at /var/www/Symfony/vendor/symfony/src/Symfony/Component/Config/Loader/Loader.php line 75 [] []
Don't know how to solve this, or even stack trace it...
Happened to me when I updated the Liip/ImagineBundle.
In older versions of this bundle it required this in your routing:
_imagine:
resource: .
type: imagine
In the new versions this is to be replaced by:
_liip_imagine:
resource: "#LiipImagineBundle/Resources/config/routing.yaml"
So in my case the problem was I updated the bundle via composer, but did not update the routing.yml.
I had the same problem. Try to add:
assetic:
use_controller: true
in /app/config/config_prod.yml and clean cache after that (rm -fr /app/cache/*)
if you have these problems in production environment and you use assetic, then check if you don't have this:
_assetic:
resource: .
type: assetic
in your config file (normally this is in config_dev.yml only, not in production)... in other case try to check other routes with resource: .
I had faced a similar issue while hosting symfony2 project to a godaddy windows shared hosting with php5.3 support and fixed it by providing write permission to the symfony2 directories and creating an iis virtual directory for the symfony project directory.
For me this was caused because I wasn't sure where a blob of config was added to my config.yml and removed it because I didn't know what it did :)
So I downloaded a fresh copy of symfony2 and realized that the blob of code comes by default on a fresh install, so I put it back in and it all works. Here's what I had removed and I fixed the problem by putting it back in:
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: %kernel.root_dir%/Resources/java/compiler.jar
#yui_css:
# jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
then answer is in the routing.yml
there is a resource in there that was probably disabled and the reference is left.

Resources