Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDOException: SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: #169

Open
strtob opened this issue May 2, 2021 · 2 comments

Comments

@strtob
Copy link

strtob commented May 2, 2021

Hi folks,

I have the tables with has many relations:

  • company
  • company_has_role
  • company_role

I've used gii enhanced to generate tables and gui with softdelete, time and userstamp.

Now, I've started to develop the update in modal view and update with ajax call.

I've dumped the model before saveAll() in the controller, model seems to be loaded correctly, but I get the following error:

Next yii\db\Exception: SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: '' The SQL being executed was: UPDATE tbl_company_has_roleSETdeleted_by=1, deleted_at='2021-05-02 02:27:56' WHERE (tbl_company_id='1') AND (id<>'') in /vendor/yiisoft/yii2/db/Schema.php:678

If I submit the ajax button without new hasmanyentries (just the master table company), the system save the data in the correct form. When I add data into the has many forms, I've got an error which pointed at vendor/mootensai/yii2-relation-trait/RelationTrait.php(228): yii\db\ActiveRecord::updateAll()

I have no idea how to fix?

Thanks in advance!
Toby

@strtob
Copy link
Author

strtob commented May 2, 2021

...this seems not caused by the modal function.

Also pure generated IO Model and IO Crud forms with gii enhanced without any changes produce the same error?

@strtob
Copy link
Author

strtob commented May 2, 2021

I have a try with a clean generate IO Model and Crud for my person table, the has many table is company_has_person, with the same result.

All key are send in the request for the new entry by pushing the "Add" and finally update button:

Selection_007

If the strcit modus is disabled like this SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION'

The page reload without any sql exception, but the validation in the reloaded form says

`Please fix the following errors:

Company Has Person #1 : ID cannot be blank.`

Why does the saveAll() not generate an new id for the new entry in the has many table?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant