Skip to content

Commit 7896e4b

Browse files
committed
Add documentation for cakephp/cakephp#18979
1 parent 310a89f commit 7896e4b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

en/appendices/5-3-migration-guide.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ ORM
147147
validation to the fields listed in the ``fields`` option.
148148
- Added ``TableContainer`` that you can register in your Application::services() to
149149
add dependency injection for your Tables.
150+
- ``Cake\ORM\Locator\TableContainer`` was added. By adding this container
151+
delegate to your application, ORM Tables can be injected by the DI container.
150152

151153
Routing
152154
-------

en/development/dependency-injection.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,19 @@ instance, often referred to as a singleton, you can mark a service as 'shared'::
188188

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

191+
Using ORM Tables as Services
192+
----------------------------
193+
194+
If you want to have ORM Tables injected as a dependency to a service, you can
195+
add ``TableContainer`` to your applications's service container::
196+
197+
// In your Application::services() method.
198+
// Allow your Tables to be dependency injected.
199+
$container->delegate(new \Cake\ORM\Locator\TableContainer());
200+
201+
.. versionadded:: 5.3.0
202+
``TableContainer`` was added.
203+
191204
Extending Definitions
192205
---------------------
193206

0 commit comments

Comments
 (0)