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

Unset ID if null to avoid Postgres throwing an error. #5814

Closed
wants to merge 1 commit into from

Conversation

bencroker
Copy link
Contributor

This PR unsets the ID of all ActiveRecord classes if null to avoid Postgres throwing an error.

This will eliminate the need to do this manually in various places, including plugins:
https://github.com/craftcms/cms/blob/3.4.10.1/src/services/AssetIndexer.php#L415-L416

@brandonkelly
Copy link
Member

Thanks for the suggestion! Just implemented a similar change for Craft 3.5, but made it a bit more dynamic by looping over static::primaryKey() rather than assuming it's going to be id.

@brandonkelly brandonkelly added this to the 3.5 milestone Mar 19, 2020
@bencroker
Copy link
Contributor Author

Perfect, thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants