Skip to content

Commit 70f5d2c

Browse files
committed
docs: add explanations
1 parent 8a0524d commit 70f5d2c

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

user_guide_src/source/models/model.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ update command, with the added benefit of validation, events, etc:
364364

365365
.. literalinclude:: model/018.php
366366

367+
.. _model-save:
368+
367369
save()
368370
------
369371

user_guide_src/source/tutorial/create_news_items.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,14 @@ The code above adds a lot of functionality.
8787
First we load the :doc:`Form helper <../helpers/form_helper>` with the :php:func:`helper()` function.
8888
Most helper functions require the helper to be loaded before use.
8989

90-
Next, we check if we deal with the **POST** request with the Request object ``$this->request``.
90+
Next, we check if we deal with the **POST** request with the
91+
:doc:`IncomingRequest <../incoming/incomingrequest>` object ``$this->request``.
9192
It is set in the controller by the framework.
9293
If the HTTP method is not POST, that is it is GET,
9394
the form is loaded and returned to display.
9495

9596
Then, we get the necessary items from the POST data by the user and set them in the ``$post`` variable.
96-
We also use the Request object ``$this->request``.
97+
We also use the :doc:`IncomingRequest <../incoming/incomingrequest>` object ``$this->request``.
9798

9899
After that, the Controller-provided helper function :ref:`validateData() <controller-validatedata>`
99100
is used to validate ``$post`` data.
@@ -104,7 +105,9 @@ above. You can read more about the :doc:`Validation library <../libraries/valida
104105
If the validation fails, the form is loaded and returned to display.
105106

106107
If the validation passed all the rules, the **NewsModel** is loaded and called. This
107-
takes care of passing the news item into the model.
108+
takes care of passing the news item into the model. The :ref:`model-save` method handles
109+
inserting or updating the record automatically, based on whether it finds an array key
110+
matching the primary key.
108111

109112
This contains a new function :php:func:`url_title()`. This function -
110113
provided by the :doc:`URL helper <../helpers/url_helper>` - strips down

0 commit comments

Comments
 (0)