Deprecations are the key of our backward compatibility promise, which ensures smooth upgrades of your projects between minor versions (e.g. from 4.0 to 4.x). In order to provide a great developer experience, your own Symfony apps can also deprecate services, deprecate config options and even deprecate Twig templates, blocks and macros.
In Symfony 4.3, you'll also be able to deprecate service aliases. When an
alias should no longer be used in your application, define it as deprecated with
the deprecated
configuration option:
1 2 3 4 5 6 7
# config/services.yaml
services:
# ...
app.mailer:
alias: App\Mail\PhpMailer
deprecated: ~
If this alias is used anywhere in your app, you'll see a generic error message.
If you prefer to customize that message, define it using the deprecated
option (the only requirement is that the message must include the %alias_id%
placeholder):
1 2 3 4 5 6 7
# config/services.yaml
services:
# ...
app.mailer:
alias: App\Mail\PhpMailer
deprecated: 'The "%alias_id%" service alias is deprecated.'
The title gave me a scare (thought the aliases themselves were being deprecated), but I love the addition!
@Niels I'm sorry! Now I realize that the title could be confusing :( Sadly I cannot update it now to not break the links to this article.
I join, I also thought at first that they were abandoning aliases.
I thought the same :)
Someone could call this title "click bating" LOL
Same here. This title is going to raise some eyebrows :D
I agree with Niels, it was so scary with the title that needed to read the post to confirm it.
@Javier, maybe you can rename the post and make a 301 or 302 redirection?
Cheers,
reading my rss inbox and reading the title really scared me... xD
The title is a bit misleading. I assumed this will remove aliases completely. Too bad :D
Just as I was trying to figure out how to mark the aliases as deprecated, I read this, hihi.
Also scared in the begining but nice feature !
Nice feature.
I was also scare by the title. But after reading the posts Sounds Nice.