15

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?

M_Idrees
  • 2,080
  • 2
  • 23
  • 53

5 Answers5

10

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

Andrius
  • 344
  • 3
  • 15
3

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.

Arnold Richmon
  • 321
  • 3
  • 8
2

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"
tlarson
  • 353
  • 4
  • 11
2

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"
bcag2
  • 1,988
  • 1
  • 17
  • 31
1

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

Amira Bedhiafi
  • 8,088
  • 6
  • 24
  • 60
  • Yes right. But I could not understand how to update config(which file, there are many files in config folder) around symfony4 from that article. – M_Idrees Apr 12 '18 at 15:22
  • Take a look here : https://stackoverflow.com/questions/47844967/symfony-4-fosuserbundle – Amira Bedhiafi Apr 12 '18 at 15:25