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

Fix onDeleteRows for php 7 #2063

Closed
wants to merge 2 commits into from
Closed

Conversation

bauer-git
Copy link

This was failing under php v.7. I hope the fix (adding {} brackets around variable used as object name) doe not break code for php less that v.7.
There is no need to run query if databasejoin element is empty (nothing selected) - was returning WHERE id IN("")
Just delete based on parent_id (__pk_val) instead of building array of selected values

This was failing under php v.7. I hope the fix (adding {} brackets around variable used as object name) doe not break code for php less that v.7. 
There is no need to run query if databasejoin element is empty (nothing selected) - was returning WHERE id IN("")
Just delete based on parent_id (__pk_val) instead of building array of selected values
@cheesegrits
Copy link
Member

Have you tested this with deleting more than one row?

Seems like you'd need to create an array of pkvals from the selected rows, and delete IN($pkvals).

This works for multiple deletes.
This function gets called for every databasejoin element in the deleted row(s). It simply gets the PK value(s) of each deleted row and then deletes all records in that table_repeat_element table that has the PK value(s).
I have no idea how this would work with databasejoin elements in joined tables or joined tables with repeat rows.
Copy link
Author

@bauer-git bauer-git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works

@bauer-git
Copy link
Author

This works ONLY if no joined tables
But the old way won't work for any elements that are not included in the list query. I suppose that's ok - so long as the user is made aware of the fact.

@bauer-git bauer-git closed this Sep 8, 2018
@bauer-git bauer-git deleted the patch-45 branch September 9, 2018 01:35
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