Log message #4201223

# At Username Text
# 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)
# Sep 3rd 2019, 08:47 slackebot $keywords, 'Users.last_name IN ' => $keywords, ] ) ->orWhere( [ 'Users.username IN ' => $data[self::SEARCH_USER], ] ); return $query; } return $query; ``` My try with new solution look like, ``` $query->where( [ 'OR' => [ 'Users.first_name' => $data[self::SEARCH_USER], 'Users.last_name' => $data[self::SEARCH_USER], ]
# Sep 3rd 2019, 08:47 slackebot $data[self::SEARCH_USER]); $query->where( [ 'CONCAT(first_name, last_name) LIKE' => '%' . str_replace( ' ', '', $data[self::SEARCH_USER] ) . '%', ] ) ->orWhere( [ 'CONCAT(first_name, last_name) LIKE' => '%' . $data[self::SEARCH_USER] . '%', ] ) ->orWhere( [ 'Users.first_name IN ' =>
# Sep 3rd 2019, 08:47 slackebot Users.first_name in (:c6) OR Users.last_name in (:c7) OR Users.username in (:c8) ) ORDER BY Users.id; And Deprecated solution look like ``` $query->where( [ 'Users.first_name' => $data[self::SEARCH_USER], ] ) ->orWhere( [ 'Users.last_name' => $data[self::SEARCH_USER], ] ); if (!$query->isEmpty()) { return $query; } else { $keywords = explode(" ",
# Sep 3rd 2019, 08:47 johnwayne Hi I Have problem with Query builder. I can not achieve to get OR after AND using ->where() method (Nesting). This is original SQL (Goal) SELECT * FROM users Users INNER JOIN groups Groups ON Groups.id = (Users.group_id) WHERE ( ( Users.active = :c0 AND Users.deleted = :c1 AND (Users.first_name = :c2 OR Users.last_name = :c3) AND CONCAT(first_name, last_name) like :c4 ) OR CONCAT(first_name, last_name) like :c5 OR
# Sep 3rd 2019, 08:46 martin hmm good point i believe it is a hasmany but the html is are fields like example.0.channel_id :slightly_smiling_face:
# Sep 3rd 2019, 08:40 neon1024 Wouldn’t a hasMany be `._ids` ?
# Sep 3rd 2019, 08:39 martin how do I unlock fields of an hasmany relationship? I tried $this->Form->unlockField(‘channel_players.channel_id’); and $this->Form->unlockField(‘channel_players[]’); but both does not work
# Sep 3rd 2019, 08:38 neon1024 @javier.villanueva I would recommend creating your own Authorize class
# Sep 3rd 2019, 08:30 challgren Np
# Sep 3rd 2019, 08:30 javier.villanueva Thanks I will check it
# Sep 3rd 2019, 08:29 challgren CakeDC/Users
# Sep 3rd 2019, 08:29 javier.villanueva I need an auth system with two layers: multi role and depend of a work group. Example: user1 has role1 and role2 in workgroup1, and has role3 in workgroup2. Do you recommend starting with some plugin or component? or start from scratch?
# Sep 3rd 2019, 08:24 spriz :+1:
# Sep 3rd 2019, 08:24 COOurb Let me finish this first.
# Sep 3rd 2019, 08:24 spriz would you need anything else?
# Sep 3rd 2019, 08:24 COOurb I see
# Sep 3rd 2019, 08:23 spriz I see it only has `beforeMarshal`, `beforeSave` and `afterDelete` hooks in the `Behavior` :slightly_smiling_face:
# Sep 3rd 2019, 08:22 COOurb So this plugin "start his actions" only when creating new/editing?
# Sep 3rd 2019, 08:20 spriz with: ``` if ($entity->getOriginal('file') !== null andand is_array($entity->getOriginal('file'))) { //There is a new file! if (isset($entity->getOriginal('file')['name'])) { $entity->original_file_name = $entity->getOriginal('file')['name']; } ``` You can set the `original_file_name` if you want to be able to set that when users download the file anyway :slightly_smiling_face:
# Sep 3rd 2019, 08:19 COOurb well, sure, I got it
# Sep 3rd 2019, 08:19 spriz this will have that filename saved in `file` column :slightly_smiling_face:
# Sep 3rd 2019, 08:18 COOurb ok thnx, think it's better then writing your own implementation of writer