moved the site to the local openserver hosting. DB is connected, the path.
It turns out such an error

Fatal error: Call to a member function asCMenuArray () in D: \ OpenServer \ domains \ azimut_dev \ themes \ utasan \ views \ layouts \ main.php on line 246

There are no errors in the file itself.

Lines of the code where he swears

<?php Yii::import('application.modules.store.models.StoreCategory'); $items = StoreCategory::model()->findByPk(1)->asCMenuArray(); if(isset($items['items'])) { $this->widget('application.extensions.mbmenu.MbMenu',array( 'htmlOptions'=>array('class'=>'catalog-menu', 'id'=>'nav'), 'items'=>$items['items']) ); } ?> 

screen DB enter image description here

  • Once this message appears, it means there is an error in the file, after all. Check whether the variable on the specified line is an instance of the desired class. var_dump() will help with this. - VenZell
  • here is the line on which he swears <? php Yii :: import ('application.modules.store.models.StoreCategory'); $ items = StoreCategory :: model () -> findByPk (1) -> asCMenuArray (); if (isset ($ items ['items'])) {$ this-> widget ('application.extensions.mbmenu.MbMenu', array ('htmlOptions' => array ('class' => 'catalog-menu', 'id' => 'nav'), 'items' => $ items ['items'])); }?> - user217852
  • This information needs to be added to the question itself - VenZell
  • What version of PHP was there from where did you transfer, and what version is worth locally? - tCode
  • version 5.5 and here and there - user217852

1 answer 1

$ items = StoreCategory :: model () -> findByPk (1) -> asCMenuArray ();

In this line of code you do not check if anything was found in the table at your request. Maybe there are no records with ID = 1 , then the findByPk() method will return NULL and an error will findByPk() .

NULL is not an object and it does not have an asCMenuArray() method. Conclusion: check the contents of the database.


The author of the question clarified that the problem was in the main.php file.
The savePath used the old value from the battle server.