Skip to content

Commit c0029f9

Browse files
authored
Merge pull request #7840 from kenjis/fix-docs-changelog-4.4-factories
[4.4] docs: improve description for Factories BC
2 parents 015b7d9 + 5ba1b9c commit c0029f9

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

user_guide_src/source/changelogs/v4.4.0.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ The next segment (``+1``) of the current last segment can be set as before.
3434
Factories
3535
---------
3636

37-
Passing Fully Qualified Classname
38-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37+
Passing Classname with Namespace
38+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3939

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

56+
If you had passed a non-existent classname by mistake, the previous version
57+
would have returned a class instance in the ``App`` or ``Config`` namespace
58+
because of the ``preferApp`` feature.
59+
60+
For example, in a controller (``namespace App\Controllers``), if you called
61+
``config(Config\App::class)`` by mistake (note the class is missing the leading ``\``),
62+
meaning you actually passed ``App\Controllers\Config\App``.
63+
But that class does not exist, so now Factories will return ``null``.
64+
5665
Property Name
5766
^^^^^^^^^^^^^
5867

user_guide_src/source/installation/upgrade_440.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ This bug was fixed and now URIs for underscores (**foo_bar**) is not accessible.
8585
If you have links to URIs for underscores (**foo_bar**), update them with URIs
8686
for dashes (**foo-bar**).
8787

88-
When Passing Fully Qualified Classnames to Factories
89-
====================================================
88+
When Passing Classname with Namespace to Factories
89+
==================================================
9090

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

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

0 commit comments

Comments
 (0)