Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kiamlaluno opened this issue Apr 14, 2023 · 2 comments
Open

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

kiamlaluno opened this issue Apr 14, 2023 · 2 comments

Comments

@kiamlaluno
Copy link
Member

kiamlaluno commented Apr 14, 2023

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.

@kiamlaluno
Copy link
Member Author

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.

@argiepiano
Copy link

argiepiano commented Mar 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants