dog-ears / crud-d-scaffold

Other
19 stars 4 forks source link

ErrorException : count(): Parameter must be an array or an object that implements Countable #39

Closed wisamx closed 6 years ago

wisamx commented 6 years ago

Hello, I am getting this error message!

PS E:\wamp\www\SyriaShop> php artisan crud-d-scaffold:setup -f
Load Data...
reading setting file... (crud-d-scaffold.json)

   ErrorException  : count(): Parameter must be an array or an object that implements Countable

  at E:\wamp\www\SyriaShop\vendor\dog-ears\crud-d-scaffold\src\MyClass\Data.php:133
    129|     public function getModelByName( $name ){
    130|         $result = current( array_filter( $this->models, function($model) use($name){
    131|             return $model->name === $name;
    132|         }));
  > 133|         if( count($result)===0 ){
    134|             throw new \Exception('getModelByName('.$name.') return no model!');
    135|         }
    136|         return $result;
    137|     }

  Exception trace:

  1   count(Object(dogears\CrudDscaffold\MyClass\Model))
      E:\wamp\www\SyriaShop\vendor\dog-ears\crud-d-scaffold\src\MyClass\Data.php:133

  2   dogears\CrudDscaffold\MyClass\Data::getModelByName("product")
      E:\wamp\www\SyriaShop\vendor\dog-ears\crud-d-scaffold\src\MyClass\Data.php:87
dog-ears commented 6 years ago

Thank you for your comment.

And I modify my package. please update package and retry scaffolding.

If you getting error after update, send me your "crud-d-scaffold.json" file if you can.