in /var/www/html/re-exchange/vendor/yiisoft/yii2/base/InlineAction.php at line 57 – call_user_func_array([app\controllers\BasisTypeAssetCategoryController, 'actionUpdate'], ['5'])
in /var/www/html/re-exchange/vendor/yiisoft/yii2/base/Controller.php at line 157 – yii\base\InlineAction::runWithParams(['id' => '5'])
in /var/www/html/re-exchange/vendor/yiisoft/yii2/base/Module.php at line 528 – yii\base\Controller::runAction('update', ['id' => '5'])
in /var/www/html/re-exchange/vendor/yiisoft/yii2/web/Application.php at line 103 – yii\base\Module::runAction('basis-type-asset-category/update', ['id' => '5'])
in /var/www/html/re-exchange/vendor/yiisoft/yii2/base/Application.php at line 386 – yii\web\Application::handleRequest(yii\web\Request)
in /var/www/html/re-exchange/web/index.php at line 12 – yii\base\Application::run()
6789101112
require DIR . '/../vendor/autoload.php';
require DIR . '/../vendor/yiisoft/yii2/Yii.php';
Hi,
I've generated Models + CRUD Interface, if I try to insert a new record in n:m table I got the following error:
PHP Notice – yii\base\ErrorException Undefined offset: 0
in /var/www/html/re-exchange/vendor/mootensai/yii2-relation-trait/RelationTrait.php at line 135 126127128129130131132133134135136137138139140141142143144 $container[] = $relObj; } } $this->populateRelation($relName, $container); } else if ($isHasMany) { $container = []; foreach ($v as $relPost) { if (array_filter($relPost)) { / @var $relObj ActiveRecord / $relObj = (empty($relPost[$relPKAttr[0]])) ? new $relModelClass() : $relModelClass::findOne($relPost[$relPKAttr[0]]); if (is_null($relObj)) { $relObj = new $relModelClass(); } $relObj->load($relPost, ''); $container[] = $relObj; } } $this->populateRelation($relName, $container); } else {
in /var/www/html/re-exchange/vendor/mootensai/yii2-relation-trait/RelationTrait.php at line 135 – yii\base\ErrorHandler::handleError(8, 'Undefined offset: 0', '/var/www/html/re-exchange/vendor...', 135, ...) 129130131132133134135136137138139140141 $this->populateRelation($relName, $container); } else if ($isHasMany) { $container = []; foreach ($v as $relPost) { if (array_filter($relPost)) { / @var $relObj ActiveRecord / $relObj = (empty($relPost[$relPKAttr[0]])) ? new $relModelClass() : $relModelClass::findOne($relPost[$relPKAttr[0]]); if (is_null($relObj)) { $relObj = new $relModelClass(); } $relObj->load($relPost, ''); $container[] = $relObj; }
in /var/www/html/re-exchange/vendor/mootensai/yii2-relation-trait/RelationTrait.php at line 83 – app\models\base\BasisTypeAssetCategory::loadToRelation(true, 'basisTypeAssetCategoryHasUses', [['tbl_basis_type_asset_use_id' => '2', 'share' => '', 'notice' => '']]) 77787980818283848586878889 $isHasMany = is_array($attr) && is_array(current($attr)); $relName = ($isHasMany) ? lcfirst(Inflector::pluralize($model)) : lcfirst($model); if (in_array($relName, $skippedRelations) || !array_key_exists($relName, $relData)) { continue; }
in /var/www/html/re-exchange/controllers/BasisTypeAssetCategoryController.php at line 93 – app\models\base\BasisTypeAssetCategory::loadAll(['_csrf' => 'GCjOoDVqRsT4p-joVRuKygmfz-hx-mx8...', 'BasisTypeAssetCategory' => ['id' => '5', 'tbl_basis_type_asset_id' => '2', 'name' => 'Shopping-Center', 'notice' => '', ...], 'BasisTypeAssetCategoryHasUse' => [['tbl_basis_type_asset_use_id' => '2', 'share' => '', 'notice' => '']], 'Children' => [['id' => '']]]) 87888990919293949596979899 if (Yii::$app->request->post('_asnew') == '1') { $model = new BasisTypeAssetCategory(); }else{ $model = $this->findModel($id); }
app\controllers\BasisTypeAssetCategoryController::actionUpdate('5')
in /var/www/html/re-exchange/vendor/yiisoft/yii2/base/InlineAction.php at line 57 – call_user_func_array([app\controllers\BasisTypeAssetCategoryController, 'actionUpdate'], ['5'])
in /var/www/html/re-exchange/vendor/yiisoft/yii2/base/Controller.php at line 157 – yii\base\InlineAction::runWithParams(['id' => '5'])
in /var/www/html/re-exchange/vendor/yiisoft/yii2/base/Module.php at line 528 – yii\base\Controller::runAction('update', ['id' => '5'])
in /var/www/html/re-exchange/vendor/yiisoft/yii2/web/Application.php at line 103 – yii\base\Module::runAction('basis-type-asset-category/update', ['id' => '5'])
in /var/www/html/re-exchange/vendor/yiisoft/yii2/base/Application.php at line 386 – yii\web\Application::handleRequest(yii\web\Request)
in /var/www/html/re-exchange/web/index.php at line 12 – yii\base\Application::run() 6789101112
require DIR . '/../vendor/autoload.php'; require DIR . '/../vendor/yiisoft/yii2/Yii.php';
$config = require DIR . '/../config/web.php';
(new yii\web\Application($config))->run();
$_GET = [ 'id' => '5', ];
$_POST = [ '_csrf' => 'GCjOoDVqRsT4p-joVRuKygmfz-hx-mx8cgX77MU2AJV-TIuUAwAp_MDSrZIjaei7RPWMm0ObITMoaMqCsVBaww==', 'BasisTypeAssetCategory' => [ 'id' => '5', 'tbl_basis_type_asset_id' => '2', 'name' => 'Shopping-Center', 'notice' => '', 'order_by' => '', ], 'BasisTypeAssetCategoryHasUse' => [ [ 'tbl_basis_type_asset_use_id' => '2', 'share' => '', 'notice' => '', ], ], 'Children' => [ [ 'id' => '', ], ], ];
$_COOKIE = [ '77e87b2a364dc8c70b02561da86a5b95' => '17uqjbbjf9su22sucoqrei0tr2', 'PHPSESSID' => 'ah8f6pnntq9bq1j272hfn1lij7', '_csrf' => 'd784c2e2798cd0fe8b700e895d008a22e9d05489a77aeffa9462961a0aafabada:2:{i:0;s:5:"_csrf";i:1;s:32:"fdE46jo88uEzvrbqMjCs2aMOZm1ntfZV";}', ];
$_SESSION = [ '__flash' => [],