From 01b41074f557286e9a97a912a78c2b1a26b93ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=BCrth?= Date: Thu, 8 Jun 2023 14:33:35 +0200 Subject: [PATCH 1/2] Add note about fetchTable not adding a controller property --- en/controllers.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/en/controllers.rst b/en/controllers.rst index a3b13d9bc0..e4098887e4 100644 --- a/en/controllers.rst +++ b/en/controllers.rst @@ -428,6 +428,11 @@ the controller's default one:: .. versionadded:: 4.3.0 ``Controller::fetchTable()`` was added. Prior to 4.3 you need to use ``Controller::loadModel()``. +.. note:: + + ``Controller::fetchTable()`` does not create a controller property with the name of the table alias, + e.g. ``$this->Articles``, as ``Controller::loadModel()`` does. + Paginating a Model ================== From d3e043e82c72d95a5d2ed4d601ec6b7ee29c3e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=BCrth?= Date: Thu, 8 Jun 2023 14:43:28 +0200 Subject: [PATCH 2/2] Add note about fetchTable not adding a controller property to migration guide --- en/appendices/4-3-migration-guide.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/en/appendices/4-3-migration-guide.rst b/en/appendices/4-3-migration-guide.rst index 0138ac40ec..5f7d864585 100644 --- a/en/appendices/4-3-migration-guide.rst +++ b/en/appendices/4-3-migration-guide.rst @@ -86,7 +86,9 @@ ORM - ``ModelAwareTrait::loadModel()`` is deprecated. Use the new ``LocatorAwareTrait::fetchTable()`` instead. For example, in controllers you can do ``$this->fetchTable()`` to get the default table instance or use ``$this->fetchTable('Foos')`` for a non-default table. You can set the ``LocatorAwareTrait::$defaultTable`` - property to specify the default table alias for ``fetchTable()``. + property to specify the default table alias for ``fetchTable()``. But be aware that + ``LocatorAwareTrait::fetchTable()`` does not create a property with the name of the table alias on the + calling object, e.g. ``$this->Articles``, as ``ModelAwareTrait::loadModel()`` does. - Query proxying all ``ResultSetInterface`` methods (including ```CollectionInterface```), which forces fetching results and calls the proxied method on the results, is now deprecated. An example of the deprecated usage is ``$query->combine('id', 'title');``. This should be