Skip to content

Commit

Permalink
Merge pull request codeigniter4#8897 from kenjis/docs-modules.rst
Browse files Browse the repository at this point in the history
docs: update modules.rst
  • Loading branch information
kenjis authored May 17, 2024
2 parents f927928 + 1af5192 commit 8fc8985
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions user_guide_src/source/concepts/factories.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ The following code loads **app/Libraries/Sub/SubLib.php** if it exists:
.. literalinclude:: factories/013.php
:lines: 2-

.. _factories-passing-fully-qualified-classname:

Passing Fully Qualified Classname
---------------------------------

Expand Down
13 changes: 8 additions & 5 deletions user_guide_src/source/general/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ You can specify namespaces. See :ref:`helpers-loading-from-specified-namespace`
Language Files
==============

Language files are located automatically from defined namespaces when using the ``lang()`` method, as long as the
Language files are located automatically from defined namespaces when using the
:php:func:`lang()` function, as long as the
file follows the same directory structures as the main application directory.

Libraries
Expand All @@ -272,13 +273,15 @@ Model files are automatically discovered whenever using the :php:func:`model()`

.. note:: We don't recommend you use the same short classname in modules.

.. note:: ``model()`` finds the file in **app/Models/** when there is a class with the same shortname,
even if you specify a fully qualified class name like ``model(\Acme\Blog\Model\PostModel::class)``.
This is because ``model()`` is a wrapper for the ``Factories`` class which uses ``preferApp`` by default. See :ref:`factories-loading-class` for more information.
.. note:: Prior to v4.4.0, ``model()`` finds the file in **app/Models/** when
there is a class with the same shortname, even if you specify a fully qualified
class name like ``model(\Acme\Blog\Model\PostModel::class)``.
See the Note in :ref:`factories-passing-fully-qualified-classname` for more
information.

Views
=====

Views can be loaded using the class namespace as described in the :doc:`views </outgoing/views>` documentation:
Views can be loaded using the class namespace as described in the :ref:`views <namespaced-views>` documentation:

.. literalinclude:: modules/012.php
2 changes: 2 additions & 0 deletions user_guide_src/source/outgoing/views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ When doing so you will need to include the directory name loading the view. Exam
.. literalinclude:: views/004.php
:lines: 2-

.. _namespaced-views:

Namespaced Views
================

Expand Down

0 comments on commit 8fc8985

Please sign in to comment.