beyondcode / invoker-community

74 stars 2 forks source link

Cant' add trend widgets #385

Open nahime0 opened 5 months ago

nahime0 commented 5 months ago

Value widgets work without issues, but if I try to add a Trend widget this is what i get:


OS: darwin Invoker Version: 2.13.3 Laravel Version: 10.44.0 Local project: true PHP Binary: /Users/nahime/Library/Application Support/Herd/bin/php Route: /dashboard?project=local-k3RPtWQBqrGn1BvsYZG1NN

Error:

Symfony\Component\ErrorHandler\Error\FatalError 

  Declaration of _HumbugBoxe25921c35ed9\Invoker\Metrics\MySqlTrendDateExpression::getValue() must be compatible with Illuminate\Database\Query\Expression::getValue(Illuminate\Database\Grammar $grammar)

  at phar:/Applications/Invoker.app/Contents/Resources/invoker_l10.phar/src/Metrics/MySqlTrendDateExpression.php:7
      3▕ namespace _HumbugBoxe25921c35ed9\Invoker\Metrics;
      4▕ 
      5▕ class MySqlTrendDateExpression extends \_HumbugBoxe25921c35ed9\Invoker\Metrics\TrendDateExpression
      6▕ {
  ➜   7▕     public function getValue()
      8▕     {
      9▕         switch ($this->unit) {
     10▕             case 'months':
     11▕                 return "date_format({$this->wrap($this->column)}, '%Y-%m')";

   Whoops\Exception\ErrorException 

  Declaration of _HumbugBoxe25921c35ed9\Invoker\Metrics\MySqlTrendDateExpression::getValue() must be compatible with Illuminate\Database\Query\Expression::getValue(Illuminate\Database\Grammar $grammar)

  at phar:/Applications/Invoker.app/Contents/Resources/invoker_l10.phar/src/Metrics/MySqlTrendDateExpression.php:7
      3▕ namespace _HumbugBoxe25921c35ed9\Invoker\Metrics;
      4▕ 
      5▕ class MySqlTrendDateExpression extends \_HumbugBoxe25921c35ed9\Invoker\Metrics\TrendDateExpression
      6▕ {
  ➜   7▕     public function getValue()
      8▕     {
      9▕         switch ($this->unit) {
     10▕             case 'months':
     11▕                 return "date_format({$this->wrap($this->column)}, '%Y-%m')";

      +1 vendor frames 

  2   [internal]:0
      Whoops\Run::handleShutdown()
nahime0 commented 5 months ago

I found an hacky way to patch. Let me know if you need the patched phar.