# |
Jul 2nd 2018, 10:36 |
cielo2 |
how can i solve this ? |
# |
Jul 2nd 2018, 10:35 |
cielo2 |
i migrate from php5.6 to php7.2 and a classical row goes on error: "$this->set('books', $this->paginate($query, ['limit' => 10]));" |
# |
Jul 2nd 2018, 10:34 |
saeideng |
php 7.2 |
# |
Jul 2nd 2018, 10:33 |
saeideng |
first use `->toList()` before using `count()` |
# |
Jul 2nd 2018, 10:27 |
lorenzo |
when doing what? |
# |
Jul 2nd 2018, 10:20 |
cielo2 |
somebody has a solution for: cakephp3 Parameter must be an array or an object that implements Countable ? |
# |
Jul 2nd 2018, 10:19 |
cielo2 |
hi all |
# |
Jul 2nd 2018, 10:10 |
tunafish |
I'll discuss things with my team when we get to it. Thanks for the help! |
# |
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(); |