Container.php第734行中的ReflectionException:类不存在

时间:2016-11-06 20:02:40

标签: php laravel

我正在尝试调用我创建的Job类。但是我得到了这个:

ReflectionException in Container.php line 734:
Class does not exist

at Job->failed() in SyncQueue.php line 153
at SyncQueue->handleFailedJob(object(SyncJob)) in SyncQueue.php line 36
at SyncQueue->push(object(ImportProductFromFile), '', 'upload_products_file') in Queue.php line 40
at Queue->pushOn('upload_products_file', object(ImportProductFromFile)) in Dispatcher.php line 135
at Dispatcher->pushCommandToQueue(object(SyncQueue), object(ImportProductFromFile)) 

这是我的控制者:

use App\Jobs\ImportProductFromFile;

class ProductController extends AppBaseController
{
public function importProducts(Request $request)
 {
  ....
  $param = array(
    'products' => $products 
  );
  $job = (new ImportProductFromFile($param))->onQueue('upload_products_file');
  $this->dispatch($job);

 }

}

这里的问题是句柄功能。当我处理构造部分时,文件运行。 这是ImportProductFromFile.php文件:

namespace App\Jobs;

use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\DispatchesJobs;

use App\Repositories\ProductRepository;

use App\Models\Product;

use DB;

class ImportProductFromFile extends Job implements ShouldQueue
{
    use InteractsWithQueue, SerializesModels;
    use DispatchesJobs;

    protected $param;
    private $productRepository;

    public function __construct($param)
    {
        $this->param = $param;
    }


    public function handle(ProductRepository $productRepo)
    {

        ....

    }
}

0 个答案:

没有答案