Log message #4154940

# At Username Text
# 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
# Jul 1st 2018, 19:26 kitcat711_ I am totally usefull I guess
# Jul 1st 2018, 19:26 kitcat711_ ah ok, I am sorry, but I newer used the test class
# Jul 1st 2018, 19:18 birdy247 Ah, they are all in one test class
# Jul 1st 2018, 19:10 birdy247 Im unsure of the best way to debug this
# Jul 1st 2018, 19:08 birdy247 5 tests that pass when I run locally, fail when I push to my repo and the pipeline runs
# Jul 1st 2018, 19:08 birdy247 Hey kitcat711
# Jul 1st 2018, 18:56 kitcat711_ birdy247 : can you give more info?
# Jul 1st 2018, 17:29 birdy247 any ideas?
# Jul 1st 2018, 17:29 birdy247 My tests pass on local, but some fail on prod
# Jul 1st 2018, 16:22 marceltbr Yes, I deleted the line which used 'enum' column type and the addIndex line and migration went fine... thanks for the quick answer, will dig deeper into documentation :slightly_smiling_face:
# Jul 1st 2018, 16:18 chris-andre >>> In addition, the MySQL adapter supports enum, set, blob and json column types. (json in MySQL 5.7 and above)
# Jul 1st 2018, 16:16 chris-andre @marceltbr Hard to tell what triggers the error from what you have told and posted. To use enum column type, I think you will need to use an adapter.
# Jul 1st 2018, 16:11 slackebot4 ->addIndex('username', ['unique' => true]) ->create(); }```
# Jul 1st 2018, 16:11 marceltbr ```public function change() { $table = $this->table('users'); $table-> addColumn('first_name', 'string', ['limit' => 100]) ->addColumn('email', 'string', ['limit' => 100]) ->addColumn('password', 'string') ->addColumn('role', 'enum', ['values' => 'admin', 'user']) ->addColumn('active', 'boolean') ->addColumn('created', 'datetime')
# Jul 1st 2018, 16:11 slackebot4 ->addColumn('created', 'datetime') ->addIndex('username', ['unique' => true]) ->create(); }``