PDOException when dispatching job with DynamoDbModel model as argument
adrian7 opened this issue · comments
The exception is thrown from App\Jobs\Job->__wakeup
(implemented in Illuminate\Queue\SerializesModels)
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "dynamoTable" does not exist
LINE 1: select * from "dynamoTable" where "dynamoTable"."pkey" = $1
File:
vendor/illuminate/database/Connection.php in execute at line 330
Can you show the code that leads to this error?
Basically I was sending a model as an argument to job constructor and then, assigning it to a local var.
use App\Models\Dynamo\Feed;
use Illuminate\Contracts\Queue\ShouldQueue;
class UpdateFeedJob extends Job implements ShouldQueue
{
protected $feed = NULL;
public function __construct(Feed $feed) {
$this->feed = $feed;
}
public function handle(){
//handle job
}
}
Ah ok.
For now, you can do this:
class UpdateFeedJob extends Job implements ShouldQueue
{
use SerializesModels;
protected $feed = NULL;
public function __construct(Feed $feed) {
$this->feed = $feed;
}
public function handle(){
//handle job
}
/**
* @override
*/
public function restoreModel($value)
{
return Feed::find($value->id);
}
}
Does it help? can this be closed?
Looks like there's no issue now... Closing for now.