Fail validation if one rule for any field fails
How do you make validation in CakePHP stop if any single rule fails for any field?
开发者_如何学JAVAI know about the 'last' property but that only stops validation for that field, I want it to stop completely.
Thanks.
I was validating a picture upload in the model and then uploading it there and creating a user folder for the photo. Obviously I didn't know the user ID if the record failed the photo validation so the folder couldn't be created.
I have modified my validation to validate the upload and added a reference to the temporary uploaded file within the model class. I then wrote a custom afterSave() function to check if the user had uploaded an image when they registered, and if so to create the appropriate folders and move the image to a permanent location.
Thanks for the help.
精彩评论