# |
Jul 2nd 2018, 10:08 |
tunafish |
True, true |
# |
Jul 2nd 2018, 10:08 |
josbeir |
best to make specific methods for the secure stuff and use those |
# |
Jul 2nd 2018, 10:07 |
josbeir |
i get what you are trying to achieve @tunafish but if you are going to define that stuff in a too explicit way it will eventually work against you in the long run |
# |
Jul 2nd 2018, 10:06 |
slackebot4 |
! |
# |
Jul 2nd 2018, 10:06 |
slackebot4 |
Command sent from Slack by josbeir: |
# |
Jul 2nd 2018, 10:06 |
tunafish |
Best. Method. Ever. :P |
# |
Jul 2nd 2018, 10:06 |
josbeir |
saveMethod => 'safeSave' :P |
# |
Jul 2nd 2018, 10:06 |
josbeir |
if you use crud you can easily change the save method of the actions you are using |
# |
Jul 2nd 2018, 10:05 |
tunafish |
I'm guessing plugins like CRUD won't use those, unless you mean overwriting the normal patchEntity? |
# |
Jul 2nd 2018, 10:04 |
josbeir |
@tunafish why not make a patchEntity method specifically for your api/front end stuff and always use that method when patching your entity |
# |
Jul 2nd 2018, 10:03 |
saeideng |
overflow |
# |
Jul 2nd 2018, 10:03 |
dereuromark |
https://github.com/cakephp/cakephp/pull/12315#issuecomment-401745356 |
# |
Jul 2nd 2018, 10:03 |
josbeir |
thefuck :) |
# |
Jul 2nd 2018, 10:02 |
dereuromark |
Big fan of CLI exit code `-1073741819`..^^ |
# |
Jul 2nd 2018, 10:00 |
tunafish |
Pretty sure someone in the team is going to forget that sometime, which should trigger some kind of fallback |
# |
Jul 2nd 2018, 09:59 |
tunafish |
Stuff like fieldlist works, but you have to remember it when creating an entity |
# |
Jul 2nd 2018, 09:59 |
tunafish |
I'm looking for something which ultimately prevents empty columns written to the database |
# |
Jul 2nd 2018, 09:58 |
tunafish |
beforeMarshal might work |
# |
Jul 2nd 2018, 09:53 |
josbeir |
=> https://book.cakephp.org/3.0/en/orm/saving-data.html#avoiding-property-mass-assignment-attacks |
# |
Jul 2nd 2018, 09:53 |
josbeir |
or @tunafish you could use 'fieldList' argument when patching your entity |
# |
Jul 2nd 2018, 09:50 |
josbeir |
why not add some beforeValidate or beforeMarshal and throw an exception of someone tries to validate such field? |
# |
Jul 2nd 2018, 09:47 |
tunafish |
but isAccessible() would work as well |
# |
Jul 2nd 2018, 09:47 |
tunafish |
I was just wondering if there is a built-in way to check if attempts are made to set any of those properties |
# |
Jul 2nd 2018, 09:46 |
tunafish |
Yeah, I thought its supposed to behave that way |
# |
Jul 2nd 2018, 09:42 |
josbeir |
you can run isAccessible('property') or something and throw an exception |
# |
Jul 2nd 2018, 09:39 |
josbeir |
so its normal behavior |
# |
Jul 2nd 2018, 09:39 |
josbeir |
validation is run before 'marshalling' on input data |
# |
Jul 2nd 2018, 09:27 |
tunafish |
Is there some way to tell 'He you, you're trying to set an inaccessible property, bugger off'? |
# |
Jul 2nd 2018, 09:26 |
tunafish |
but what if I forget to put it somewhere? The record is still created as if nothing happened, but without a proper value for foo |
# |
Jul 2nd 2018, 09:25 |
tunafish |
Obviously I can just use $table->newEntity($data, ['accessibleFields' => ['foo' => true]) |
# |
Jul 2nd 2018, 09:25 |
tunafish |
I'd expect an error in the entity, but it behaves as if the validation is run before the data is actually set to the entity |
# |
Jul 2nd 2018, 09:24 |
tunafish |
Hey everyone, I'm messing around a bit with the $_accessible property in entities, when I found that you can get invalid data in the database when a property is required in the validation, but not accessible |
# |
Jul 2nd 2018, 08:22 |
josbeir |
$session = $this->request->getSession(); |
# |
Jul 2nd 2018, 08:19 |
maymeow |
Hi how can i read session from helper? |
# |
Jul 2nd 2018, 06:28 |
mohitprakashsharma555 |
why i am getting this error |
# |
Jul 2nd 2018, 06:28 |
mohitprakashsharma555 |
geting `An invalid form control with name='co_parent_professional_role' is not focusable.` |
# |
Jul 2nd 2018, 06:18 |
chhengseilang |
Hi, everyone. I |
# |
Jul 2nd 2018, 04:11 |
itamer |
I'm using cake3, in my appview class I load the time helper, when I'm viewing the site and look at the includes for the view I can see the other helpers but not time. How do I debug this? |
# |
Jul 1st 2018, 21:02 |
marceltbr |
problem solved, forgot to pass the enum 'values' as an array: ```->addColumn('role', 'enum', ['values' => ['admin', 'user'] ]) |
# |
Jul 1st 2018, 19:27 |
kitcat711_ |
that's silly but sometimes I loose hours on that |
# |
Jul 1st 2018, 19:26 |
kitcat711_ |
did u try to rm you tmp directory |