Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.4] docs: improve description for Factories BC #7840

Merged
merged 2 commits into from
Aug 23, 2023
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
13 changes: 11 additions & 2 deletions user_guide_src/source/changelogs/v4.4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ The next segment (``+1``) of the current last segment can be set as before.
Factories
---------

Passing Fully Qualified Classname
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Passing Classname with Namespace
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Now ``preferApp`` works only when you request
:ref:`a classname without a namespace <factories-passing-classname-without-namespace>`.
Expand All @@ -53,6 +53,15 @@ For example, when you call ``model(\Myth\Auth\Models\UserModel::class)`` or
- returns ``Myth\Auth\Models\UserModel`` even if ``preferApp`` is true (default)
- returns ``App\Models\UserModel`` if you define ``Factories::define('models', 'Myth\Auth\Models\UserModel', 'App\Models\UserModel')`` before calling the ``model()``

If you had passed a non-existent classname by mistake, the previous version
would have returned a class instance in the ``App`` or ``Config`` namespace
because of the ``preferApp`` feature.

For example, in a controller (``namespace App\Controllers``), if you called
``config(Config\App::class)`` by mistake (note the class is missing the leading ``\``),
meaning you actually passed ``App\Controllers\Config\App``.
But that class does not exist, so now Factories will return ``null``.

Property Name
^^^^^^^^^^^^^

Expand Down
6 changes: 3 additions & 3 deletions user_guide_src/source/installation/upgrade_440.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ This bug was fixed and now URIs for underscores (**foo_bar**) is not accessible.
If you have links to URIs for underscores (**foo_bar**), update them with URIs
for dashes (**foo-bar**).

When Passing Fully Qualified Classnames to Factories
====================================================
When Passing Classname with Namespace to Factories
==================================================

The behavior of passing fully qualified classnames to Factories has been changed.
The behavior of passing a classname with a namespace to Factories has been changed.
See :ref:`ChangeLog <v440-factories>` for details.

If you have code like ``model('\Myth\Auth\Models\UserModel::class')`` or
Expand Down