Yii Framework Forum: ActiveRecord property is not defined after rename - solved - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

ActiveRecord property is not defined after rename - solved

#1 User is offline   Karoly Szabo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 04-November 17

Posted 04 November 2017 - 05:28 PM

I step many times in the same river in the past. I am pretty sure, many ppl have a same problem, so I think sharing the solution is a good idea.

I got a migration file with syntax error. Not a big mistake, for example the column name with wrong case, Name and not name in the table creation command. You realize this mistake after you create your Model file and using that ActiveRecord class in many place.

So, you want to reapir this problem. The correct way is to make a new migration file with ALTER or repair in the original migration file, if that is not yet publicated. Then replace the wrong table column's attribute to the correct case in the project. Everything looks fine, there is no wrong uppercase in the whole project. Lets reload a page: "Error! The ... property is not defined" !

What the hell? You try to find the problem, but there is everything looks just fine, the Yii take from some magical place the outdated information. But from where? Then, after a short or longer time the problem is gone ... just gone, start to working without reason, and you do not know: why?

So the solution that give me wasted hours and some grey hear:
DELETE the protected/runtime/cache-1.1.19.db file (the number is your Yii version)! :o :o :o

I never found this solution, so I hope it will help someone. You welcome :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users