So I’ve been looking at the code trying to figure out how things work as I am just getting started with Yii version 1.1. The code I was looking at was the default code that is setup right after you initially set up Yii. Specifically I was playing around with the login page and was trying to figure out where the $attributes class variable is at that’s used in the SiteController.php file. This was how I went about looking at things:
In actionLogin() I see $model=new LoginForm and then later I see $model->attributes=$_POST[‘LoginForm’]. Seems simple enough, so on to my quest of finding the actual $attributes class variable. I went to look at LoginForm.php.
I don’t see any variable called $attributes. No biggie, I’ll backtrack some more as this class extends CFormModel.
No variable called $attributes here either. But this extends another class called CModel, maybe it’s there.
Nope, don’t see it here either. This extends CComponent, so let’s check there.
Well it’s not here either and this class doesn’t extend any others so we’re at the top of the chain.
So anyway, you get my drift. Since I’ve already tried out the login page I know that the statement $model->attributes=$_POST[‘LoginForm’]; does work, I just don’t understand how it does when there doesn’t seem to be any parent class that contains an $attributes variable when following the LoginForm’s inheritance chain.
I’d appreciate any info, dumbed down or otherwise. Thanks in advance.