# |
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/ |
# |
Jan 20th 2020, 16:54 |
neon1024 |
Are you using a local file system or a remote one? |
# |
Jan 20th 2020, 16:54 |
neon1024 |
The documentation for the Flysystem library says you set a path when you setup the adapter |
# |
Jan 20th 2020, 16:51 |
ricksaccous |
nothing makes sense here |
# |
Jan 20th 2020, 16:51 |
ricksaccous |
but not where |
# |
Jan 20th 2020, 16:51 |
ricksaccous |
I know they are somewhere |
# |
Jan 20th 2020, 16:50 |
ricksaccous |
I don't know where the hell my files are being put |
# |
Jan 20th 2020, 16:50 |
ricksaccous |
I'm running into a really stupid problem with flysystem |
# |
Jan 20th 2020, 16:26 |
kiwi_72 |
ok i see |
# |
Jan 20th 2020, 16:25 |
ndm |
It happens automatically under the hood, nothing you'd need to worry about |
# |
Jan 20th 2020, 16:25 |
kiwi_72 |
or you mean what is happening in tunder the hood of cakephp? |
# |
Jan 20th 2020, 16:25 |
kiwi_72 |
nothing I can find about additinal queries |
# |
Jan 20th 2020, 16:24 |
kiwi_72 |
in the examples on https://book.cakephp.org/3/en/orm/retrieving-data-and-resultsets.html#retrieving-associated-data there is one find with contains, witch returns all the associated data |
# |
Jan 20th 2020, 16:24 |
ndm |
what procedure? |
# |
Jan 20th 2020, 16:24 |
kiwi_72 |
ndm: could you please elaborate on the procedure? |
# |
Jan 20th 2020, 16:22 |
ndm |
`hasMany` and `belongsToMany` associations are generally being retrieved in separate/additional queries |
# |
Jan 20th 2020, 16:20 |
kiwi_72 |
btx: i've got the query statements form the query object. and it is missing the association as soon as the table association is hasMany. (and vardumping the result is just accoring to this, it doesn't contain anything about the second table) |