Skip to content

Conversation

@chriscarpenter12
Copy link

I noticed I had the same issue as #4. Started looking around and noticed that Eloquent's own SoftDeletingScope uses $builder->withoutGlobalScope($this)-> to ignore inheriting of itself on the extensions. That is what I did here. Seems to be working as expected for me.

@markusjwetzel markusjwetzel merged commit 2b1b08a into ProAI:master Dec 23, 2016
@markusjwetzel
Copy link
Contributor

Thank you! :)

@markusjwetzel
Copy link
Contributor

markusjwetzel commented Dec 23, 2016

Could it be that your pull request broke the update functionality (see #10)? Because I am pretty sure updating had worked before. I reverted this pull request temporarily and I am willing to re-merge it when we are certain that everything works.

@chriscarpenter12
Copy link
Author

I see what you are saying, but the way it is now without using withoutGlobalScope($this) on the extensions version and allVersions you get a double inner join on the query. Which is the cause of the issue in #4. This change should only effect the extensions version and allVersions. Everything else should have worked as before.

select * from `orders` inner join `orders_version` on `orders`.`id` = `orders_version`.`ref_id` and `orders_version`.`version` = 1 inner join `orders_version` on `orders`.`id` = `orders_version`.`ref_id` and `orders_version`.`version` = `orders`.`latest_version` where `orders`.`id` = 1 limit 1

You can see that the apply() is being added to the query builder chain.

danhunsaker pushed a commit to danhunsaker/eloquent-versioning that referenced this pull request Jun 15, 2020
Only add version when saving versioned fields
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.

2 participants