Log message #4223178

# At Username Text
# Jan 20th 2020, 19:39 admad definitely
# Jan 20th 2020, 19:30 walid537 Thank you @admad , this solution it’s reliable for a big application?
# Jan 20th 2020, 19:21 admad https://book.cakephp.org/4/en/plugins.html
# Jan 20th 2020, 19:20 admad @walid537 use plugins
# Jan 20th 2020, 18:41 turkles I'm still not clear what you need to do, or why - is there a problem you are trying to solve by changing the structure?
# Jan 20th 2020, 18:36 walid537 It’s not possible to have a internal structure ?
# Jan 20th 2020, 18:35 turkles You don
# Jan 20th 2020, 18:30 walid537 Just edit mvc structure by modules/module_name/mvc
# Jan 20th 2020, 18:30 walid537 To be able to separate my functionality by module without having 42 controllers files in the /controllers path
# Jan 20th 2020, 18:28 turkles What are you trying to achieve?
# Jan 20th 2020, 18:25 walid537 Hello everyone, I’m wondering if we can easy change MVC structure of CakePHP. Example : MVC Becomes -> modules/module_name/MVC ? Thanks for help.
# Jan 20th 2020, 18:12 ricksaccous that's embarrasing
# Jan 20th 2020, 18:12 ricksaccous now I have it working like a charm
# Jan 20th 2020, 18:08 ricksaccous taht was stupid
# Jan 20th 2020, 18:08 ricksaccous i have no idea why "find" didn't find the file though...
# Jan 20th 2020, 18:07 ricksaccous i have to fix that up
# Jan 20th 2020, 18:07 ricksaccous ```'basePath' => APP . 'data',```
# Jan 20th 2020, 18:07 ricksaccous hahahaha
# Jan 20th 2020, 18:07 ricksaccous instead of projectfolder/data
# Jan 20th 2020, 18:07 ricksaccous it's writing the files to "src/data"
# Jan 20th 2020, 18:07 ricksaccous oh crap lol
# Jan 20th 2020, 18:04 ricksaccous def not an exact match though
# Jan 20th 2020, 18:04 ricksaccous I've copied https://github.com/FriendsOfCake/cakephp-upload/blob/master/src/File/Writer/DefaultWriter.php a good amount, lol
# Jan 20th 2020, 18:02 slackebot <ricksaccous>
# Jan 20th 2020, 17:59 ricksaccous and when i try to do a find / filename ubuntu doesn't find anything
# Jan 20th 2020, 17:59 ricksaccous i don't know what the heck is going on because when i do ```debug($filesystem->listContents('/Administrators/Profiles/'));``` I'm getting all the "files" that I had uploaded before but checking the actual directory i dont' see anything
# Jan 20th 2020, 17:58 ricksaccous and when i want to create a file I'm using a path like /$dir1/$dir2/filename
# Jan 20th 2020, 17:57 ricksaccous new Local($basePath);
# Jan 20th 2020, 17:57 ricksaccous when i instantiate
# Jan 20th 2020, 17:57 ricksaccous so I'm setting the local path to my project/data folder
# Jan 20th 2020, 17:56 ndm @turkles I'm not sure that I can follow... but if you need to add indexes on query level, that's certainly possible, using for example a result formatter, something like: ```$query->formatResults(function (\Cake\Collection\CollectionInterface $results) { return $results->map(function ($row) { $row['roles'] = collection($row['roles']) ->indexBy('id') ->toArray(); return $row; }); });```
# Jan 20th 2020, 17:51 ricksaccous @neon1024 using local
# Jan 20th 2020, 17:38 turkles well atm I have checkboxes, with the checked state depending on current list, but when I submit it I want to remove and re-add where needed. Problem is I am paginating the list as there are too many, so I only want to remove/add items as required, which I can't do without some complex processing
# Jan 20th 2020, 17:33 ndm `$hasRole = collection($user->roles)->firstMatch(['id' => $roleId]) !== null;`
# Jan 20th 2020, 17:33 ndm If you just need it for a single check somewhere, then maybe just convert it to a collection and match it
# Jan 20th 2020, 17:27 turkles I have a bunch of user roles my users can opt into, and finding it hard to check if they already have it as its User.Roles[0], User.Roles[1] etc, would be much easier if the index was role_id
# Jan 20th 2020, 17:23 turkles Is it possible to index contains by a field/key?
# Jan 20th 2020, 17:16 ndm `execute()` is a method of the inherited, "lower level" database query class, which has no ORM features like containments
# Jan 20th 2020, 17:13 ndm @kiwi_72 Under the hood `get()` uses `find()` too. In your example you are using `execute()`, not sure if that's in your actual code, or just for the example, but that won't include containments, as it will only execute the SQL that this query object creates, not the ones created by the eager loadables (containments). Use `all()`, `toArray()`, one of the collection methos, or iterate the query object instead.
# Jan 20th 2020, 17:06 kiwi_72 using get() works with the hasMany() association. something with find behaves differently than I expected it to be. @btx, @ndm thank you both for your pointers!
# Jan 20th 2020, 16:55 neon1024 https://flysystem.thephpleague.com/v1/docs/adapter/local/