Bet Way To Fill A Public Variable

I made a public variable $this->tagIds in my model Restaurant.

What is the best way to fill this variable with the id’s of the tags that belongs to the restaurant when i’m opening the update form (/restaurant/update/<id_restaurant>).

And what is the best place to put this code? in an After find, Controller or in the View?

Controller restaurant:




public function actionUpdate()

{

	$model=$this->loadModel();


	if(isset($_POST['Restaurant']))

	{

		$model->attributes=$_POST['Restaurant'];

		if($model->save())

			$this->redirect(array('view','id'=>$model->id_restaurant));

		}


		$this->render('update',array(

			'model'=>$model,

		));

	}



Model restaurant:




<?php


class Restaurant extends CActiveRecord

{


public $tagIds;


public function relations()

{

	return array(

		'city' => array(self::BELONGS_TO, 'City', 'city_id'),

		'tags' => array(self::MANY_MANY, 'Tag', 'restaurant_tag(restaurant_id, tag_id)'),

	);

}