Log message #4201204

# At Username Text
# 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
# Sep 3rd 2019, 08:18 spriz with ```
# Sep 3rd 2019, 08:17 spriz you got ze `nameCallback`
# Sep 3rd 2019, 08:17 spriz @COOurb ``` 'file' => [ 'path' => 'uploads{DS}{model}{DS}{field}{DS}', 'nameCallback' => function (array $data, array $settings) { return Text::uuid(); }, 'filesystem' => [ 'adapter' => 'foo', ], ], ```
# Sep 3rd 2019, 08:15 neon1024 So probably implement your own Writer
# Sep 3rd 2019, 08:15 neon1024 > Default: (string) ‘webroot{DS}files{DS}{model}{DS}{field}{DS}’
# Sep 3rd 2019, 08:15 neon1024 It does ship with a default Writer class though
# Sep 3rd 2019, 08:14 neon1024 For my upload plugin I used a UUID
# Sep 3rd 2019, 08:13 COOurb So I can store file name in different field while actually have random named file in file system
# Sep 3rd 2019, 08:13 COOurb is there some {random} token?
# Sep 3rd 2019, 08:12 COOurb I'm using 'cakephp-upload' plugin and I want to store files with same names. What should I do? {primaryKey} isn't available before saving entity
# Sep 3rd 2019, 08:03 neon1024 Morning all :wave:
# 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], ] ); ```