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: Remove fetching:collection listener #29

Merged
merged 1 commit into from
Jul 19, 2018
Merged

fix: Remove fetching:collection listener #29

merged 1 commit into from
Jul 19, 2018

Conversation

villelahdenvuo
Copy link
Contributor

We already hook into the Collection fetching event so that causes the query to be modified twice in some cases.

We already hook into the Collection fetching event so that causes the query to be modified twice in some cases.
@bsiddiqui
Copy link
Owner

@villelahdenvuo if we remove this than deleting a collection won't trigger the soft delete. What modification are you making in the collection fetching event?

@villelahdenvuo
Copy link
Contributor Author

@bsiddiqui in my tests the Collection's fetching event is called, the fetching:collection is a duplicate event for convenience.

@villelahdenvuo
Copy link
Contributor Author

I mean: In Bookshelf Model#fetching:collection is a convenience event that is called when a Collection is fetched, but since we already hook into the Collection fetching event, we get duplicate events, one for the Collection and one for the Model of that collection (fetching:collection).

My tests catch this because we mock database queries and match them to expected SQL/regex and I saw that the where deleted_at is null clause was being duplicated. And it seems that all the tests in this repo pass, too, except for some issue with migrations, which seems unrelated?

@bsiddiqui
Copy link
Owner

Great, thanks! I tested locally and tests passed so I'll merge and fix circle later.

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