Skip to content

Commit ab2d13d

Browse files
committed
docs: make property names links
1 parent ac44308 commit ab2d13d

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

user_guide_src/source/models/model.rst

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ is used with methods like ``find()`` to know what column to match the specified
111111
$useAutoIncrement
112112
-----------------
113113

114-
Specifies if the table uses an auto-increment feature for ``$primaryKey``. If set to ``false``
114+
Specifies if the table uses an auto-increment feature for `$primaryKey`_. If set to ``false``
115115
then you are responsible for providing primary key value for every record in the table. This
116116
feature may be handy when we want to implement 1:1 relation or use UUIDs for our model. The
117117
default value is ``true``.
118118

119-
.. note:: If you set ``$useAutoIncrement`` to ``false``, then make sure to set your primary
119+
.. note:: If you set `$useAutoIncrement`_ to ``false``, then make sure to set your primary
120120
key in the database to ``unique``. This way you will make sure that all of Model's features
121121
will still work the same as before.
122122

@@ -142,8 +142,8 @@ part of a security trail. If true, the **find*()** methods will only return non-
142142
the ``withDeleted()`` method is called prior to calling the **find*()** method.
143143

144144
This requires either a DATETIME or INTEGER field in the database as per the model's
145-
``$dateFormat`` setting. The default field name is ``deleted_at`` however this name can be
146-
configured to any name of your choice by using ``$deletedField`` property.
145+
`$dateFormat`_ setting. The default field name is ``deleted_at`` however this name can be
146+
configured to any name of your choice by using `$deletedField`_ property.
147147

148148
.. important:: The ``deleted_at`` field must be nullable.
149149

