# |
Dec 1st 2017, 21:22 |
obinoob |
phantomwatson the first time it will save empty but the second the "NULL" value is duplicated in DB and by then it will throw a SQL exception at uniqueness constraint |
# |
Dec 1st 2017, 21:19 |
obinoob |
phantomwatson INSERT INTO `phones` (`number`, `client_id`, `created`) VALUES (NULL, 44, '2017-12-01 20:38:05') |
# |
Dec 1st 2017, 21:19 |
phantomwatson |
In the `PhonesTable` class, try adding `$validator->notEmpty('number');` to `validationDefault()` and removing `allowEmpty('number')` if it's there. |
# |
Dec 1st 2017, 21:18 |
obinoob |
phantomwatson entity is saving empty phone... |
# |
Dec 1st 2017, 21:15 |
phantomwatson |
What is the error that you're trying to correct? |
# |
Dec 1st 2017, 21:14 |
obinoob |
next when I enter a second client with one phone number (a second empty) it fails due to UNIQUE constraint obviously I'm not allowing duplications in database... |
# |
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 |