Git Product home page Git Product logo

Comments (9)

 avatar commented on May 20, 2024

22nd Mar 2010, ckdarby said:


This is just a basic outline of what I'd like to see cakePHP wrap the validation with;

from cakephp.

 avatar commented on May 20, 2024

22nd Mar 2010, Mark Story said:


How about a diff? Seems some features added in 1.3 have been removed as well. Namely errors being triggered for unhandled validation methods. Also what does this code add? could you provide some examples or tests cases to show the benefits of this code over the existing implementation?

from cakephp.

 avatar commented on May 20, 2024

8th Apr 2010, ckdarby said:


Disclaimers
I haven't been keeping up to date with all the 1.3 features and therefore this could be an entirely invalid enhancement and I am sorry for wasting your time if 1.3 is taking an entirely different approach.

Problem
I currently use the model validation for absolutely all my forms, registration, login, edits, etc. The current problem that stands as of 1.2.6 is the fact that this is impossible.

Example
Registration form uses the User model validation to make sure the user is unique, valid characters, etc on username.

Login form I manually trigger the model validation because there's no updating and or creating thus the validation() doesn't get triggered on the login finding of the user but the current problem is that all the rules are triggered; I can currently tell it to ignore entire validation on username but not on a per rule bases.

Solution

1)Outline in the documentation that the model validation should be only used strictly for creating/updating to the model and not for verifying content.
This also leads to the fact if you can't use model validation for rule validation on non-create/update things such as a login form that something should be added for this into the core.

2)See the code I wrote that allows specific per rule names to be ignored on the validation() function; This in return allows me to remove the rule name that is bound to the isUnique model rule and therefore the login form still gets checked for a valid email, valid chars, etc.

Comments
You could have got all this information simply by actually spending the extra 5 minutes reviewing what the coding changes were and reading what I put....

from cakephp.

 avatar commented on May 20, 2024

9th Apr 2010, Mark Story said:


Sorry, but I didn't think asking for a diff is really unreasonable. You pasted a 150+ line function(s), that contains a high percentage of similar code, finding what has changed is far more difficult than finding changes in a diff.

I don't think there is any reason to modify the documentation to say you can't use validation for those purposes. Sure you may have to write some additional code to facilitate it, but it is doable. And depending on the rules you define and use there may be no issues at all in using you default validation rules for checking non create/update uses.

from cakephp.

 avatar commented on May 20, 2024

9th Apr 2010, dakota said:


The functionality that you are outlining is very easily done in the beforeValidation callback without needing to modify any core code.

On a side note, I don't think it is appropriate putting a snotty comment that "You could have got all this information simply by actually spending the extra 5 minutes reviewing what the coding changes were and reading what I put". Mark and the rest of the Cake team are volunteers and are not paid to maintain CakePHP, chances are that Mark just doesn't have the 5 minutes available to review what has changed in a 150+ line code segment.

Especially not when it takes you (The writer of the modified code) all of 5 seconds to generate a diff. The responsibility to give all required information (This includes a diff) is on the person suggesting the change, not on the person reviewing the change.

from cakephp.

 avatar commented on May 20, 2024

9th Apr 2010, ckdarby said:


Well I was pretty sure the beforeValidate only trigged on save call backs;

from cakephp.

 avatar commented on May 20, 2024

9th Apr 2010, ckdarby said:


save operations*

from cakephp.

dereuromark avatar dereuromark commented on May 20, 2024

I don't see a specific use case or feature outlined here. We should close.

from cakephp.

ravage84 avatar ravage84 commented on May 20, 2024

Yep, me neither ;-)

from cakephp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.