Skip to content

Update 3.3-di-changes.rst #9695

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

Closed
wants to merge 3 commits into from
Closed

Conversation

DonCallisto
Copy link
Contributor

Related to #9676 (review)


.. caution::

If a service is processed by `Compiler Pass`_ you could face a "You have requested a non-existent service" error.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually split lines after the first word that crosses the 72nd character.

.. caution::

If a service is processed by `Compiler Pass`_ you could face a "You have requested a non-existent service" error.
To get rid of this, be sure that Compiler Pass is using ``findDefinition`` instead of ``getDefinition`` as the latter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use findDefinition() and getDefinition() (i.e. include the parentheses)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also add a note that it is generally a good idea to check with has() first if there actually is an alias or definition we are looking for.

@@ -778,3 +784,5 @@ can be autowired. The final configuration looks like this:
You can now take advantage of the new features going forward.

.. _`FrameworkExtension for 3.3.0`: https://github.com/symfony/symfony/blob/7938fdeceb03cc1df277a249cf3da70f0b50eb98/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L247-L284

.. _`Compiler Pass`: https://symfony.com/doc/current/service_container/compiler_passes.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use the doc role instead:

If a service is processed by a :doc:`compiler pass </service_container/compiler_passes>` [...]

@DonCallisto
Copy link
Contributor Author

@xabbuh thank you for the review. I've made changes in a separate commit so you can check only the diff.
Moreover I would like to point out that, for consistency reason, even

.. _`FrameworkExtension for 3.3.0`: https://github.com/symfony/symfony/blob/7938fdeceb03cc1df277a249cf3da70f0b50eb98/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L247-L284

should be converted to :doc: reference.

WDYT?

@@ -568,6 +568,16 @@ Start by updating the service ids to class names:
  you can't redefine the service as ``Twig_Extensions_Extension_Intl: ~`` and
you must keep the original ``class`` parameter.

.. caution::

If a service is processed by :doc:`compiler pass </service_container/compiler_passes>`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor typo: [...] by a [...]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and there should be a comma at the end of the line


If a service is processed by :doc:`compiler pass </service_container/compiler_passes>`
you could face a "You have requested a non-existent service" error.
To get rid of this, be sure that Compiler Pass is using ``findDefinition()``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] that the compiler pass is [...]

If a service is processed by :doc:`compiler pass </service_container/compiler_passes>`
you could face a "You have requested a non-existent service" error.
To get rid of this, be sure that Compiler Pass is using ``findDefinition()``
instead of ``getDefinition()`` as the latter won't take aliases into
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] getDefinition(). The latter won't [...]

To get rid of this, be sure that Compiler Pass is using ``findDefinition()``
instead of ``getDefinition()`` as the latter won't take aliases into
account when looking up for services.
Furthermore is always recommendend to check for definition existance
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] it is [...]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] existence using has().

@xabbuh
Copy link
Member

xabbuh commented May 18, 2018

The doc role does not work for external links (for example, to link to code on GitHub). We can only use it for cross-references inside this documentation.

@DonCallisto
Copy link
Contributor Author

Right, didn't see that was an external link.

@DonCallisto
Copy link
Contributor Author

At the end will you squash commits or do you prefer me to do the squash?

@xabbuh
Copy link
Member

xabbuh commented May 18, 2018

Whatever you prefer :) As long as you do not push a merge commit we can easily squash your commits while merging.

@DonCallisto
Copy link
Contributor Author

Ok, I have no preferences, just let me know if I need to perform other actions on this.

@xabbuh xabbuh added this to the 3.4 milestone May 18, 2018
@javiereguiluz
Copy link
Member

Thank you Samuele.

javiereguiluz added a commit that referenced this pull request May 21, 2018
This PR was submitted for the 4.0 branch but it was squashed and merged into the 3.4 branch instead (closes #9695).

Discussion
----------

Update 3.3-di-changes.rst

Related to #9676 (review)

Commits
-------

bebe9a0 Update 3.3-di-changes.rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants