Log message #4201245

# At Username Text
# Sep 3rd 2019, 10:35 conehead Ah, I can just set the Helper, even for a integration test?
# Sep 3rd 2019, 10:32 neon1024 Although helpers may take a View instance as contructor param, so you might need `->setConstructorArgs()`
# Sep 3rd 2019, 10:32 neon1024 If you’re using PHP Unit that is
# Sep 3rd 2019, 10:31 neon1024 Sure I tend to use `$helper = $this->getMockBuilder(\App\View\MyHelper::class)->getMock();`
# Sep 3rd 2019, 10:24 conehead hm anyone know how/if it is possible to Mock Helpers for testing?
# Sep 3rd 2019, 10:13 neon1024 The entity should have `isNew()`
# Sep 3rd 2019, 10:13 val How to check whether a new record was created or the existing update in Table::afterSave() in 3.x?
# Sep 3rd 2019, 10:10 neon1024 Not sure why it doesn’t check it’s an array first :man-shrugging:
# Sep 3rd 2019, 10:10 neon1024 https://github.com/riesenia/cakephp-duplicatable/blob/master/src/Model/Behavior/DuplicatableBehavior.php#L267
# Sep 3rd 2019, 10:10 neon1024 > Warning (2): Invalid argument supplied for foreach() [ROOT/vendor/riesenia/cakephp-duplicatable/src/Model/Behavior/DuplicatableBehavior.php, line 268]
# Sep 3rd 2019, 10:10 neon1024 Anyone seen this one before?
# Sep 3rd 2019, 10:01 Nitrogen here it is https://pastebin.com/ukPVF4Q1
# Sep 3rd 2019, 09:58 Nitrogen have anyone seen my validation-related question from earlier today? we might have a problem there.
# Sep 3rd 2019, 09:57 spriz COOurb I am not using that functionality myself so I cannot help you then :slightly_smiling_face:
# Sep 3rd 2019, 09:57 COOurb after adding 'dir' field in settings
# Sep 3rd 2019, 09:56 COOurb files still cannot be deleted
# Sep 3rd 2019, 09:56 COOurb spriz
# Sep 3rd 2019, 09:55 COOurb still
# Sep 3rd 2019, 09:40 COOurb but file still in directory
# Sep 3rd 2019, 09:40 COOurb oh, ok, I had to put in "fieldname" settings group
# Sep 3rd 2019, 09:40 dereuromark Good news for the IDE people: View template variable collecting is now in master - if someone wants to test the new IdeHelper functionality.
# Sep 3rd 2019, 09:39 COOurb already, but nvalid data type, must be an array or \ArrayAccess instance.
# Sep 3rd 2019, 09:38 spriz try setting `'keepFilesOnDelete'` => false`
# Sep 3rd 2019, 09:38 spriz Hint: You need to let it not go into this `if()` https://github.com/FriendsOfCake/cakephp-upload/blob/master/src/Model/Behavior/UploadBehavior.php#L133
# Sep 3rd 2019, 09:36 COOurb I don't have special field for 'dir'
# Sep 3rd 2019, 09:36 spriz Nope, only if you set the right configs :slightly_smiling_face: See the code in the behavior and it will make sense
# Sep 3rd 2019, 09:36 COOurb spriz, files are not deleted after deleting entity
# Sep 3rd 2019, 09:30 neon1024 Yep :slightly_smiling_face:
# Sep 3rd 2019, 09:30 martin @neon1024 oh did fiend the problem, he was building the fields wrong in javascript, did name with dots, like example.0.id but it eneds to be example[0][id] :slightly_smiling_face:
# Sep 3rd 2019, 09:00 neon1024 When manually building an entity with a join, can I just make an empty join entity and assign to the prop?
# Sep 3rd 2019, 08:55 spriz I do not remember tbh :slightly_smiling_face: try to throw in a `debug()` or use xdebug debugger :)
# Sep 3rd 2019, 08:55 COOurb What we have in $data in nameCallback?
# Sep 3rd 2019, 08:55 spriz Sp? :)
# Sep 3rd 2019, 08:55 COOurb spriz
# Sep 3rd 2019, 08:54 javier.villanueva thanks @neon1024
# Sep 3rd 2019, 08:50 martin but the fields are generated by javascript so it needs to get unlocked
# Sep 3rd 2019, 08:48 martin @neon1024 hmm no it saves more information to database, with a hasandbelongstomany you use a _ids field I believe
# Sep 3rd 2019, 08:47 COOurb @spriz
# Sep 3rd 2019, 08:47 val How can I create custom validation rules in 3.x? The cookbook explains the way for the RuleChecker but not for Validator - https://book.cakephp.org/3.0/en/orm/validation.html#creating-custom-re-usable-rules
# Sep 3rd 2019, 08:47 slackebot LIKE' => '%' . $data[self::SEARCH_USER] . '%', 'Users.first_name IN ' => $keywords, 'Users.last_name IN ' => $keywords, 'Users.username IN ' => $data[self::SEARCH_USER], ], ] ); return $query; } return $query; ``` So how can I avoid that AND after first CONCAT ?
# Sep 3rd 2019, 08:47 slackebot ] ); if (!$query->isEmpty()) { return $query; } else { $keywords = explode(" ", $data[self::SEARCH_USER]); $query->where( [ 'OR' => [ 'AND' => [ 'CONCAT(first_name, last_name) LIKE' => '%' . str_replace( ' ', '', $data[self::SEARCH_USER] ) . '%', ], 'CONCAT(first_name, last_name)