backdrop-issues icon indicating copy to clipboard operation
backdrop-issues copied to clipboard

[DX] [D8] Add a `validate()` method to entity classes

Open avpaderno opened this issue 1 year ago • 2 comments

In Drupal 8, classes that are used in order to implement a content entity (which extend the ContentEntityBase class) have a validate() method that validates the values entered when creating the entity.

A similar method should be introduced in Backdrop and added to EntityInterface.

avpaderno avatar Apr 14 '23 13:04 avpaderno

This is probably a Backdrop 2.x feature. Contributed modules could have implemented a validate() method in their entities that could be not compatible with the implementation Backdrop adds.

avpaderno avatar Mar 14 '24 17:03 avpaderno

This is probably a Backdrop 2.x feature.

Agreed. This would be a fairly complex and deep change to the way Backdrop deals with entities and data in general (e.g. fields). It's not just about creating a validate method for the entity class. The Drupal ContentEntityBase::validate() method actually calls the validate method for the entity's "typed data" objects - for example, its fields and properties.

argiepiano avatar Mar 14 '24 17:03 argiepiano