-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Description
Laravel Version
11.44.0
PHP Version
8.3
Database Driver & Version
No response
Description
This is in a way, a follow up to #54719 .
As mentioned in that ticket, removing ?? static::$modelNameResolvers[self::class] seems to fix the issue.
It seems the segment ?? static::$modelNameResolver was added since that issue, which I expect was in response to the specific error given in that issue ticket. That makes sense, a conditional handling of the deprecated property.
However, ?? static::$modelNameResolvers[self::class] continues to be troublesome, seemingly sending seeders using Factory creation into an infinite loop. Would love a discussion on what might be specifically causing this.
The use of self::class on line 820 of \Illuminate\Database\Eloquent\Factories\Factory.php returns Illuminate\Database\Eloquent\Factories\Factory.
It appears as if the intention is to use static::class and self::class as indices for the new modelNameResolvers Array, but the use of self::class here is creating an infinite recursion. It is probably not intended to return the Factory.php class, but the model class using HasFactory trait.
Can someone shed some light on this if I'm missing something?
Steps To Reproduce
- Add a
::factory()->create()call to a seeder. - Use HasFactory on the model calling it.
- Run --seed on migration, running that seeder.
- The seeding job will get stuck, and will infinitely loop through
modelName()on Factory class
php 8.3
laravel 11.44.0
