# |
May 19th 2017, 15:26 |
slackebot |
idea as to how I can update my validator to check if there is an uppercase letter and a digit? |
# |
May 19th 2017, 15:26 |
slackebot |
'hasUppercase'=>[ 'rule'=>['custom', 'regex'=>'/[A-Z]/'], 'message'=>'Password must contain at least one uppercase letter' ], 'hasDigit'=>[ 'rule'=>['custom', 'regex'=>'/[0-9]/'], 'message'=>'Password must contain at least one number' ] ]); ``` The custom rules in hasUppercase and hasDigit are causing this error it seems, but since I am still kind of a cake noob and didn't write the code, I don't know how to fix it. Does any |
# |
May 19th 2017, 15:26 |
animepauly |
We updated cakephp from 3.3.x to 3.4.5, and now when users attempt to register, they get the following error: ``` [Error] Cannot unpack array with string keys in /var/www/public/adphenom-portal/vendor/cakephp/cakephp/src/Validation/ValidationRule.php ``` I have pinpointed the problem to here: ``` $validator->add('new_password', [ 'length'=>[ 'rule'=>['minLength', 6], 'message'=>'Password must contain at least 6 characters' ], |
# |
May 19th 2017, 14:31 |
cake-novice |
hi. https://pastebin.com/e6i6E4ty here is my code .. i am trying to get result from 3 tables which have foreign_key of each other.. so i am not getting last 3rd tabel data, Which is Template table |
# |
May 19th 2017, 14:29 |
obinoob |
cake-novice: thank you ;) |
# |
May 19th 2017, 14:28 |
cake-novice |
http://josediazgonzalez.com/2015/12/23/data-validation-in-cakephp-3/ see this |
# |
May 19th 2017, 14:27 |
cake-novice |
obinoob: yes you can create |
# |
May 19th 2017, 14:25 |
obinoob |
is it possible to create a custom validator and call in a controller action method? |
# |
May 19th 2017, 14:15 |
obinoob |
Can I create a custom validator only for sending emails? |
# |
May 19th 2017, 14:14 |
cake-novice |
$this->User->recursive = 0; $this->User->bindModel(['belongsTo' => ['Form' =>['className' => 'Form', 'foreignKey' => 'form_id']]]); $leads = $this->User->find('all', 'contain' => array('Form')); |
# |
May 19th 2017, 14:14 |
cake-novice |
form has template_id (template primary key) |
# |
May 19th 2017, 14:14 |
cake-novice |
User has form_id (form primary key) |
# |
May 19th 2017, 14:14 |
cake-novice |
User , Form, Template |
# |
May 19th 2017, 14:14 |
cake-novice |
what i am doing wrong in this i am not getting data of template modal |
# |
May 19th 2017, 14:13 |
cake-novice |
User , Form, Template User has form_id (form primary key) form has template_id (template primary key) $this->User->recursive = 0; $this->User->bindModel(['belongsTo' => ['Form' =>['className' => 'Form', 'foreignKey' => 'form_id']]]); $leads = $this->User->find('all', 'contain' => array('Form')); |
# |
May 19th 2017, 13:56 |
GuillaumeP |
For those interested, I found the answer here on S.O. : http://stackoverflow.com/questions/36722156/cakephp-3-how-to-validate-multiple-select-field-belongstomany-association |
# |
May 19th 2017, 13:44 |
GuillaumeP |
Neon1024: there is a validation method named "multiple" which works fine, but I'm probably not naming the field right when in HABTM |
# |
May 19th 2017, 13:32 |
Neon1024 |
requirePresence()* |
# |
May 19th 2017, 13:32 |
Neon1024 |
I’d probably just use requiredPresence() and notEmpty() |
# |
May 19th 2017, 13:31 |
GuillaumeP |
Hi! Have you ever tried to create a validation method in Cake 3 to make sure that at least one choice is made in a MultipleSelect or CheckboxGroup (HABTM) ? I can only make it work in a non-HABTM context. |
# |
May 19th 2017, 13:28 |
rudy1976s |
thank you @neon1024 |
# |
May 19th 2017, 13:28 |
Neon1024 |
$table->hasField() |
# |
May 19th 2017, 13:28 |
Neon1024 |
Ah it’s a shortcut in \Cake\ORM\Table hasField() |
# |
May 19th 2017, 13:27 |
Neon1024 |
$this->_table->getSchema()->hasColumn() I think, let me check |
# |
May 19th 2017, 13:27 |
Neon1024 |
Yes, I think it has that, but you need to get the schema iirc |
# |
May 19th 2017, 13:19 |
rudy1976s |
I was thinking of something lile $this->table->column(‘name’) |
# |
May 19th 2017, 13:19 |
eax |
Ahh, not sure then, sorry! :) Good luck! |
# |
May 19th 2017, 13:19 |
rudy1976s |
I am migrating some tables |
# |
May 19th 2017, 13:19 |
rudy1976s |
no its just for retrocompatibility |
# |
May 19th 2017, 13:18 |
eax |
Oh, hmm, and you want to avoid hitting a situation where the column could be hidden by the entity, or something like that? |
# |
May 19th 2017, 13:18 |
rudy1976s |
and I need to make somethin only if te table on whch the behavior is acting on has a column called “column_name” |
# |
May 19th 2017, 13:17 |
rudy1976s |
I am in a behavior |
# |
May 19th 2017, 13:17 |
rudy1976s |
@eax I need to know if the actual model table has a particular column which in my case could be user_id or created_by |
# |
May 19th 2017, 13:16 |
eax |
What do you mean rudy1976s? What do you want to check specifically? |
# |
May 19th 2017, 13:15 |
rudy1976s |
is there a way to check against a table column name in a model ? |
# |
May 19th 2017, 12:44 |
eax |
Hey folks! Cake3 CRUD question: In the CRUD API, can I edit 2 different models (Articles belongsTo AuthorDescription)? I have a form that saves both the Article and the AuthorDescription, and on edit it consistently try to create a new AuthorDescription |
# |
May 19th 2017, 12:27 |
kareylo |
The problem was the new bug... feature. |
# |
May 19th 2017, 12:27 |
kareylo |
:slightly_smiling_face: |
# |
May 19th 2017, 12:27 |
dereuromark |
that actually works. nice |
# |
May 19th 2017, 12:27 |
kareylo |
new "feature"... |
# |
May 19th 2017, 12:26 |
dereuromark |
Yeah I am gonna try "autoload_files: - %rootDir%/../../../tests/bootstrap.php" |