10.
parameters.yml & %kernel.root_dir%
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
12 Comments
Hey guys, I have this issue. I deleted the swiftmailer bundle from AppKernel. Removed it from all config files and dist file, but still when I run debug:container mailer I receive "mailer is an alias of swiftmailer.mailer.default". Then if I try to run the same command but with swiftmailer as argument, I get the list with matching services. Any ideas? Thanks. I'm using Symfony 3.1.4
Hey Tonislav A. ,
Hm, could you make sure it's not due to some cache? Please, clear the cache and try again. Btw, what do you use instead of Swiftmailer? Or you don't send any emails in your application at all?
Cheers!
Hi victor
I am strictly following the tutorial and the application does not send any emails. I've cleared the cache before posting. I moved along with the course as this was not needed to progress. I try the same now (after my PC had been rebooted) and it works - there's no swiftmailer service. I reversed back my actions and added the swiftmailer bundle and configuration and it is ok again. Idk what happened. Reminds me of the IT Crowd "Hello, IT, have you tried turning it off and on again?" xD
Cheers!
Hey Tonislav A.,
Haha, well, clearing the cache is almost always the same as turn it off and on :D
OK, glad it work well now!
P.S. I suppose you're on Windows? Just curious about it. Sometimes weird things happen there :)
Cheers!
Can we add custom params to `kernel`, for example `kernel.my_param`?
Is there any valid reason to do so?
Hey boykodev
A kernel parameter is just like any other parameter but those are prefixed with the word "kernel" only for organization reasons, so, in theory you can define a parameter named "kernel.your-param" but it would confuse anyone who is reading your code.
If you are curious, here you can see how kernel parameters are being set: https://github.com/symfony/...
Cheers!
So what is the recommended way to split out parameters for dev vs prod? simply create a parameters_dev.yml and import that into config_dev.yml after the import of config.yml?
Hey Richie,
No, you don't have to create a separate "parameters" files for each environment - you already have config.yml, config_dev.yml and config_test.yml files, which already are imported out of the box, so just put any environment-related parameters inside of those files under the `parameters:` key. BUT if you have server-specific parameters, you need to put them into the special `parameters.yml` file (and also don't forget to add a parameter key with dummy value in your parameters.yml.dist file), i.e. those parameters which can be different on different servers: production, development, CI, etc. I think this article may be interesting for you: http://symfony.com/doc/curr...
Cheers!
Hi,
Great tuto, but I have a little question since sf 3.1 it is drepreacated to use % indicator in config.yml.
So how can we do?
Thanks again for your great job.
Greg
Hey Greg,
Symfony deprecates using
%symbol without quotes, but of course you still can use parameters in YAML config files. So just wrap all your parameters which starts and ends with%with a single or double quotes and that's it! It's easy fix!P.S. Thanks for your kind words.
Cheers!
Ok effectively it is very simple ;)
Thanks for your answer.
You're welcome! BTW, fixing deprecations beforehand is a good idea, keep it up! )
"Houston: no signs of life"
Start the conversation!