Framework: v5.6.29 broke Model Observers

Created on 27 Jul 2018  路  7Comments  路  Source: laravel/framework

  • Laravel Version: 5.6.29
  • PHP Version: 7.2.7
  • Database Driver & Version: MySQL

Description:

Updating Laravel to 5.6.29 breaks Model observers.
Everything works fine on v5.6.28

Steps To Reproduce:

Create UserObserver for User model.
Create "creating" method inside UserObserver, to assign for example "pin" to user model.
'creating' method won't be called at all on v5.6.29.

Most helpful comment

@GrahamCampbell This is not fixed yet because v5.6.30 has not yet been released.

I don't know the deciding factors for when a minor release is done but I think that an accidental breaking change should probably be an influential one.

All 7 comments

It works for me. Can you post your code?

Or ideally a unit test that proves that, so we can avoid breaking it in the future?

If your test suite is failing on Eloquent event assertions, it may be due to a breaking change made to Event::fake() called for specific classes:

Event::fake(['eloquent.creating: ' . User::class]);

It'll be fixed in 5.6.30 that I assume comes out tomorrow: https://github.com/laravel/framework/pull/24985

@derekmd I have 'pin' field in my table which is not null. Value has to be generated randomly when creating model, so I never mocked it in unit tests it so it could work the way it is.
All tests are passing on v5.6.28. But on v5.6.29, in unit test where I create new model with factory 'creating' method on observer never being called and test fails with MySQL error null not violation.

I just created fresh Laravel project. Did the same thing, interestingly everything works without a problem.

I think this is fixed now, as of the latest release. Please ping if not. :)

@GrahamCampbell This is not fixed yet because v5.6.30 has not yet been released.

I don't know the deciding factors for when a minor release is done but I think that an accidental breaking change should probably be an influential one.

@GrahamCampbell This is still not fixed at the moment, due to 5.6.30 not being tagged. We use the https://github.com/illuminate/support subtree split for some projects here and the fix missed the 5.6.29 by just a day there.

Any chance a new release could be tagged with the fix? Our test suite is failing at the moment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jackmu95 picture jackmu95  路  3Comments

felixsanz picture felixsanz  路  3Comments

PhiloNL picture PhiloNL  路  3Comments

kerbylav picture kerbylav  路  3Comments

lzp819739483 picture lzp819739483  路  3Comments