Comments on “Learning CakePHP: Validation” http://robwilkerson.org/2009/07/31/learning-cakephp-validation/feed 2009-09-29T09:07:00-04:00 Chyrp Learning CakePHP: Validation tag:robwilkerson.org,2009-09-29:/id/176//comment_12987 2009-09-29T09:07:00-04:00 2009-09-29T09:07:00-04:00 neel http://www.snilesh.com <p>Nice article for the cakephp validation I am looking for this..</p> Learning CakePHP: Validation tag:robwilkerson.org,2009-07-31:/id/176//comment_11056 2009-07-31T20:28:51-04:00 2009-07-31T20:28:51-04:00 Rob Wilkerson http://robwilkerson.org <p>Thanks, Miles. Obviously a nuance with huge implications (if such a thing can still be called a “nuance”). I’ll adjust my code – and the article – immediately. I appreciate the insight.</p> Learning CakePHP: Validation tag:robwilkerson.org,2009-07-31:/id/176//comment_11053 2009-07-31T17:59:38-04:00 2009-07-31T17:59:38-04:00 Miles Johnson http://milesj.me/ <p>Great article, but one big problem in your code.</p> <p>return !$this->validates() ? $this->invalidFields() : array();</p> <p>Should be changed to:</p> <p>return !$this->validates() ? $this->validationErrors : array();</p> <p>Because if you use invalidFields(), it calls validates() <span class="caps">AGAIN</span>, which makes it validate <span class="caps">TWICE</span> which causes unnecessary processing and unexpected results.</p>