What's $this->Owner ?

Hi, sometimes I find $this->Owner in Yii code. Is “Owner” a sort of a reserved word? What does t mean $this->Owner? Doing a print_r($this->owner) I’ve seen that it refers to the model (I think…). So $this->owner is a way to call $model from any part of code?

TIA

Danilo

It depends on context:

http://www.yiiframework.com/doc/api/CBehavior#owner

http://www.yiiframework.com/doc/api/CWidget#owner-detail

http://www.yiiframework.com/doc/api/CForm#owner

Obviously, you deal with a behavior attached to a model (CActiveRecordBehavior?).

By using $this->owner you can access model’s properties and methods from this behavior.

perfect… yes i’m playing with nestedtree extension behavior :)

Off-topic: is it a forum’s bug or a feature? I write “(BIG B)ehavior”, but get “behavior” (with a small “b”) :huh:

Yes it’s a bug. Somewhere it already got mentioned in this forum. And if I remember right the IPB devs are aware about this. Maybe you can find the thread. :P

There you go:

http://www.yiiframework.com/forum/index.php?/topic/4368-problem-with-camelcase-in-forum

IMHO: IPB sucks!

Why isn’t out there a Yii powered forum?

Because you haven’t written one yet. ;)

Must agree!! Especially the forums search is driving me nuts! Sorry for OT ::)