I cannot install the FOSUserBundle.
I configured config/config.yml as follows:
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
user_class: App\Entity\User
from_email:
address: "%mailer_user%"
sender_name: "%mailer_user%"
But when I run this command:
composer require friendsofsymfony/user-bundle "~2.0"
I get the error:
The child node "db_driver" at path "fos_user" must be configured
Any hints why this is happening?
All of this config information should not be stored in config/config.yml in Symfony 4 (in Symfony 3, this would be correct). Instead, you have to create a config file config/packages/fos_user.yaml and save this information there. You then can remove config/config.yml.
Related
I am trying to install FOSUserBundle based on a documentation.
I have created fos_user.yaml file in conifig/packages path with:
fos_user:
db_driver: orm
firewall_name: main
user_class: bundles\App\Base\Entity\User
from_email:
address: "my#mail.com"
sender_name: "Name Surname"
framework:
translator: ~
But it keeps throwing error:
There is no extension able to load the configuration for "from_email" (in /
!! var/www/html/config/packages/fos_user.yaml). Looked for namespace "from_ema
!! il", found "framework", "sensio_framework_extra", "doctrine_cache", "doctri
!! ne", "doctrine_migrations", "maker", "security", "swiftmailer", "stof_doctr
!! ine_extensions", "doctrine_fixtures", "twig", "twig_extra", "fos_user"
I tried of making from_email.yaml but it won't work.
The configuration that you provided in your fos_user.yaml file isn't well indented.
If you don't indent the values under the fos_user key, Symfony will try to find a configuration file for each of them.
You should write instead :
fos_user:
db_driver: orm
firewall_name: main
user_class: bundles\App\Base\Entity\User
from_email:
address: "my#mail.com"
sender_name: "Name Surname"
For more details, you can see the full bundle configuration here
I am new with Symfony4, and creating Login Form with FOSUserBundle. And I got stuck at step 5 mentioned in this article. When it says:
Add the following configuration to your config.yml file according to
which type of datastore you are using.
# 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%"
The problem is that in symfony4, there is no app folder, and no simple config.yml file in config folder.
I think this article might be working with older versions, but for Symfony4, it may need some amendments.
Can any body suggest how to fix it?
Why not to create it config/packages/fos.yaml ?
Or add in one of existing config/packages/foo.yaml ?
https://symfony.com/doc/current/configuration.html
for that problem you can try this:
Create fos_user.yaml file under config/packages folder then you can add the configuration code as usual, symfony4 will load it automatically.
As Arnold Richmon indicated. Also, in the fos_user.yaml file you need to add config options as:
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
user_class: App\Entity\YourUserEntityClass
from_email:
address: "youremail#yourdomain.whatever"
sender_name: "yoursendername"
to complete with service:mailer and resume, create:
config/packages/fos_user.yaml
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
user_class: App\Entity\YourUserEntityClass
service:
mailer: fos_user.mailer.twig_swift
from_email:
address: "youremail#yourdomain.whatever"
sender_name: "yoursendername"
In Symfony 4 ,the new config/ directory is the equivalent of the current app/config/ directory but with a very different layout.
Check this link for more details: https://symfony.com/blog/symfony-4-a-new-way-to-develop-applications
I am trying to update doctrine schema after installation FOSUser Bundle 2.0 but I keep getting this error:
In ArrayNode.php line 238:
The child node "db_driver" at path "fos_user" must be configured.
File config.yaml is configurated propertly in location /config/config.yaml:
framework:
translator: ~
fos_user:
db_driver: orm
firewall_name: main
user_class: Entity\User
from_email:
address: "%mailer_user%"
sender_name: "%mailer_user%"
I tried to solve it via official tutorial: http://symfony.com/doc/master/bundles/FOSUserBundle/index.html#prerequisites
I tried to do step 5 first and than rerun step 1. But still the same error.
Any ideas?
In symfony 4.x you need to create a bundle_name.yaml file instead of config.yaml
So, in this case create file fos_user.yaml in config/packages folder.
In that file you place the configuration for FOSUserBundle, like so:
fos_user:
db_driver: orm
firewall_name: main
user_class: Entity\User
from_email:
address: '%env(resolve:USER_ADDRESS)%'
sender_name: '%env(resolve:SENDER_NAME)%'
framework:
templating:
engines: ['twig', 'php']
Of course, defining the address and sender_name in .env file as constants or provide them directly with: "%mailer_user%"
use composer require friendsofsymfony/user-bundle dev-master or go to their packagist page and get the latest version FOSUserBundle Packagist
That should make it install without errors.
If you need to figure out what has changed between symfony version 3.x and 4.x i suggest checking out this article: Configuration Structure - taken from symfony blog A new way to develop applications
try to indent like this:
fos_user:
db_driver: orm
firewall_name: main
user_class: Entity\User
from_email:
address: "%mailer_user%"
sender_name: "%mailer_user%"
Because yml file needs to be written and indent well with all spaces necessary
I am integrating FOSUserBundle in my application and I am trying to run php bin/console doctrine:migration:diff after following the recommended set-up.
I am systematically getting a:
In ArrayNode.php line 319:
Unrecognized option "resource" under "fos_user"
Yet, I have set the following in my config/packages/routing.yaml:
framework:
router:
strict_requirements: ~
fos_user:
resource: "#FOSUserBundle/Resources/config/routing/all.xml"
What am I doing wrong? I have "friendsofsymfony/user-bundle": "~2.0" in my composer.json and ran composer update.
Update
My fos_user.yaml is:
fos_user:
db_driver: orm
firewall_name: main
user_class: App\Entity\Admin\User
from_email:
address: no_reply#xxx.com
sender_name: xxx
Dlondero's suggestion fixed the issue, the fos_user configuration should be set in config/routes.yaml.
From documentation, routes are never automatically added in configuration.
move the :
fos_user:
resource: "#FOSUserBundle/Resources/config/routing/all.xml"
into config/routes.yaml insted of confing/packages/routing.yml
If I am not wrong, config/packages/routing.yaml file is not for routes, it is the config file for routing bundle, you can not put your routing configs to there. Instead, you should put them under config/routes folder, as bundle_name.yml.
Like this, eg. config/routes/imagine.yml:
_liip_imagine:
resource: "#LiipImagineBundle/Resources/config/routing.yaml"
In my case with Symfony 4.3.2 skeleton
fos_user:
resource: "#FOSUserBundle/Resources/config/routing/all.xml"
should be pasted in
config/routes/annotations.yaml
and
php bin/console debug:router
displays all the fos_user routes
trying to install FOSUserBundle bundle from below link How to install 3rd party Bundles but getting this error :
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
The child node "db_driver" at path "fos_user" must be configured.
You have forgotten to add the configuration for FOSUserBundle in your app/config/config.yml or at least did not provide a value for fos_user.db_driver.
You have to configure at least the db_driver , firewall and your user-class otherwise the configuration will throw an InvalidConfigurationException.
# app/config/config.yml
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: Acme\UserBundle\Entity\User
Please see the documentation chapter Step 5: Configure the FOSUserBundle.
I solve similar error by updating composer : /usr/local/bin/composer self-update.
May this help.