2016-05-31 9 views
0

私はLaravel 5.2アプリケーションを持っており、特定のタスクを実行するためにジョブを使用しています。私の問題は別のジョブの中でジョブを作成したいということです。別のジョブの中からジョブを作成するLaravel 5.2

これは私のコードです:

public function handle(){ 


if ($rowMatrix == 500) { 
       $job = (new importExcelInsert($matrixContacts, $matrixDefaultFields, $matrixCustomFields, $this->idCompany))->delay($jobDelay)->onQueue('excelInserts'); 
       $this->dispatch($job); 
       $this->insertIntoTJobsUserExcel($this->idCompany, $this->idList, $this->contactListState); 
       $matrixContacts = []; 
       $matrixDefaultFields = []; 
       $matrixCustomFields = []; 
       $rowMatrix = 0; 
      } 


} 

このコードは、私のデータベース(データベースドライバ)内のジョブを作成しますが、ペイロードは何が含まれていない、その値は0

$this->idCompany //this field is protected could this be the problem? 

EDIT1です

問題は$ matrixContacts varにありますので、以下の内容の例を表示するように質問を更新しました。

[3524]=> 
    array(5) { 
    [0]=> 
    object(Webpatser\Uuid\Uuid)#225258 (8) { 
     ["bytes":protected]=> 
     string(16) "µ╬╩÷OEèe║³An┬¥" 
     ["hex":protected]=> 
     NULL 
     ["string":protected]=> 
     string(36) "e6ceca1e-f64f-4512-8a65-bafc416ec2be" 
     ["urn":protected]=> 
     NULL 
     ["version":protected]=> 
     NULL 
     ["variant":protected]=> 
     NULL 
     ["node":protected]=> 
     NULL 
     ["time":protected]=> 
     NULL 
    } 
    [1]=> 
    string(1) "1" 
    [2]=> 
    string(9) "Importado" 
    [3]=> 
    string(34) "email" 
    [4]=> 
    string(30) "nC0rI7eaH3TCWlq4tqRTJuNjp1mvew" 
    } 
+0

"DispatchesJobs"特性を使用していますか? https://laravel.com/docs/master/queues#pushing-jobs-onto-the-queue – herrjeh42

+0

うん、私はこれを持っている - > InteractsWithQueue、SerializesModels、DispatchesJobs; –

+0

あなたのコードは私のためにうまく見える - うまくいくはずです。コンストラクタに変数の代わりに "具体的な値"を渡すとどうなりますか?それは動作しますか?スタンドアロンで使用する場合、 "importExcelInsert"ジョブは機能しますか?コントローラーから? – herrjeh42

答えて

1

あなたのコードは大丈夫です。パラメータを簡略化しようとすると、シリアライザに問題がある可能性があります(バグなど)。

関連する問題