Skip to content

Commit cadc6f8

Browse files
committed
docs: add missing $allowEmptyInserts
1 parent 2190110 commit cadc6f8

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

user_guide_src/source/models/model.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@ potential mass assignment vulnerabilities.
157157

158158
.. note:: The `$primaryKey`_ field should never be an allowed field.
159159

160+
$allowEmptyInserts
161+
------------------
162+
163+
.. versionadded:: 4.3.0
164+
165+
Whether to allow inserting empty data. The default value is ``false``, meaning
166+
that if you try to insert empty data, an exception with
167+
"There is no data to insert." will raise.
168+
169+
You may also change this setting with the :ref:`model-allow-empty-inserts` method.
170+
160171
Dates
161172
-----
162173

@@ -371,6 +382,8 @@ You can use ``allowEmptyInserts()`` method to insert empty data. The Model throw
371382

372383
.. literalinclude:: model/056.php
373384

385+
You may also change this setting with the `$allowEmptyInserts`_ property.
386+
374387
You can enable the check again by calling ``allowEmptyInserts(false)``.
375388

376389
update()

user_guide_src/source/models/model/005.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class UserModel extends Model
1616

1717
protected $allowedFields = ['name', 'email'];
1818

19+
protected bool $allowEmptyInserts = false;
20+
1921
// Dates
2022
protected $useTimestamps = false;
2123
protected $dateFormat = 'datetime';

0 commit comments

Comments
 (0)