Skip to content

Commit 9fdd3f1

Browse files
committed
docs: add changelog and upgrade guide
1 parent 886fa87 commit 9fdd3f1

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

user_guide_src/source/changelogs/v4.4.0.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,35 @@ or more was specified. See :ref:`upgrade-440-uri-setsegment`.
2929

3030
The next segment (``+1``) of the current last segment can be set as before.
3131

32+
.. _v440-factories:
33+
34+
Factories
35+
---------
36+
37+
Passing Fully Qualified Classname
38+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39+
40+
Now ``preferApp`` works only when you request
41+
:ref:`a classname without a namespace <factories-passing-classname-without-namespace>`.
42+
43+
For example, when you call ``model(\Myth\Auth\Models\UserModel::class)`` or
44+
``model('Myth\Auth\Models\UserModel')``:
45+
46+
- before:
47+
48+
- returns ``App\Models\UserModel`` if exists and ``preferApp`` is true (default)
49+
- returns ``Myth\Auth\Models\UserModel`` if exists and ``preferApp`` is false
50+
51+
- after:
52+
53+
- returns ``Myth\Auth\Models\UserModel`` even if ``preferApp`` is true (default)
54+
- returns ``App\Models\UserModel`` if you define ``Factories::define('models', 'Myth\Auth\Models\UserModel', 'App\Models\UserModel')`` before calling the ``model()``
55+
56+
Property Name
57+
^^^^^^^^^^^^^
58+
59+
The property ``Factories::$basenames`` has been renamed to ``$aliases``.
60+
3261
.. _v440-interface-changes:
3362

3463
Interface Changes
@@ -164,6 +193,8 @@ Others
164193
- **RedirectException:** can also take an object that implements ResponseInterface as its first argument.
165194
- **RedirectException:** implements ResponsableInterface.
166195
- **DebugBar:** Now :ref:`view-routes` are displayed in *DEFINED ROUTES* on the *Routes* tab.
196+
- **Factories:** You can now define the classname that will actually be loaded.
197+
See :ref:`factories-defining-classname-to-be-loaded`.
167198

168199
Message Changes
169200
***************

user_guide_src/source/installation/upgrade_440.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,21 @@ This bug was fixed and now URIs for underscores (**foo_bar**) is not accessible.
7373
If you have links to URIs for underscores (**foo_bar**), update them with URIs
7474
for dashes (**foo-bar**).
7575

76+
When Passing Fully Qualified Classnames to Factories
77+
====================================================
78+
79+
The behavior of passing fully qualified classnames to Factories has been changed.
80+
See :ref:`ChangeLog <v440-factories>` for details.
81+
82+
If you have code like ``model('\Myth\Auth\Models\UserModel::class')`` or
83+
``model('Myth\Auth\Models\UserModel')`` (the code may be in the third-party packages),
84+
and you expect to load your ``App\Models\UserModel``, you need to define the
85+
classname to be loaded before the first loading of that class::
86+
87+
Factories::define('models', 'Myth\Auth\Models\UserModel', 'App\Models\UserModel');
88+
89+
See :ref:`factories-defining-classname-to-be-loaded` for details.
90+
7691
Interface Changes
7792
=================
7893

0 commit comments

Comments
 (0)