Skip to content

[DependencyInjection] fix a config filename #10932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions service_container/3.3-di-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,11 @@ no longer exist. The simplest way to fix this is to find all your old service id
and update them to the new class id: ``app.github_notifier`` to ``App\Service\GitHubNotifier``.

In large projects, there's a better way: create legacy aliases that map the old id
to the new id. Create a new ``legacy_aliases.yml`` file:
to the new id. Create a new ``legacy_aliases.yaml`` file:

.. code-block:: yaml

# app/config/legacy_aliases.yml
# config/legacy_aliases.yaml
services:
_defaults:
public: true
Expand All @@ -611,7 +611,7 @@ Then import this at the top of ``services.yaml``:

# config/services.yaml
+ imports:
+ - { resource: legacy_aliases.yml }
+ - { resource: legacy_aliases.yaml }

# ...

Expand All @@ -635,7 +635,7 @@ Now you're ready to default all services to be private:
+ public: false

Thanks to this, any services created in this file cannot be fetched directly from
the container. But, since the old service id's are aliases in a separate file (``legacy_aliases.yml``),
the container. But, since the old service id's are aliases in a separate file (``legacy_aliases.yaml``),
these *are* still public. This makes sure the app keeps working.

If you did *not* change the id of some of your services (because there are multiple
Expand Down Expand Up @@ -723,7 +723,7 @@ Step 5) Cleanup!

To make sure your application didn't break, you did some extra work. Now it's time
to clean things up! First, update your application to *not* use the old service id's (the
ones in ``legacy_aliases.yml``). This means updating any service arguments (e.g.
ones in ``legacy_aliases.yaml``). This means updating any service arguments (e.g.
``@app.github_notifier`` to ``@App\Service\GitHubNotifier``) and updating your
code to not fetch this service directly from the container. For example:

Expand All @@ -739,7 +739,7 @@ code to not fetch this service directly from the container. For example:
// ...
}

As soon as you do this, you can delete ``legacy_aliases.yml`` and remove its import.
As soon as you do this, you can delete ``legacy_aliases.yaml`` and remove its import.
You should do the same thing for any services that you made public, like
``app.api_client_github`` and ``app.api_client_sl_connect``. Once you're not fetching
these directly from the container, you can remove the ``public: true`` flag:
Expand Down