Re: V3.0 Custom validation messages

2014-03-18 Thread José Lorenzo
Tarique, I recently pushed some changes to the validation. You can now do:

$validator-allowEmpty('my_field', false, 'My Custom message');

This deprecates the use of the 'notEmpty' rule.

On Friday, March 14, 2014 12:55:58 PM UTC+1, Dr. Tarique Sani wrote:

 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...@gmail.comjavascript:
  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?

 Cheers

 Tarique



 On Fri, Mar 14, 2014 at 8:46 AM, Dr. Tarique Sani 
 tariq...@gmail.comwrote:

 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/120567 

 Cheers
  Tarique


 On Thu, Mar 13, 2014 at 1:56 PM, José Lorenzo jose...@gmail.comwrote:

 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 has 


 public 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 warning 

 Strict (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?

 Cheers
 Tarique

 -- 
 =
 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+u...@googlegroups.com javascript:.
 To post to this group, send email to cake...@googlegroups.comjavascript:
 .
 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

 

Re: V3.0 Custom validation messages

2014-03-18 Thread Dr. Tarique Sani
Cool - that works. Now trying out for other rules

Also instead having to write echo $this-Form-input('title',['required' =
false] ); keep the required to false by default OR have a javascript helper
automatically output and attach custom error messages to fields. The second
option will be really cool to have.

Thanks for your efforts

Regards
Tarique



On Tue, Mar 18, 2014 at 7:10 PM, José Lorenzo jose@gmail.com wrote:

 Tarique, I recently pushed some changes to the validation. You can now do:

 $validator-allowEmpty('my_field', false, 'My Custom message');

 This deprecates the use of the 'notEmpty' rule.


 On Friday, March 14, 2014 12:55:58 PM UTC+1, Dr. Tarique Sani wrote:

 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...@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/so
 urce-class-Cake.Validation.ValidationRule.html#171-190 and then ran
 out of time...

 Should I file this on github?

 Cheers

 Tarique



 On Fri, Mar 14, 2014 at 8:46 AM, Dr. Tarique Sani 
 tariq...@gmail.comwrote:

 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/120567

 Cheers
  Tarique


 On Thu, Mar 13, 2014 at 1:56 PM, José Lorenzo jose...@gmail.comwrote:

 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 has


 public 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 warning

 Strict (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?

 Cheers
 Tarique

 --
 =
 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, 

Re: V3.0 Custom validation messages

2014-03-14 Thread Dr. Tarique Sani
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-190and
then ran out of time...

Should I file this on github?

Cheers

Tarique



On Fri, Mar 14, 2014 at 8:46 AM, Dr. Tarique Sani tariques...@gmail.comwrote:

 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/120567

 Cheers
 Tarique


 On 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 has


 public 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 warning

 Strict (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?

 Cheers
 Tarique

 --
 =
 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+unsubscr...@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
 =




-- 
=
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+unsubscr...@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.


Re: V3.0 Custom validation messages

2014-03-14 Thread José Lorenzo
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-190and
  then ran out of time...

 Should I file this on github?

 Cheers

 Tarique



 On Fri, Mar 14, 2014 at 8:46 AM, Dr. Tarique Sani 
 tariq...@gmail.comjavascript:
  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/120567 

 Cheers
 Tarique


 On Thu, Mar 13, 2014 at 1:56 PM, José Lorenzo jose...@gmail.comjavascript:
  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 has 


 public 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 warning 

 Strict (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?

 Cheers
 Tarique

 -- 
 =
 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 javascript:.
 To post to this group, send email to cake...@googlegroups.comjavascript:
 .
 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+unsubscr...@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.


Re: V3.0 Custom validation messages

2014-03-14 Thread José Lorenzo
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-190and
  then ran out of time...

 Should I file this on github?

 Cheers

 Tarique



 On Fri, Mar 14, 2014 at 8:46 AM, Dr. Tarique Sani tariq...@gmail.comwrote:

 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/120567 

 Cheers
 Tarique


 On 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 has 


 public 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 warning 

 Strict (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?

 Cheers
 Tarique

 -- 
 =
 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+unsubscr...@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.


Re: V3.0 Custom validation messages

2014-03-14 Thread Dr. Tarique Sani
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@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?

 Cheers

 Tarique



 On Fri, Mar 14, 2014 at 8:46 AM, Dr. Tarique Sani tariq...@gmail.comwrote:

 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/120567

 Cheers
 Tarique


 On Thu, Mar 13, 2014 at 1:56 PM, José Lorenzo jose...@gmail.comwrote:

 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 has


 public 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 warning

 Strict (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?

 Cheers
 Tarique

 --
 =
 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+unsubscr...@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 

Re: V3.0 Custom validation messages

2014-03-13 Thread José Lorenzo
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 has 


 public 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 warning 

 Strict (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?

 Cheers
 Tarique

 -- 
 =
 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+unsubscr...@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.


Re: V3.0 Custom validation messages

2014-03-13 Thread Dr. Tarique Sani
Thanks - guess at some point I will fork the docs and add all the stuff you
have been helping me with in the Tutorial and send a pull request

Tarique


On 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 has


 public 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 warning

 Strict (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?

 Cheers
 Tarique

 --
 =
 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+unsubscr...@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+unsubscr...@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.


Re: V3.0 Custom validation messages

2014-03-13 Thread José Lorenzo
That would be greatly appreciated!

On Thursday, March 13, 2014 10:24:18 AM UTC+1, Dr. Tarique Sani wrote:

 Thanks - guess at some point I will fork the docs and add all the stuff 
 you have been helping me with in the Tutorial and send a pull request

 Tarique


 On Thu, Mar 13, 2014 at 1:56 PM, José Lorenzo jose...@gmail.comjavascript:
  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 has 


 public 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 warning 

 Strict (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?

 Cheers
 Tarique

 -- 
 =
 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 javascript:.
 To post to this group, send email to cake...@googlegroups.comjavascript:
 .
 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+unsubscr...@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.


Re: V3.0 Custom validation messages

2014-03-13 Thread Dr. Tarique Sani
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/120567

Cheers
Tarique


On 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 has


 public 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 warning

 Strict (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?

 Cheers
 Tarique

 --
 =
 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+unsubscr...@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+unsubscr...@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.


V3.0 Custom validation messages

2014-03-12 Thread Dr. Tarique Sani
My AtriclesTable has


public 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 warning

Strict (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?

Cheers
Tarique

-- 
=
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+unsubscr...@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.