Search code examples
activerecordormyii

Yii ORM Error: Property "Products.Array" is not defined on updating record


Help me please! I cant update database record. Getting error every time, when I call Products->save() For example:

product = Products::model->findByPk(1);
product->status = 0;
product->save();

Gets me

CException

Property "Products.Array" is not defined. (D:\Projects\My_Acme\framework\base\CComponent.php:130)

#0 D:\Projects\My_Acme\framework\db\ar\CActiveRecord.php(145): CComponent->__get()
#1 D:\Projects\My_Acme\protected\extensions\EAdvancedArBehavior.php(45): CActiveRecord->__get()
#2 D:\Projects\My_Acme\protected\extensions\EAdvancedArBehavior.php(28): EAdvancedArBehavior->fixBELONGS_TO()
#3 D:\Projects\My_Acme\framework\base\CComponent.php(561): EAdvancedArBehavior->beforeSave()
#4 D:\Projects\My_Acme\framework\db\ar\CActiveRecord.php(840): CComponent->raiseEvent()
#5 D:\Projects\My_Acme\framework\db\ar\CActiveRecord.php(942): CActiveRecord->onBeforeSave()
#6 D:\Projects\My_Acme\framework\db\ar\CActiveRecord.php(1119): CActiveRecord->beforeSave()
#7 D:\Projects\My_Acme\framework\db\ar\CActiveRecord.php(806): CActiveRecord->update()
#8 D:\Projects\My_Acme\protected\controllers\ProductsController.php(709): CActiveRecord->save()
#9 [internal function]: ProductsController->actionCreatebyhop()
#10 D:\Projects\My_Acme\framework\web\actions\CAction.php(108): ReflectionMethod->invokeArgs()
#11 D:\Projects\My_Acme\framework\web\actions\CInlineAction.php(47): CAction->runWithParamsInternal()
#12 D:\Projects\My_Acme\framework\web\CController.php(308): CInlineAction->runWithParams()
#13 D:\Projects\My_Acme\framework\web\filters\CFilterChain.php(133): CController->runAction()
#14 D:\Projects\My_Acme\framework\web\filters\CFilter.php(40): CFilterChain->run()
#15 D:\Projects\My_Acme\framework\web\CController.php(1145): CFilter->filter()
#16 D:\Projects\My_Acme\framework\web\filters\CInlineFilter.php(58): CController->filterAccessControl()
#17 D:\Projects\My_Acme\framework\web\filters\CFilterChain.php(130): CInlineFilter->filter()
#18 D:\Projects\My_Acme\framework\web\CController.php(291): CFilterChain->run()
#19 D:\Projects\My_Acme\framework\web\CController.php(265): CController->runActionWithFilters()
#20 D:\Projects\My_Acme\framework\web\CWebApplication.php(282): CController->run()
#21 D:\Projects\My_Acme\framework\web\CWebApplication.php(141): CWebApplication->runController()
#22 D:\Projects\My_Acme\framework\base\CApplication.php(180): CWebApplication->processRequest()
#23 D:\Projects\My_Acme\index.php(28): CApplication->run()
#24 {main}

Products model has 94 field, 6 relations to other models, 6 countable fields. I have just check field names, field types - everything is ok... seems like relations between tables not working properly. Yii version is 1.1.14


Solution

  • I used PHP 7.4 with Yii version 1.1.14... It is very old version and when I switch to PHP 5.6, error is gone away))) Legacy app