Log message #4201171

# At Username Text
# Sep 3rd 2019, 07:58 javier.villanueva conehead option is the correct
# Sep 3rd 2019, 07:56 javier.villanueva never mind xD
# Sep 3rd 2019, 07:56 javier.villanueva mmm
# Sep 3rd 2019, 07:56 javier.villanueva if is first_name OR last_name is conehead option
# Sep 3rd 2019, 07:56 javier.villanueva @johnwayne @conehead depends
# Sep 3rd 2019, 07:44 conehead I think it should be ``` $query->where( [ 'OR' => [ 'Users.first_name' => $data[self::SEARCH_USER], 'Users.last_name' => $data[self::SEARCH_USER], ], ] ) ```
# Sep 3rd 2019, 07:41 johnwayne Is this valid or not ? ``` $query->where( [ 'Users.first_name' => $data[self::SEARCH_USER], 'OR' => [ 'Users.last_name' => $data[self::SEARCH_USER] ] ] ) ```
# Sep 3rd 2019, 07:40 johnwayne Hi, what is the new syntax for deprecated `->orWhere()` method in this case ``` $query->where( [ 'Users.first_name' => $data[self::SEARCH_USER], ] ) ->orWhere( [ 'Users.last_name' => $data[self::SEARCH_USER], ] ); ```
# Sep 3rd 2019, 07:24 conehead bancer you could convert it to array and then patch. Something like this: `$errors = $validator->errors($yourEntity->toArray());`.
# Sep 3rd 2019, 07:22 javier.villanueva https://api.cakephp.org/3.0/class-Cake.ORM.Table.html#checkRules
# Sep 3rd 2019, 07:20 javier.villanueva maybe checkRules() ?
# Sep 3rd 2019, 07:18 conehead Little bit further away. Münster here ;)
# Sep 3rd 2019, 07:18 alexdd55976 @conehead Darmstadt
# Sep 3rd 2019, 07:17 conehead ``` $validator = $this->YourTable->getValidator(); $errors = $validator->errors(['name' => 'K1']); $this->assertEmpty($errors); ```
# Sep 3rd 2019, 07:17 val @conehead entity
# Sep 3rd 2019, 07:16 conehead @val You got the data as array or as entity? If you got it as data you could just create a new Entity and then call patchEntity
# Sep 3rd 2019, 07:14 val Hi again, how to validate manually constructed entity without saving it in 3.x? `getErrors` is empty
# Sep 3rd 2019, 07:13 jeremy.halin @spriz thanks for your answer and the gist, I will take a look and come back to you if any question :slightly_smiling_face:
# Sep 3rd 2019, 07:08 javier.villanueva morning all!
# Sep 3rd 2019, 07:06 conehead alex where are you from in germany?
# Sep 3rd 2019, 06:56 alexdd55976 good morning fellows
# Sep 3rd 2019, 06:29 Nitrogen essentially, date validation implementation here https://api.cakephp.org/3.8/source-class-Cake.Validation.Validation.html#554 acknowledges the fact that $dateFormat can potentially be an array and handles it accordingly, while datetime/time validation doesn't.
# Sep 3rd 2019, 06:26 Nitrogen explicitly passing a 'format' parameter to validator as a string works around this issue.
# Sep 3rd 2019, 06:24 Nitrogen not sure if expected behavior or inconsistency/bug. please advise.
# Sep 3rd 2019, 06:23 Nitrogen same goes for condition at line 585 earlier.
# Sep 3rd 2019, 06:23 Nitrogen guys, this block isn't executed with unmodified baked model https://api.cakephp.org/3.8/source-class-Cake.Validation.Validation.html#598 which prevents iso8601 datetime value from being validated. reason being $dateFormat is an array by default as can be seen at https://api.cakephp.org/3.8/source-class-Cake.Validation.Validator.html#1669
# Sep 3rd 2019, 04:38 conehead Couldn't you just write `Configure::write('Error.errorLevel', E_ALL and ~E_USER_DEPRECATED)` before executing your tests?
# Sep 3rd 2019, 02:28 admad you don't have to stick with just the folder cake provides by default
# Sep 3rd 2019, 02:26 admad FrostCandy: you can add extra folder you want as per your need. For e.g. extra folder under Model or new "Service" folder under src for service classes
# Sep 3rd 2019, 02:13 FrostCandy I'l use it thanks
# Sep 3rd 2019, 02:13 FrostCandy ok good enough for me, as they don't know cake either, if they ask me why I did it I'll be able to explain controllers don't usually hold that type of code.
# Sep 3rd 2019, 02:12 challgren In the Entity
# Sep 3rd 2019, 02:12 challgren https://book.cakephp.org/3.0/en/orm/entities.html#exposing-virtual-fields
# Sep 3rd 2019, 02:11 challgren You could put that in virtual fields
# Sep 3rd 2019, 02:11 FrostCandy It's just a mathematical equation, but if I was doing this right I'd normally put it in a model. I could put it in a helper I guess. Behavior / Entity / Table all appear to deal with database structure. Maybe I just make a new folder and file under Model. :) It's not very clear so far, but maybe the link you sent will help.
# Sep 3rd 2019, 02:09 challgren @frostCandy its really depends what your BL is. There was a discussion about this last night. You can view it with Slack https://cakesf.herokuapp.com/
# Sep 3rd 2019, 01:52 FrostCandy Just curious in my normal MVC frameworks there is a place to put your model files for business logic. Is that not a thing in CakePHP? I'm not sure where I put my model and how to access it.
# Sep 3rd 2019, 01:11 FrostCandy thanks for the help that should get it done for me
# Sep 3rd 2019, 01:11 cnizzardini gl
# Sep 3rd 2019, 01:11 FrostCandy Woohoo saving a new entity worked.
# Sep 3rd 2019, 01:07 FrostCandy testing new entity, and save / updating now and then i should be finally done.