pdo = $GLOBALS['pdo']; return; } throw new \RuntimeException('Global PDO connection not initialized'); } public function getByUf(string $uf): array { $stmt = $this->pdo->prepare('SELECT token_id, token_external_id, token_commodities_amount, token_commodities_value, token_uf, token_city, token_content, token_flag, wallet_id, chain_id, commodities_id, cpr_id, user_id FROM "token" WHERE token_uf = :uf ORDER BY token_id'); $stmt->execute(['uf' => $uf]); return $stmt->fetchAll(\PDO::FETCH_ASSOC); } public function getByUfAndCommodityName(string $uf, string $commoditiesName): array { $sql = 'SELECT t.token_id, t.token_external_id, t.token_commodities_amount, t.token_commodities_value, t.token_uf, t.token_city, t.token_content, t.token_flag, t.wallet_id, t.chain_id, t.commodities_id, t.cpr_id, t.user_id FROM "token" t JOIN "commodities" c ON c.commodities_id = t.commodities_id WHERE t.token_uf = :uf AND LOWER(TRIM(c.commodities_name)) = LOWER(TRIM(:name)) ORDER BY t.token_id'; $stmt = $this->pdo->prepare($sql); $stmt->execute(['uf' => $uf, 'name' => $commoditiesName]); return $stmt->fetchAll(\PDO::FETCH_ASSOC); } }