S
S
sampekmoy2020-12-05 00:16:36
Design patterns
sampekmoy, 2020-12-05 00:16:36

What methods/setters should be in a DB model?

What methods or setters are appropriate to place in the database model (using ORM)? Is it possible to place these methods in all ORM patterns, in AR / UoW / DM, etc.?

For example, in my opinion, the setter for password - should be in the model, a clean password is passed to it, which is hashed and installed in the instance. But the check_password method, which compares the hash of the entry and the passed password, must be in the services.

Methods and setters in the database model should only be those that directly affect setting or getting values
. Is this the right way of thinking?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question