Skip to content

Commit

Permalink
Merge pull request #7683 from cakephp/4.x-component-dic
Browse files Browse the repository at this point in the history
4.x: mention unavailability of DIC inside components
  • Loading branch information
markstory authored Aug 21, 2023
2 parents 7a88c14 + d978a16 commit eb6461b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions en/controllers/components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ in your controller, you could access it like so::
properties they share the same 'namespace'. Be sure to not give a
component and a model the same name.

.. warning::

Component methods **don't** have access to :doc:`/development/dependency-injection`
like Controller actions have. Use a service class inside your controller actions
instead of a component if you need this functionality.

.. _creating-a-component:

Creating a Component
Expand Down

0 comments on commit eb6461b

Please sign in to comment.