I make virtual attributes for them. So basically you need to create:
$this->_country = null;
function getCountry() { //these two are the functions that make the virtual attributes
if($this->_country == null) {
$this->_country = $this->country->name;
}
return $this->_country;
}
function setCountry($c) {
$this->_country = $c;
}
function search() {
//.......
$criteria->compare('country.name', $this->country, true); //Note that I am not using $_country
}
because grid view check if the column name has “.” don’t filter i think.
I was just thinking of doing a wiki on this kind of subject, given the number of posts about it recently, but your blog entry describes it exactly as needed!