I’vee been trying to get this queue to be detected in my database, but when I run the commands nothing happens, it seems as if its not detecting the jobs on the database
Here is my code where I send the task:
namespace app\commands;
use \yii\console\Controller;
use \yii\console\ExitCode;
use app\models\Horarios_Equipos;
use app\commands\HorarioJob;
use yii\queue\Queue;
class HorarioController extends Controller
{
/**
* This command echoes what you have entered as the message.
* @param string $message the message to be echoed.
* @return int Exit code
*/
public function actionBuscar()
{
$hora = date("H").":00".":00";
$dia = date("N");
$horarios = Horarios_Equipos::find()->where([
'hora' => $hora,
'dia' => $dia,
])->all();
foreach($horarios as $horario)
{
//echo $horario->id_equipo."\n";
//echo $horario->estado."\n";
//enviar a cola
Yii::$app->queue->push(
new HorarioJob([
'id_equipo' => $horario->id_equipo,
'estado' => $horario->estado,
echo $this->id_equipo."\n";
echo $this->estado."\n";
])
);
}
return ExitCode::OK;
}
}
This is the code for the task:
<?php
namespace app\commands;
use Yii;
use yii\base\BaseObject;
use yii\queue\JobInterface;
use yii\queue\Queue;
class HorarioJob extends BaseObject implements yii\queue\JobInterface
{
public $id_equipo;
public $estado;
public function execute($queue)
{
echo $this->id_equipo."\n";
echo $this->estado."\n";
}
}
I’ve already updated composer to see if it would work but It didn’t help either, I don’t know what to do anymore