Initialization code in User model:
//Define the code for initialization call
protected function initialize(){
//Need to call the initialization method of the parent class
parent::initialize();
echo 'initialize-';
}
There is a loop in one of the methods GetUserList():
foreach($list as $key=>$user){
echo $user->user_name;
}
After controlling the calling method: GetUserList(), the output text is:
initialize-
initialized initialize-initialized initialize-initialized initialize-initialized initialize-
Question:
Will using $user -> user_name in foreach also trigger the model's initialize method again?