Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Using Unset($Model->Var) Calls Getter Function?

$
0
0
Hi,
I'm a bit confused right now.

i have the following code snippet: (the exits are for my debugging right now.)

			
$appId = 3;
if (isset($this->randomMedia))
   unset($this->randomMedia); //unset for new randomImage in while		
$this->setRandomMedia($appId); //<--- tells allready set
exit;


the setter for RandomMedia is telling me $this->randomMedia is allready set.

it seems like unset($this->randomMedia); is calling the getter getRandomMedia (wich is executing the setter cause of unset). Is it bug or is it a "feature"?

best regards

Viewing all articles
Browse latest Browse all 18717

Trending Articles