beyondcode / invoker-community

74 stars 2 forks source link

Creating Trend widget causes a FatalError #352

Open adampatterson opened 1 year ago

adampatterson commented 1 year ago

OS: darwin Invoker Version: 2.13.1 Laravel Version: 10.17 Local project: true PHP Binary: /opt/homebrew/Cellar/php/8.2.8/bin/php Route: /project/index?class=App%5CModels%5CInvoice&time=1692027774627&project=local-hyLt5zswyaqmohewQmjtHR

Error:

Symfony\Component\ErrorHandler\Error\FatalError 

  Declaration of _HumbugBox691400d5ac8c\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 _HumbugBox691400d5ac8c\Invoker\Metrics;
      4▕ 
      5▕ class MySqlTrendDateExpression extends \_HumbugBox691400d5ac8c\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')";

      +6 vendor frames 

  7   phar:/Applications/Invoker.app/Contents/Resources/invoker_l10.phar/src/Metrics/TrendDateExpressionFactory.php:16
      Composer\Autoload\ClassLoader::loadClass("'_HumbugBox691400d5ac8c\\Invoker\\Metrics\\MySqlTrendDateExpression'")

  8   phar:/Applications/Invoker.app/Contents/Resources/invoker_l10.phar/src/Actions/CalculateWidgetAction.php:104
      _HumbugBox691400d5ac8c\Invoker\Metrics\TrendDateExpressionFactory::make("class Illuminate\Database\Eloquent\Builder { protected $query = class Illuminate\Database\Query\Builder { public $connection = class Illuminate\Database\MySqlConnection { ... }; public $grammar = class Illuminate\Database\Query\Grammars\MySqlGrammar { ... }; public $processor = class Illuminate\Database\Query\Processors\MySqlProcessor { ... }; public $bindings = [...]; public $aggregate = NULL; public $columns = NULL; public $distinct = FALSE; public $from = 'invoices'; public $indexHint = NULL; public $joins = NULL; public $wheres = [...]; public $groups = NULL; public $havings = NULL; public $orders = NULL; public $limit = NULL; public $offset = NULL; public $unions = NULL; public $unionLimit = NULL; public $unionOffset = NULL; public $unionOrders = NULL; public $lock = NULL; public $beforeQueryCallbacks = [...]; public $operators = [...]; public $bitwiseOperators = [...]; public $useWritePdo = FALSE }; protected $model = class App\Models\Invoice { protected $connection = NULL; prote...", "'created_at'", "'days'")

   Whoops\Exception\ErrorException 

  Declaration of _HumbugBox691400d5ac8c\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 _HumbugBox691400d5ac8c\Invoker\Metrics;
      4▕ 
      5▕ class MySqlTrendDateExpression extends \_HumbugBox691400d5ac8c\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()
daniel-wright commented 1 year ago

Currently there does not appear to be a way to get any combination of a Trend to work. Once they fix this bug it would be helpful to see some working examples for the Query box or custom options, and how those are used in conjunction with the other input fields on the widget modal.