Skip to content

Commit 94df971

Browse files
committed
Update user guide about controller model instance
1 parent e448c4d commit 94df971

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

guide/index.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,14 +2418,15 @@ numerous useful methods for working on HTTP interactions.
24182418
Model Instance
24192419
##############
24202420

2421-
Often, a controller works with a specific model and through the $model
2422-
property it is possible to set the Fully Qualified Class Name of a
2423-
``ModelInterface`` child class so that an instance of it is automatically loaded,
2424-
in all requests, in the construction of the controller.
2421+
Each controller can have a ``$model`` property, which will be automatically
2422+
instantiated in the class constructor.
24252423

2426-
Let's see below that $model receives the type name of the ``App\Models\UsersModel``
2427-
class and in the ``show`` method the direct call to the $model property is used,
2428-
which has the instance of ``App\Models\UsersModel``:
2424+
The ``$model`` property must have a child class type of Model.
2425+
2426+
Let's see below that ``$model`` receives the type name of the
2427+
``App\Models\UsersModel`` class and in the ``show`` method the direct call to
2428+
the ``$model`` property is used, which has the instance of
2429+
``App\Models\UsersModel``:
24292430

24302431
.. code-block:: php
24312432
@@ -2435,7 +2436,7 @@ which has the instance of ``App\Models\UsersModel``:
24352436
24362437
class Users extends Controller
24372438
{
2438-
protected ModelInterface | UsersModel $model;
2439+
protected UsersModel $model;
24392440
24402441
public function show(int $id) : string
24412442
{

0 commit comments

Comments
 (0)