diff --git a/user_guide_src/source/changelogs/v4.4.0.rst b/user_guide_src/source/changelogs/v4.4.0.rst index a6a3bdde7d88..4f7615c42e3f 100644 --- a/user_guide_src/source/changelogs/v4.4.0.rst +++ b/user_guide_src/source/changelogs/v4.4.0.rst @@ -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 `. @@ -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 ^^^^^^^^^^^^^ diff --git a/user_guide_src/source/installation/upgrade_440.rst b/user_guide_src/source/installation/upgrade_440.rst index c4bdfe0c81ff..3c34b0241746 100644 --- a/user_guide_src/source/installation/upgrade_440.rst +++ b/user_guide_src/source/installation/upgrade_440.rst @@ -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 ` for details. If you have code like ``model('\Myth\Auth\Models\UserModel::class')`` or