Log message #4100308

# At Username Text
# Dec 1st 2017, 21:12 obinoob phantomwatson yes I can, I have and entity with multiple association ex: client hasMany phones! in form I have two inputs for phone numbers (phones.0.number and phones.1.number) so if only enter one phone number the second goes empty. with client FK id and PK id as well...
# Dec 1st 2017, 21:07 phantomwatson *Question for the rest of the channel:* can anyone recommend a way to change a component configuration value from inside an integration test? (I'm trying to turn off reCAPTCHA response checking in a test.)
# Dec 1st 2017, 21:05 phantomwatson You need a validation rule that invalidates entities if they're missing a foreign key for an association?
# Dec 1st 2017, 21:05 phantomwatson Could you be more specific in your question? I don't understand.
# Dec 1st 2017, 21:04 obinoob anyone willing to help?
# Dec 1st 2017, 20:26 obinoob how can I avoid entity from saving association if empty allowed and no value is passed?
# Dec 1st 2017, 19:56 obinoob h.mavisakalian I would start by checking the XHR request under Network -> Chrome (or oder) so you can take a closer look at "Form Data" then obviously debug($this->request->data())... in controller action
# Dec 1st 2017, 19:48 h.mavisakalian I am fetching data from a JSON url
# Dec 1st 2017, 19:48 h.mavisakalian ?
# Dec 1st 2017, 19:48 h.mavisakalian Any ideas
# Dec 1st 2017, 19:48 h.mavisakalian “General error: 1366 Incorrect string value: ”
# Dec 1st 2017, 19:48 h.mavisakalian I get an error while saving data to database
# Dec 1st 2017, 19:47 h.mavisakalian Hey Guys
# Dec 1st 2017, 19:43 obinoob I need to know if I can stop it to save the empty field?
# Dec 1st 2017, 19:41 obinoob the second "deep" association level !
# Dec 1st 2017, 19:41 obinoob I have field with validation rules that go through the following filters: ->email ->allowEmpty and ->add with options to be unique in table etc... however if empty it still gets stored and next time it will stop at unique condition... do not know if it is related with the fact that I'm using a entity with associations where emails happen to be in
# Dec 1st 2017, 18:51 dereuromark keep it simple at the beginning, you can always easily refactor in the future.
# Dec 1st 2017, 18:49 slackebot2 that would work too. Thanks
# Dec 1st 2017, 18:49 randompherret I have a small app that is recording some data in 3 tables. I need to generate a report I know I can just add an action to an existing controller but I want to make sure I would do it the same way as I would in a bigger app in case this grows. Is it recommended to just add it to whatever controller would fit the best, to the pages controller, or make a new one? I'm not finding anything useful on google so if someone has a link to read
# Dec 1st 2017, 17:04 meder hmm, no but i'll double check
# Dec 1st 2017, 17:04 meder it's a fk
# Dec 1st 2017, 17:03 hmic is that leader_id used in any association in the table? - even ones you dont provide/save?
# Dec 1st 2017, 17:03 phantomwatson In that case, I think it defaults to making all fields accessible. So that's not it.
# Dec 1st 2017, 17:02 meder every other field works fine though
# Dec 1st 2017, 17:02 meder no $_accessible defined
# Dec 1st 2017, 17:02 meder i didn't bake anything - there's just one getter function there
# Dec 1st 2017, 17:01 phantomwatson If you baked all of that and didn't add `leader_id` after baking, then the line `'leader_id' => true` should be in there somewhere.
# Dec 1st 2017, 17:01 phantomwatson Open up `/src/Model/Entity/Order.php` and look for a property called `$_accessible`.
# Dec 1st 2017, 17:00 meder where would i see that?
# Dec 1st 2017, 16:59 phantomwatson Hm. `leader_id` is listed in `Order::_accessible`, right?
# Dec 1st 2017, 16:57 meder for new records, it does newEntity and patch with request->data()
# Dec 1st 2017, 16:57 meder wait. i think it patchEntity's regardless
# Dec 1st 2017, 16:56 meder err, newEntity*
# Dec 1st 2017, 16:56 meder phantomwatson: my entity is 'order' and the field is 'leader_id'. the field exists when i debug($orderEntity); right after ->errors() check, which is after patchEntity
# Dec 1st 2017, 16:55 meder no buildRules, no existsIn
# Dec 1st 2017, 16:55 hmic in the table, method name buildRules()
# Dec 1st 2017, 16:55 phantomwatson Ohhh, I get it. Was `leader_id` recently created? You may need to delete the model cache in /tmp/cache/models for Cake to recognize it.
# Dec 1st 2017, 16:55 hmic do you have any rules in the table? - like e.g. existsIn?
# Dec 1st 2017, 16:54 meder really? rules? hm
# Dec 1st 2017, 16:54 hmic can still be rules
# Dec 1st 2017, 16:54 hmic it's not validation if it's in the entity