# |
Sep 20th 2019, 14:31 |
daniel.upshaw |
It looks like dereuromark, markstory, and admad have done some stuff with SecurityComponent.php recently |
# |
Sep 20th 2019, 14:31 |
ricksaccous |
or is status just a string |
# |
Sep 20th 2019, 14:31 |
ricksaccous |
@jotpe are you setting the status id or the status entity? |
# |
Sep 20th 2019, 14:30 |
jotpe |
is beforeRules not the right way? |
# |
Sep 20th 2019, 14:30 |
jotpe |
I want to set the status by default for new entities. Why does the validation fail? |
# |
Sep 20th 2019, 14:30 |
jotpe |
When I create a new Entity i get a validation error, saying the status is not set. |
# |
Sep 20th 2019, 14:29 |
slackebot |
<jotpe> |
# |
Sep 20th 2019, 14:27 |
neon1024 |
Why do params default to false and queries to null? |
# |
Sep 20th 2019, 14:27 |
neon1024 |
`public function getParam($name, $default = false)` |
# |
Sep 20th 2019, 14:27 |
neon1024 |
`public function getQuery($name = null, $default = null)` |
# |
Sep 20th 2019, 14:27 |
neon1024 |
Why is this? |
# |
Sep 20th 2019, 14:22 |
spriz |
and I was WTF when doing a review of it |
# |
Sep 20th 2019, 14:22 |
spriz |
that's what it does now |
# |
Sep 20th 2019, 14:22 |
neon1024 |
Then you can have an implicit controller method to update the entity |
# |
Sep 20th 2019, 14:21 |
spriz |
yeah exactly |
# |
Sep 20th 2019, 14:21 |
neon1024 |
Maybe have the postlink to go to a new method? |
# |
Sep 20th 2019, 14:20 |
spriz |
Oh welp, I'll hack it for now :shrug: |
# |
Sep 20th 2019, 14:20 |
spriz |
but getting there with an `''` could mean lots of things |
# |
Sep 20th 2019, 14:20 |
spriz |
so all it does is post with `'image' => ''` |
# |
Sep 20th 2019, 14:20 |
spriz |
we have a postLink in our case to delete the image, |
# |
Sep 20th 2019, 14:19 |
neon1024 |
An extra checkbox feels like an approach which confirms the users intention |
# |
Sep 20th 2019, 14:19 |
spriz |
Exactly |
# |
Sep 20th 2019, 14:19 |
neon1024 |
Indeed, as empty might mean “I don’t want to change this” instead of “Delete this property” |
# |
Sep 20th 2019, 14:19 |
spriz |
Yeah, I'm just not too sure what the best approach would be |
# |
Sep 20th 2019, 14:19 |
neon1024 |
Perhaps it’s worth a PR, it does feel like a missing feature |
# |
Sep 20th 2019, 14:18 |
spriz |
yeah, it is for our other usage |
# |
Sep 20th 2019, 14:18 |
neon1024 |
https://github.com/FriendsOfCake/cakephp-upload/blob/master/src/Model/Behavior/UploadBehavior.php#L121 |
# |
Sep 20th 2019, 14:18 |
neon1024 |
Well it does but it assumes that the file is an association |
# |
Sep 20th 2019, 14:17 |
spriz |
yeah but it feels like it was not intended just to delete whatever the plugin put there in first case :) |
# |
Sep 20th 2019, 14:17 |
neon1024 |
Creating a Writer class is an intended customization path with the plugin though |
# |
Sep 20th 2019, 14:17 |
neon1024 |
You might be, I’m not an expert with the plugin having written my own :slightly_smiling_face: |
# |
Sep 20th 2019, 14:16 |
spriz |
I hoped I was missing something obvious :shrug: |
# |
Sep 20th 2019, 14:16 |
spriz |
Yeah, I just feel like this should be easily doable without weird hacks :) |
# |
Sep 20th 2019, 14:16 |
neon1024 |
Perhaps implement your own Writer class which copes with this use-case? |
# |
Sep 20th 2019, 14:15 |
neon1024 |
Maybe ask @savant |
# |
Sep 20th 2019, 14:15 |
spriz |
I could put `0` and make `if (empty($user->image)) { $user->image = null; }` |
# |
Sep 20th 2019, 14:15 |
neon1024 |
So in `beforeMarshal` you could fix the request data |
# |
Sep 20th 2019, 14:15 |
spriz |
I guess so ,:) |
# |
Sep 20th 2019, 14:15 |
neon1024 |
So if you passed a null upload array with `UPLOAD_ERR_OK` set as the error you’d pass the condtion? |
# |
Sep 20th 2019, 14:15 |
neon1024 |
`!== UPLOAD_ERR_OK` |
# |
Sep 20th 2019, 14:14 |
spriz |
but feels bad not just to use the existing `edit($id)` |