Whenever I try to generate a model using Gii in the Yii framework, it throws:
php warning : count(): Parameter must be an array or an object that implements Countable
It also mentions following file:
appprotectedvendoryiisoftyiiframeworkgiigeneratorsmodelModelCode.php(371)
While questions with same title exists, none of them fixed mine.I’m using yii version 1.1.14 and windows 10
3
Answers
You should upgrade Yii to 1.1.21 – this bug was fixed almost 2 years ago.
Downgrading Php to 5.6 works fine with the older versions of yii.
If you want to fix it without upgrading your existing Yii version, then follow as below.
Go to
and fix with
Just check the $pk is an array or not and store value in a new variable $count and return it.