option('tenant') ?? $this->ask('What is Tenant id?'); $this->tenant = Tenant::find($tenant); if (! $this->tenant) { $this->error('Invalid Tenant ID. Please try again.'); } } while (! $this->tenant); setup_db_connection($this->tenant->codice); $ente = new \ente(); $ente->excludeConnector = true; $ente->init($this->tenant->dominio); if(empty($ente->codice)) { throw new InvalidArgumentException("Failed to initialize EnteClass with: {$this->tenant->dominio}"); } global $pdo; $pdo->setConnessioneEnte($this->tenant->codice); if($ente->hasModulo('conservazione') && Gara::count() > 0) { foreach(Gara::select("codice", "stato", "codice_ente")->cursor() as $gara) { $this->line("Processing tender #{$gara["codice"]}"); $ente->checkConservazione("gare", $gara["codice"], $gara["stato"], $gara["codice_ente"]); } } return 0; } }