skip to Main Content

Php – Yii2 ActiveForm Model doesn't exist

I have a controller in Yii2 app with the following actions: private function actionPagination($query) { $count = $query->count(); $pagination = new Pagination([ 'defaultPageSize' => 10, 'totalCount' => $count, ]); $books = $query ->orderBy('id') ->offset($pagination->offset) ->limit($pagination->limit) ->all(); return [$books, $pagination]; }…

VIEW QUESTION

Php – Creating default object from empty value in YII2

Code that causes problem foreach ($items as $itemData) { $item = new PurchaseItem(); $item->internal_product_id = (int)$itemData['internal_product_id']; $item->quantity = (float)$itemData['quantity']; $item->total = (float)$itemData['total']; $item->purchase_id = $purchase->id; if (!$item->save()) { throw new Exception('Error saving the purchase item.'); } } Table Structure CREATE…

VIEW QUESTION

Php versions – Cannot generate model in Yii framework using Gii, warning: count(): Parameter must be an array or an object that implements Countable

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…

VIEW QUESTION
Back To Top
Search