Thanks a lot José, would be interesting to compare what you do with what I was going to do :)
Cheers
Tarique
On Fri, Mar 14, 2014 at 3:07 PM, José Lorenzo <jose.zap@gmail.com> wrote:
Tarique, I can confirm the problem. It is actually an overlook on how the validation system works now I will implementing a solution and providing documentation for it soon.
On Friday, March 14, 2014 10:10:18 AM UTC+1, José Lorenzo wrote:Sure, I think github is a better place to track this problem
On Friday, March 14, 2014 7:56:40 AM UTC+1, Dr. Tarique Sani wrote:Another strange thing. If I use an Entity class written in a file then at least the validation works but if I try the following in the controller$article = new Cake\ORM\Entity;$article->accessible('*', true);$article = $this->Articles->patchEntity($article, $this->request->data);Validation is completely skipped. I traced it till the _addValidatorProps in http://api.cakephp.org/3.0/source-class-Cake.Validation.ValidationRule.html#171-190 and then ran out of time...Should I file this on github?CheersTariqueOn Fri, Mar 14, 2014 at 8:46 AM, Dr. Tarique Sani <tariq...@gmail.com> wrote:
Hi,Wonder if you had the time to look into why custom error messages don't get populated?http://bin.cakephp.org/saved/120670 has my complete Table class
The controller is more or less like you suggested in http://bin.cakephp.org/saved/120567CheersTariqueOn Thu, Mar 13, 2014 at 1:56 PM, José Lorenzo <jose...@gmail.com> wrote:
It could be a bug. I'm going to check that out in a bit. To avoid the strict warning you need:--
use Cake\Validation\Validator;class ArticlesTable extends Table {public function validationDefault(Validator $validator) {...
On Thursday, March 13, 2014 6:07:47 AM UTC+1, Dr. Tarique Sani wrote:My AtriclesTable haspublic function validationDefault($validator) {$validator->add('title', 'not-Empty', ['rule' => 'notEmpty','message' => 'You need to provide a title',])->add('body', 'not-Empty', ['rule' => 'notEmpty','message' => 'A body is required']);return $validator;}When I try to save an article entity the validation runs fine but I am only getting the default in the ArticleEntity'errors' => ['title' => [(int) 0 => 'This field cannot be left empty'],'body' => [(int) 0 => 'This field cannot be left empty']]Additionally there is a warningStrict (2048): Declaration of App\Model\Table\ArticlesTable::validationDefault() should be compatible with Cake\ORM\Table::validationDefault(Cake\Validation\Validator $validator) [APP/Model/Table/ArticlesTable.php, line 7]
What additional steps are needed to fix this?CheersTarique--
=============================================================
The Conference Schedule Creator : http://shdlr.com
PHP for E-Biz : http://sanisoft.com
=============================================================
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@googlegroups.com.
To post to this group, send email to cake...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
--
=============================================================
The Conference Schedule Creator : http://shdlr.com
PHP for E-Biz : http://sanisoft.com
=============================================================--
=============================================================
The Conference Schedule Creator : http://shdlr.com
PHP for E-Biz : http://sanisoft.com
=============================================================--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
=============================================================
The Conference Schedule Creator : http://shdlr.com
PHP for E-Biz : http://sanisoft.com
=============================================================
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment