konrad1234
(Konradpapala)
1
This isn’t related specifically to Yii but I hope you’ll help me anyway.
In the Yii development cookbook I found a strange php language construct:
public function remove()
{
$this->getOwner()->{$this->flagField} = 1;
return $this->getOwner();
}
I don’t understand this: $this->getOwner()->{$this->flagField} = 1;
Can somebody explain me this?
Update: the flagField variable is defined as:
public $flagField = 'is_deleted';
Does it mean that the line in question resolves to this:
$this->getOwner()->is_deleted=1;
?
But then I don’t understand why not simply write like I wrote it…
xahgmah
(Xahgmah)
2
You correct explain this code.
They use flagField variable, that you can change it to you need.
It make this code more tunable.