The service "fos_user.mailer" has a dependency on a non-existent service "templating"

the service companies
the service movie
the service military
the service companies logo
the service companies ownership
the service tv show
the service companies lake charles la
the service companies reviews

So, the above error has suddenly started happening, after I've been using FOSUserBundle for several Symfony projects.

I've tried including the templating service (twice now) and it seems like it's installed fine. Here is my list of requires in my composer.json:

"require": {
    "php": ">=5.5.9",
    "doctrine/doctrine-bundle": "^1.6",
    "doctrine/orm": "^2.5",
    "friendsofsymfony/user-bundle": "^2.0",
    "incenteev/composer-parameter-handler": "^2.0",
    "sensio/distribution-bundle": "^5.0.19",
    "sensio/framework-extra-bundle": "^5.0.0",
    "symfony/monolog-bundle": "^3.1.0",
    "symfony/polyfill-apcu": "^1.0",
    "symfony/swiftmailer-bundle": "^2.6.4",
    "symfony/symfony": "3.4.*",
    "symfony/templating": "^3.4",
    "twig/twig": "^1.0||^2.0"
},

I've set up the config.yml, security.yml and the routing.yml files as per usual, and included the bundle in the AppKernel.php file. I've also created the User.php Entity but every time I try to clear the cache or update the database, I get this error.

The service "fos_user.mailer" has a dependency on a non-existent service "templating"

And after much searching I cannot see where to fix this problem. Any help with this is much appreciated as it's something that's never happened before, and I've always used FOSUserBundle for my security needs.

I just experienced the exact same problem. The funny thing is that I created a Symfony 3.3 project just before creating a Symfony 3.4 project and the Symfony 3.3 project didn't have this problem. So they must have removed the templating component for the 3.4 release.

To solve your problem, you will have to install the templating component using composer:

composer require symfony/templating

Then, add the following configuration under the framework key in your config.yml:

templating:
    engines: ['twig']

Update: I recently had to start a new Symfony 3.4 project with FOSUserBundle and discovered that I only had to add the above configuration to my config.yml file (as was mentioned in a comment below).

The Service (Essay by Henry David Thoreau), Directed by Thorkell August Ottarsson. With Tor Itai Keilen, Nick Faust, Camilla Gunnerud, Hulda Elira Thorkelsdottir. The motivations of two men running an  The Service Companies is the leading provider of managed, hospitality staffing, specialty cleaning, and engineering services to hotels, casinos, resorts, corporate cafeterias, stadiums, universities, hospitals, office buildings, commercial facilities and more across the United States and Caribbean.

In Symfony 3.4 and FosUserBundle 2.0, add a service mailer into the fos_user config:

fos_user:
    db_driver: orm # other valid values are 'mongodb' and 'couchdb'
    firewall_name: main
    user_class: AppBundle\Entity\User
    service:                               # this lines
        mailer: fos_user.mailer.twig_swift # this lines
    from_email:
        address: "%mailer_user%"
        sender_name: "%mailer_user%

Service (Economics), Request a free consultation / quote for our managed, hospitality staffing, specialty cleaning and engineering services or to reach out to our HR team. Need help logging in or registering? Contact The Service Connection Help Desk: Hours: Monday - Friday; 5:00 AM - 5:00 PM (Pacific Time) Phone: 877-777-8086 Verify your browser settings with our System Compatibility Check

For my case, it's work after changing in the config.yml like below:

# FOSUser Configuration
fos_user:
    db_driver: orm # other valid values are 'mongodb' and 'couchdb'
    firewall_name: main
    user_class: AppBundle\Entity\User
    service:                               # this line
        mailer: fos_user.mailer.twig_swift # this line (from the comment above)
    from_email:
        address: "test@test.com" # change this 
        sender_name: "Test App"  # and this

The Service, The new economics of service requires innovative measurement techniques. These techniques calibrate the impact of employee satisfaction, loyalty, and  Service definition is - the occupation or function of serving. How to use service in a sentence.

The Service (2017), In its planning the company routinely combines operations and marketing with what I call a strategic service vision. The most profitable large American company​  The Service is an award-winning company that brings together like-minded production creatives with a love for social impact, the arts and creative collaboration. We specialise in international content production, and operate an open and inclusive service.

The Service Companies – Service. Above All, Examples of service in a Sentence. Verb I need to get my car serviced. The shop services sewing machines and old typewriters. a set of dishes, utensils, etc., for general table use or for particular use: a tea service; service for eight.

Contact Us, The Service Companies. 4238 likes · 171 talking about this. The Service Companies provides cleaning, hospitality staffing, and engineering services to THE Service, Corporate Eyecare, Workplace Eye Tests, Occupational Health, Employee Wellbeing, Free Eye Test

Comments
  • I suppose that you have double checked that framework:templating:engines:['twig'] is set in config.yml?
  • I have this in config: # Twig Configuration twig: debug: '%kernel.debug%' strict_variables: '%kernel.debug%'
  • You also need an entry in the framework section.
  • Thanks for your answer :)
  • Tip for those who are fixing this in SF 3.x, install with the specific version 3.4.2: "composer require symfony/templating v3.4.2" or you will get a dependencies version exception as till the date symfony/templating is in v4.x for Symfony 4 (composer installs automatically latest version if not specified).
  • In addition to accepted answer, it seems that templating engine is already installed but it's just, for some reason, removed from config file, so anyone having the same problem, first try adding what's said in accepted answer. It worked for me and I'm sure that I didn't install anything beside FOSUserBundle.
  • I had the same problem but before installing the symfony/templating bundle, I just tried with the templating engine definition as per your advice, and to my astonishment, it worked. So, I just have the configuration definition and did not need to execute the composer.
  • Thanks a lot, this has helped me fix an error that had me puzzled for a while. The error message was: The service "Sonata\UserBundle\Action\RequestAction" has a dependency on a non-existent service "templating". Fixed it just by adding the configuration under the framework key in config.yml. Cheers!
  • It worked perfectly with a fresh Symfony 3.4 project. Thank you!
  • Provided solution didn't work with 3.4, your answer saved me! Thx for sharing!
  • Thanks, it's work for me on 3.4 too. But what does that mean ? I think it's to indicate fos_user that the mailer service is TwigSwiftMailer. But where fos_user.mailer.twig_swift is defined ?
  • Correct answer for Symfony 3.4.
  • This is the correct answer, i think that it will be better that this one have the green correct mark