{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/15891","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/15891/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/15891/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/15891/events","html_url":"https://github.com/laravel/framework/issues/15891","id":182804267,"number":15891,"title":"[5.2] Queued event listener throws \"[ReflectionException] Class  does not exist\"","user":{"login":"tonystatic","id":5255487,"avatar_url":"https://avatars.githubusercontent.com/u/5255487?v=3","gravatar_id":"","url":"https://api.github.com/users/tonystatic","html_url":"https://github.com/tonystatic","followers_url":"https://api.github.com/users/tonystatic/followers","following_url":"https://api.github.com/users/tonystatic/following{/other_user}","gists_url":"https://api.github.com/users/tonystatic/gists{/gist_id}","starred_url":"https://api.github.com/users/tonystatic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonystatic/subscriptions","organizations_url":"https://api.github.com/users/tonystatic/orgs","repos_url":"https://api.github.com/users/tonystatic/repos","events_url":"https://api.github.com/users/tonystatic/events{/privacy}","received_events_url":"https://api.github.com/users/tonystatic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-13T14:24:17Z","updated_at":"2016-10-13T20:29:54Z","closed_at":null,"body":"- Laravel Version: 5.2.45\r\n- PHP Version: 7.0.11\r\n- Queue Driver: sync\r\n\r\n### Description:\r\nI created an event and a listener for it in my project. The listener is queued (by implementing _ShouldQueue_ interface). When I run artisan command, it calls my custom service, where the event is fired. I mapped the event with its listener in _EventServiceProvider_, but the listener is never reached. Instead, the exception is thrown:\r\n```\r\n[ReflectionException]  \r\n  Class  does not exist\r\n```\r\nYes, mentioned class name is ' ' (sick!).\r\n\r\n### Event firing:\r\n```php\r\nif (count($createdClientsData) > 0) {\r\n            event(new ExternalClientsCreated($createdClientsData));\r\n        }\r\n```\r\n\r\n### Event class:\r\n```php\r\n<?php\r\n\r\nnamespace App\\Events;\r\n\r\nuse App\\Events\\Event;\r\nuse Illuminate\\Queue\\SerializesModels;\r\nuse Illuminate\\Contracts\\Broadcasting\\ShouldBroadcast;\r\n\r\nclass ExternalClientsCreated extends Event\r\n{\r\n    use SerializesModels;\r\n\r\n    public $clientsData;\r\n\r\n    public function __construct($clientsData = [])\r\n    {\r\n        $this->clientsData = $clientsData;\r\n    }\r\n}\r\n```\r\n\r\n\r\n### EventServiceProvider $listen:\r\n```php\r\nprotected $listen = [\r\n        ExternalClientsCreated::class => [\r\n            ExternalClientsCreation::class,\r\n        ],\r\n    ];\r\n```\r\n\r\n### Listener class:\r\n```php\r\n<?php\r\n\r\nnamespace App\\Listeners;\r\n\r\nuse App\\Events\\ExternalClientsCreated;\r\nuse App\\Library\\Services\\ClientService;\r\nuse Illuminate\\Queue\\InteractsWithQueue;\r\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\r\n\r\nclass ExternalClientsCreation implements ShouldQueue\r\n{\r\n    use InteractsWithQueue;\r\n\r\n    protected $clientService;\r\n\r\n    public function __construct(ClientService $clientService)\r\n    {\r\n        $this->clientService = $clientService;\r\n    }\r\n\r\n    public function handle(ExternalClientsCreated $event)\r\n    {\r\n        $this->clientService->createClients($event->clientsData);\r\n    }\r\n}\r\n```\r\n\r\n### Error log:\r\n```\r\n[2016-10-13 17:06:13] local.ERROR: ReflectionException: Class  does not exist in /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Container/Container.php:734\r\nStack trace:\r\n#0 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Container/Container.php(734): ReflectionClass->__construct('')\r\n#1 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Container/Container.php(629): Illuminate\\Container\\Container->build('', Array)\r\n#2 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(697): Illuminate\\Container\\Container->make('', Array)\r\n#3 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(154): Illuminate\\Foundation\\Application->make('')\r\n#4 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(210): Illuminate\\Queue\\Jobs\\Job->resolve('')\r\n#5 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php(153): Illuminate\\Queue\\Jobs\\Job->failed()\r\n#6 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php(42): Illuminate\\Queue\\SyncQueue->handleFailedJob(Object(Illuminate\\Queue\\Jobs\\SyncJob))\r\n#7 [internal function]: Illuminate\\Queue\\SyncQueue->push('Illuminate\\\\Even...', Array)\r\n#8 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php(267): call_user_func_array(Array, Array)\r\n#9 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(416): Illuminate\\Queue\\QueueManager->__call('push', Array)\r\n#10 [internal function]: Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}(Object(App\\Events\\ExternalClientsCreated))\r\n#11 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(347): call_user_func_array(Object(Closure), Array)\r\n#12 [internal function]: Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}(Object(App\\Events\\ExternalClientsCreated))\r\n#13 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(221): call_user_func_array(Object(Closure), Array)\r\n#14 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(419): Illuminate\\Events\\Dispatcher->fire('App\\\\Events\\\\Exte...', Array, false)\r\n#15 /home/vagrant/Code/medhub/app/Library/Services/FirebirdService.php(52): event(Object(App\\Events\\ExternalClientsCreated))\r\n#16 /home/vagrant/Code/medhub/app/Console/Commands/LoadClients.php(16): App\\Library\\Services\\FirebirdService->loadClients()\r\n#17 [internal function]: App\\Console\\Commands\\LoadClients->handle(Object(App\\Library\\Services\\FirebirdService))\r\n#18 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Container/Container.php(507): call_user_func_array(Array, Array)\r\n#19 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Console/Command.php(169): Illuminate\\Container\\Container->call(Array)\r\n#20 /home/vagrant/Code/medhub/vendor/symfony/console/Command/Command.php(256): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n#21 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Console/Command.php(155): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n#22 /home/vagrant/Code/medhub/vendor/symfony/console/Application.php(794): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n#23 /home/vagrant/Code/medhub/vendor/symfony/console/Application.php(186): Symfony\\Component\\Console\\Application->doRunCommand(Object(App\\Console\\Commands\\LoadClients), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n#24 /home/vagrant/Code/medhub/vendor/symfony/console/Application.php(117): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n#25 /home/vagrant/Code/medhub/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n#26 /home/vagrant/Code/medhub/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n#27 {main}\r\n```\r\n\r\nThanks in advance!"},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/253629522","html_url":"https://github.com/laravel/framework/issues/15891#issuecomment-253629522","issue_url":"https://api.github.com/repos/laravel/framework/issues/15891","id":253629522,"user":{"login":"themsaid","id":4332182,"avatar_url":"https://avatars.githubusercontent.com/u/4332182?v=3","gravatar_id":"","url":"https://api.github.com/users/themsaid","html_url":"https://github.com/themsaid","followers_url":"https://api.github.com/users/themsaid/followers","following_url":"https://api.github.com/users/themsaid/following{/other_user}","gists_url":"https://api.github.com/users/themsaid/gists{/gist_id}","starred_url":"https://api.github.com/users/themsaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/themsaid/subscriptions","organizations_url":"https://api.github.com/users/themsaid/orgs","repos_url":"https://api.github.com/users/themsaid/repos","events_url":"https://api.github.com/users/themsaid/events{/privacy}","received_events_url":"https://api.github.com/users/themsaid/received_events","type":"User","site_admin":false},"created_at":"2016-10-13T20:29:54Z","updated_at":"2016-10-13T20:29:54Z","body":"@tonystatic What do you path in `clientsData`? I suspect that the job payload failed to create."}}
{"actor":{"display_login":"themsaid"}}