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

refactor: make "database reset" mechanism extendable #690

Merged
merged 4 commits into from
Oct 23, 2024

Conversation

nikophil
Copy link
Member

@nikophil nikophil commented Aug 25, 2024

This is an experiment to refactor "database reset" mechanism.

The goal is to decouple the code and to allow end users to extend it, thanks to decoration - I'll add an example in the docs on how to hook in the database reset mechanism

This work was inspired by this comment, I think I also do prefer decoration over an event system in Foundry

fixes #540 #658

(let's merge #686 before this one, I'll take care of the rebase) done

@nikophil nikophil changed the title refactor/database reset mechanism Refactor database reset mechanism Aug 25, 2024
@nikophil nikophil changed the title Refactor database reset mechanism Refactor "database reset" mechanism Aug 25, 2024
@nikophil nikophil force-pushed the refactor/database-reset-mechanism branch 4 times, most recently from a29c898 to d8ef4e7 Compare August 25, 2024 17:53
@nikophil nikophil marked this pull request as ready for review September 5, 2024 16:37
@jongotlin
Copy link
Contributor

I have tested this PR and it works great for me. Thank you!

@nikophil nikophil force-pushed the refactor/database-reset-mechanism branch 2 times, most recently from 411dfb9 to 845b569 Compare October 18, 2024 12:36
Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

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

I like this, just a few CS notes.

src/ORM/ResetDatabase/AbstractOrmResetter.php Outdated Show resolved Hide resolved
@kbond
Copy link
Member

kbond commented Oct 19, 2024

If not in the docs, at least in the PR description, I'd like to see an example of hooking into this in userland.

@nikophil nikophil force-pushed the refactor/database-reset-mechanism branch 6 times, most recently from d6065db to 0136fdb Compare October 23, 2024 08:21
@nikophil nikophil force-pushed the refactor/database-reset-mechanism branch from 0136fdb to daed4fb Compare October 23, 2024 08:31
@nikophil nikophil changed the title Refactor "database reset" mechanism refactor: make "database reset" mechanism extendable Oct 23, 2024
@nikophil nikophil merged commit df568da into zenstruck:2.x Oct 23, 2024
30 checks passed
@nikophil nikophil deleted the refactor/database-reset-mechanism branch October 23, 2024 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Add a event before/after reset database (and schema creation)
3 participants