Skip to content

Commit

Permalink
Merge pull request #7630 from cakephp/fetchtable-note
Browse files Browse the repository at this point in the history
Add note about fetchTable not adding a controller property to docs & migration guide
  • Loading branch information
markstory committed Jun 9, 2023
2 parents ac45f97 + d3e043e commit bfd7b08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion en/appendices/4-3-migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions en/controllers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
==================

Expand Down

0 comments on commit bfd7b08

Please sign in to comment.