Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions en/appendices/5-3-migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ ORM
validation to the fields listed in the ``fields`` option.
- Added ``TableContainer`` that you can register in your Application::services() to
add dependency injection for your Tables.
- ``Cake\ORM\Locator\TableContainer`` was added. By adding this container
delegate to your application, ORM Tables can be injected by the DI container.

Routing
-------
Expand Down
13 changes: 13 additions & 0 deletions en/development/dependency-injection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@ instance, often referred to as a singleton, you can mark a service as 'shared'::

$container->addShared(BillingService::class);

Using ORM Tables as Services
----------------------------

If you want to have ORM Tables injected as a dependency to a service, you can
add ``TableContainer`` to your applications's service container::

// In your Application::services() method.
// Allow your Tables to be dependency injected.
$container->delegate(new \Cake\ORM\Locator\TableContainer());

.. versionadded:: 5.3.0
``TableContainer`` was added.

Extending Definitions
---------------------

Expand Down
Loading