Comments (9)
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.
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.
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.
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.
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.
9th Apr 2010, ckdarby said:
Well I was pretty sure the beforeValidate only trigged on save call backs;
from cakephp.
9th Apr 2010, ckdarby said:
save operations*
from cakephp.
I don't see a specific use case or feature outlined here. We should close.
from cakephp.
Yep, me neither ;-)
from cakephp.
Related Issues (20)
- Has the sortKey method been removed from PaginatorHelper? HOT 1
- FormProtectionComponent with Authentication plugin active HOT 2
- `belongsTo` a different connection doesn't get picked up automatically HOT 6
- Add replace argument to IntegrationTestTrait::configRequest HOT 9
- RFC: Comma separated options/arguments for Commands HOT 2
- Different behavior of Hash::insert and Hash::extract which leads to fatal error HOT 1
- NotFoundException is using the error500 template instead of the error400 template. HOT 7
- DateTime microseconds make it null on save HOT 1
- ErrorController::beforeRender not called HOT 11
- Problem formatting milliseconds using i18nFormat HOT 3
- RulesChecker::remove() HOT 4
- FormProtector failing with csrfSessionMiddleware
- Component integration testing is broken with PHPUnit 10.5 and php 8.2
- Schema setColumnType silent no-op HOT 3
- Tests have wrong Connection aliases if testing with fixtures with different connection name HOT 5
- Still a small issue on ObjectRegistry load aliasing HOT 6
- Breaking change cakephp/database HOT 10
- Strpos result comparison HOT 3
- Feature: Enum validation - subset
- Double loading of plugin HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cakephp.