# |
Jan 20th 2020, 21:59 |
mark.mikkelson |
I'll give it another bash just incase, thanks. |
# |
Jan 20th 2020, 21:59 |
mark.mikkelson |
thanks, although the docs only show sorting each association at a time and not as union from what I tested. |
# |
Jan 20th 2020, 21:57 |
challgren |
https://book.cakephp.org/3/en/orm/query-builder.html#sorting-contained-associations |
# |
Jan 20th 2020, 21:55 |
challgren |
`$this->Deals->find('all')->contain(['Tasks' => ['order' => 'created'], 'Calls' => ['order' => 'created'], 'Tickets' => ['order' => 'created'], 'Chats' => ['order' => 'created']])->where(['id'=>$id])->first();` would probably work |
# |
Jan 20th 2020, 21:52 |
mark.mikkelson |
Hey all, is there a way (cake3.8) to sort by a column across multiple tables. eg. I have something like this: $this->Deals->find('all')->contain(['Tasks', 'Calls', 'Tickets', 'Chats'])->where(['id'=>$id])->first(); Chats, Tickets, Calls and Tasks all have a created(datetime) column. I want to sort the results by created date across all those tables, but can't seem to find any docs on doing this? |
# |
Jan 20th 2020, 20:44 |
challgren |
https://book.cakephp.org/authorization/2/en/component.html#skipping-authorization |
# |
Jan 20th 2020, 20:43 |
luizcmarin |
I can't find the corresponding $ this-> Auth-> allow for cake 4. would it be $ this-> Authentication -> ....? Would anyone know? |
# |
Jan 20th 2020, 19:47 |
walid537 |
Ok thank you for your helping @admad :) |
# |
Jan 20th 2020, 19:39 |
admad |
plugin's are the official way to organize your app's MVC into modules |
# |
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 |