Has_Many With Complex Condition

Hi all ,

I have a program that will post some messages to a specific group and the group has some users.

The messages will be shown in the group while user(group member) will visit the group.

The group member can block it for him only so that when he visit that particular message will not be available for him but other member of the group can see it .

I have attached the table structure.

I have relation for Mode GroupMessage like below


     * @return array relational rules.


	public function relations()


		// NOTE: you may need to adjust the relation name and the related

		// class name for the relations automatically generated below.

		return array(

			'blockFor'=>array(self::HAS_MANY, 'GroupMessageBlock', 'fk_group_message_id'),

			'group'=>array(self::BELONGS_TO, 'Group', 'fk_group_category'),



and i have to[size="2"] show all GroupMessage to the user(group member) of a group that he has not blocked.[/size]

any help ?