CodeIgniter Forums
groupBy() undefined in Model.php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: groupBy() undefined in Model.php (/showthread.php?tid=82742)



groupBy() undefined in Model.php - paul - 08-17-2022

hello

in my model i use
PHP Code:
$this->select('.....')
     ->join('.....','left')
    ->groupBy('.....'); 
phpstan return an error
Code:
Call to an undefined method App\Models\MyModel::groupBy()
maybe this line
PHP Code:
* @method $this groupBy($by, ?bool $escape null
will be added in the Model.php in codeigniter folder ?


RE: groupBy() undefined in Model.php - plaztic - 08-17-2022

phpstan errors can be tricky to diagnose with the code you provided. Can you provide additional context as to how and where you are calling this method. Also, it would be best to include your entire model file, so we can see any 'use' statements, and to see any defined class properties.


RE: groupBy() undefined in Model.php - kenjis - 08-27-2022

@paul That's right. I sent a PR https://github.com/codeigniter4/CodeIgniter4/pull/6433

Fixed. The fix will be included in v4.2.5.