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(2.x): add back second parameter for after persist callbacks #631

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

nikophil
Copy link
Member

@nikophil nikophil commented Jun 11, 2024

fixes #628

@nikophil nikophil requested a review from kbond June 11, 2024 07:11
if ($this->afterPersist) {
$attributes = $this->normalizeAttributes($attributes);
Copy link
Member Author

Choose a reason for hiding this comment

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

not a huge fan of this:

  • this is already done in parent::create()
  • we won't pass attributes added in beforeInstantiate callbacks

any thought @kbond ?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I agree, this doesn't feel great. I guess I totally missed this part when working on 2.0...

@nikophil nikophil force-pushed the fix/add-after-persit-second-attribute branch from 52b080d to 1b37e1d Compare June 11, 2024 07:18
@@ -562,14 +562,6 @@ they were added.
// $object is the instantiated object
// $attributes contains the attributes used to instantiate the object and any extras
})
->afterPersist(function(Proxy $proxy, array $attributes) {
Copy link
Member Author

Choose a reason for hiding this comment

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

we're not doing this anymore... This is a BC break between 1.x and 2.x 🤷

@kbond kbond merged commit 17b0228 into zenstruck:2.x Jun 12, 2024
24 checks passed
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.

[2.x] ArgumentCountError thrown when passing $attributes array to closure in event
2 participants