php - findafter with relation another table yii -
php - findafter with relation another table yii -
in database have 2 tables:
country(id,name) users(id,countryid) country ->id= users->countryid;
i'm trying perform task yii relations name country table :
users modals
public function relations() { homecoming array( 'linkedindex' => array(self::belongs_to, 'country','countryid'), ); } public function afterfind() { $name = users::model()->findbypk(1); }
if @ code closely, see variable name beingness populated,but after functions ends, variable gets destroyed,
public function afterfind() { $name = users::model()->findbypk(1); }
if want maintain $name
, have create property of model class (or store in existing property)
php yii
Comments
Post a Comment