In CakePHP, for the unique constraints that are taken into account in the database, what is the advantage of doing the same validation checks in the model?
I understand the advantage of JS validation, but I believe this model validation makes an extra trip to the database. I am 100% sure that some checks are done in the database, so checking the model is simply redundant.
The only advantage that I see is an application that recognizes an error and corrects the view for the user accordingly (re-filling the fields and displaying the error message in the corresponding field, improving ux), but this can be achieved if a restriction has been assigned and therefore the application can Understand that the problem was with persistence (existing method for doing this now?)
Faster response time, less database load. The farther to the client you can do validation, i.e. JavaScript, the faster it will happen. The main con should implement the same rules in several layers.
If the database constraints are encoded by one person and the rest of the code is code by another, they really should not fully trust each other. Check the situation at the borders, especially if they represent the boundaries of the organizational level. for example, a user to an application or one developer module to another, or one corporate department to another.
. , . SQLite, MySQL.. , , . PostgreSQL? ? , Oracle, .
, , , , , ( , , ). , , , , .
, - ? , , CakePHP , . , DBO , .
, , , - . , .
CakePHP , . . , . .
( , ..) , . ( ), ( , , - .
. , - , , ; .
@le dorfier
- - ( "-", " , - ).
, , " " ( , , RA plus TC Turing). RA ( TC) ", " ( , -/ "-" ).
, , " " , dbms ( , ) -, -.
" ". - , , -: RA, / , ?
@bradley harris.
Correctly. I would vote for you if voting were available to me. But you forget to mention that since no one can ever be sure that no other application will ever need a certain database, the only reasonable place to execute business rules is inside the DBMS.
Source: https://habr.com/ru/post/1748619/More articles:hierarchical clustering with gene expression matrix in python - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1748615/macros-to-set-and-clear-bits&usg=ALkJrhh77ZmU9Uwd2EM6Rhas-keNkFvkNgC # using statement placement - c #Configuration Management for FPGA Designs - cHow can I create Google search style suggestions using Javascript / AJAX? - javascriptПлагин Maven для причала и каталог ресурсов - javaDependency Injection, IoC and Mocking are finally explained in a simple and understandable way! - dependency-injectionStructure containing map on map? (C ++ / STL) - c ++Tomcat Digest with WebApp Manager - tomcatRails: how can I display flash [: notification] - ruby-on-railsAll Articles