1.. include:: ../../Includes.txt 2 3==================================================================== 4Feature: #93835 - AddErrorForProperty function for AbstractValidator 5==================================================================== 6 7See :issue:`93835` 8 9Description 10=========== 11 12When validating Extbase models, it could be helpful to assign the encountered 13error to a certain property. This is already possible by using 14:php:`$this->result->forProperty($propertyPath)->addError($error);`. This 15method however is cumbersome and requires knowledge about the result object. 16To ease the pain for developers, a convenience method :php:`addErrorForProperty` 17is now available. 18 19Use it like this in a validator class: 20 21.. code-block:: php 22 23 public function isValid(): void 24 { 25 // validation 26 $this->addErrorForProperty( 27 'object.property.name', 28 $this->translateErrorMessage( 29 'validator.errormessage', 30 'my-ext' 31 ), 32 // tstamp_of_now_as_errorcode 33 123456789 34 ); 35 } 36 37 38Impact 39====== 40 41The new method enables developers adding custom error messages to validation 42results of properties in a convenient way. 43 44.. index:: ext:extbase 45