@@ -155,7 +155,7 @@ This array should be updated with the field names that can be set during ``save(
155155
against just taking input from a form and throwing it all at the model, resulting in
156156
potential mass assignment vulnerabilities.
157157

158-
.. note:: The ``$primaryKey`` field should never be an allowed field.
158+
.. note:: The `$primaryKey`_ field should never be an allowed field.
159159

160160
Dates
161161
-----
@@ -164,29 +164,29 @@ $useTimestamps
164164
^^^^^^^^^^^^^^
165165

166166
This boolean value determines whether the current date is automatically added to all inserts
167-
and updates. If true, will set the current time in the format specified by ``$dateFormat``. This
167+
and updates. If ``true``, will set the current time in the format specified by `$dateFormat`_. This
168168
requires that the table have columns named **created_at**, **updated_at** and **deleted_at** in the appropriate
169169
data type.
170170

171171
$dateFormat
172172
^^^^^^^^^^^
173173

174-
This value works with ``$useTimestamps`` and ``$useSoftDeletes`` to ensure that the correct type of
174+
This value works with `$useTimestamps`_ and `$useSoftDeletes`_ to ensure that the correct type of
175175
date value gets inserted into the database. By default, this creates DATETIME values, but
176-
valid options are: ``'datetime'``, ``'date'``, or ``'int'`` (a PHP timestamp). Using **useSoftDeletes** or
177-
**useTimestamps** with an invalid or missing **dateFormat** will cause an exception.
176+
valid options are: ``'datetime'``, ``'date'``, or ``'int'`` (a PHP timestamp). Using `$useSoftDeletes`_ or
177+
`$useTimestamps`_ with an invalid or missing `$dateFormat`_ will cause an exception.
178178

179179
$createdField
180180
^^^^^^^^^^^^^
181181

182182
Specifies which database field to use for data record create timestamp.
183-
Set to an empty string (``''``) to avoid updating it (even if ``$useTimestamps`` is enabled).
183+
Set to an empty string (``''``) to avoid updating it (even if `$useTimestamps`_ is enabled).
184184

185185
$updatedField
186186
^^^^^^^^^^^^^
187187

188188
Specifies which database field should use for keep data record update timestamp.
189-
Set to an empty string (``''``) to avoid updating it (even ``$useTimestamps`` is enabled).
189+
Set to an empty string (``''``) to avoid updating it (even `$useTimestamps`_ is enabled).
190190

191191
$deletedField
192192
^^^^^^^^^^^^^
@@ -284,7 +284,7 @@ Returns a single row where the primary key matches the value passed in as the fi
284284

285285
.. literalinclude:: model/006.php
286286

287-
The value is returned in the format specified in ``$returnType``.
287+
The value is returned in the format specified in `$returnType`_.
288288

289289
You can specify more than one row to return by passing an array of primaryKey values instead
290290
of just one:
@@ -329,7 +329,7 @@ Returns the first row in the result set. This is best used in combination with t
329329
withDeleted()
330330
-------------
331331

332-
If ``$useSoftDeletes`` is true, then the **find*()** methods will not return any rows where ``deleted_at IS NOT NULL``.
332+
If `$useSoftDeletes`_ is true, then the **find*()** methods will not return any rows where ``deleted_at IS NOT NULL``.
333333
To temporarily override this, you can use the ``withDeleted()`` method prior to calling the **find*()** method.
334334

335335
.. literalinclude:: model/013.php
@@ -351,7 +351,7 @@ insert()
351351
The first parameter is an associative array of data to create a new row of data in the database.
352352
If an object is passed instead of an array, it will attempt to convert it to an array.
353353

354-
The array's keys must match the name of the columns in the ``$table``, while the array's values are the values to save for that key.
354+
The array's keys must match the name of the columns in the `$table`_, while the array's values are the values to save for that key.
355355

356356
The optional second parameter is of type boolean, and if it is set to false, the method will return a boolean value,
357357
which indicates the success or failure of the query.
@@ -376,15 +376,15 @@ You can enable the check again by calling ``allowEmptyInserts(false)``.
376376
update()
377377
--------
378378

379-
Updates an existing record in the database. The first parameter is the ``$primaryKey`` of the record to update.
379+
Updates an existing record in the database. The first parameter is the `$primaryKey`_ of the record to update.
380380
An associative array of data is passed into this method as the second parameter. The array's keys must match the name
381-
of the columns in a ``$table``, while the array's values are the values to save for that key:
381+
of the columns in a `$table`_, while the array's values are the values to save for that key:
382382

383383
.. literalinclude:: model/016.php
384384

385385
.. important:: Since v4.3.0, this method raises a ``DatabaseException``
386386
if it generates an SQL statement without a WHERE clause.
387-
In previous versions, if it is called without ``$primaryKey`` specified and
387+
In previous versions, if it is called without `$primaryKey`_ specified and
388388
an SQL statement was generated without a WHERE clause, the query would still
389389
execute and all records in the table would be updated.
390390

@@ -440,7 +440,7 @@ Takes a primary key value as the first parameter and deletes the matching record
440440

441441
.. literalinclude:: model/023.php
442442

443-
If the model's ``$useSoftDeletes`` value is true, this will update the row to set ``deleted_at`` to the current
443+
If the model's `$useSoftDeletes`_ value is true, this will update the row to set ``deleted_at`` to the current
444444
date and time. You can force a permanent delete by setting the second parameter as true.
445445

446446
An array of primary keys can be passed in as the first parameter to delete multiple records at once:
@@ -481,13 +481,13 @@ prior to saving to the database with the ``insert()``, ``update()``, or ``save()
481481
Setting Validation Rules
482482
------------------------
483483

484-
The first step is to fill out the ``$validationRules`` class property with the fields and rules that should
485-
be applied. If you have custom error message that you want to use, place them in the ``$validationMessages`` array:
484+
The first step is to fill out the `$validationRules`_ class property with the fields and rules that should
485+
be applied. If you have custom error message that you want to use, place them in the `$validationMessages`_ array:
486486

487487
.. literalinclude:: model/027.php
488488

489489
If you'd rather organize your rules and error messages within the Validation configuration file, you can do that
490-
and simply set ``$validationRules`` to the name of the validation rule group you created:
490+
and simply set `$validationRules`_ to the name of the validation rule group you created:
491491

492492
.. literalinclude:: model/034.php
493493

@@ -614,7 +614,7 @@ Protecting Fields
614614
=================
615615

616616
To help protect against Mass Assignment Attacks, the Model class **requires** that you list all of the field names
617-
that can be changed during inserts and updates in the ``$allowedFields`` class property. Any data provided
617+
that can be changed during inserts and updates in the `$allowedFields`_ class property. Any data provided
618618
in addition to these will be removed prior to hitting the database. This is great for ensuring that timestamps,
619619
or primary keys do not get changed.
620620

@@ -629,7 +629,7 @@ Runtime Return Type Changes
629629
===========================
630630

631631
You can specify the format that data should be returned as when using the **find*()** methods as the class property,
632-
``$returnType``. There may be times that you would like the data back in a different format, though. The Model
632+
`$returnType`_. There may be times that you would like the data back in a different format, though. The Model
633633
provides methods that allow you to do just that.
634634

635635
.. note:: These methods only change the return type for the next **find*()** method call. After that,
@@ -674,7 +674,7 @@ You can get access to the **shared** instance of the Query Builder any time you
674674

675675
.. literalinclude:: model/043.php
676676

677-
This builder is already set up with the model's ``$table``.
677+
This builder is already set up with the model's `$table`_.
678678

679679
.. note:: Once you get the Query Builder instance, you can call methods of the
680680
:doc:`Query Builder <../database/query_builder>`.
@@ -748,13 +748,13 @@ must return the original $data array so other callbacks have the full informatio
748748
Specifying Callbacks To Run
749749
===========================
750750

751-
You specify when to run the callbacks by adding the method name to the appropriate class property (``$beforeInsert``, ``$afterUpdate``,
751+
You specify when to run the callbacks by adding the method name to the appropriate class property (`$beforeInsert`_, `$afterUpdate`_,
752752
etc). Multiple callbacks can be added to a single event and they will be processed one after the other. You can
753753
use the same callback in multiple events:
754754

755755
.. literalinclude:: model/051.php
756756

757-
Additionally, each model may allow (default) or deny callbacks class-wide by setting its ``$allowCallbacks`` property:
757+
Additionally, each model may allow (default) or deny callbacks class-wide by setting its `$allowCallbacks`_ property:
758758

759759
.. literalinclude:: model/052.php
760760

0 commit comments

Comments
 (0)