File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,13 @@ Mailer
113113- Added ``Message::addAttachment() `` for adding attachments to a message. Like
114114 other message methods, it can be accessed via the ``Mailer `` instance as ``$mailer->addAttachment() ``.
115115
116+ ORM
117+ ---
118+
119+ - ``Table::patchEntity() ``, ``Table::newEntity() ``, ``Marshaller::one() `` and
120+ ``Marshaller::many() `` now accept a ``strictFields `` option that only applies
121+ validation to the fields listed in the ``fields `` option.
122+
116123Routing
117124-------
118125
Original file line number Diff line number Diff line change @@ -713,6 +713,23 @@ Using this feature is handy when you have many different functions your users
713713can access and you want to let your users edit different data based on their
714714privileges.
715715
716+ When using the ``fields `` option, validation will be applied to all fields in
717+ the request data. You can limit validation to only the allowed fields by passing
718+ ``strictFields `` to the ``patchEntity() `` or ``newEntity() `` call::
719+
720+ // Contains ['user_id' => 100, 'title' => 'Hacked!'];
721+ $data = $this->request->getData();
722+
723+ // Only title will be validated and updated.
724+ $entity = $this->patchEntity($entity, $data, [
725+ 'fields' => ['title'],
726+ 'strictFields' => true,
727+ ]);
728+ $this->save($entity);
729+
730+ .. versionadded :: 5.3.0
731+ The ``strictFields `` option was added in 5.3.0.
732+
716733.. _saving-entities :
717734
718735Saving Entities
You can’t perform that action at this time.
0 commit comments