Replies: 1 comment
-
I think your $job property is conflicting. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
Have finished going through Mohamed's awesome queue book. And started running into some strange errors.
I started with this:
I read through the https://stitcher.io/blog/typed-properties-in-php-74 post and much of RFC. Nothing I was doing seemed strange.
Then I received:
Symfony\Component\ErrorHandler\Error\FatalError App\Listeners\SendPublicMessageNotification and Illuminate\Bus\Queueable define the same property ($connection) in the composition of App\Listeners\SendPublicMessageNotification. However, the definition differs and is considered incompatible. Class was composed
So I found this post:laravel/nova-issues#557 (comment) Taylor mentions using the constructor to set queue settings. But I get these type of errors:
Error Typed property Illuminate\Events\CallQueuedListener::$job must not be accessed before initialization
Steps To Reproduce:
I don't think I can give perfect steps to reproduce. (maybe create a App\Models\SlugJob = $job in a fresh app and then upgrade from 7-8, then see if
trait InteractsWithQueue
has the path in the vendor directory?)After trying a few forum posts with nobody answering I dug into the trait:
Illuminate\Events\CallQueuedListener
I found that the vendor directory had pulled in
\App\Models\SlugJob $job;
This is very bizarre because when I upgraded I did it manually for the models directory. e.g. open each file and place\App\Models\model_name
vs. `\App\model_name' for the namespace.So, I did not use phpstorm to find and replace.
Yet, here the framework pulled in my application
SlugJob
model. I'm not sure if this is because it uses the variable$job
?After seeing that, I removed the namespace and the queues worked as expected. This also allowed me to declare the values of
$tries = 3;
for example. As shown in the book.So, the the app model
$job
was being accessed in the models directory and inserted, wrongly - now the error makes sense.Could this be a bug?
Beta Was this translation helpful? Give feedback.
All reactions