Trouble With Multi Level Foreign Key Search


I have a chain like multi level relations for foreign keys:

model MyModel:

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(

		'merchantIdFk' => array(self::BELONGS_TO, 'Merchant', 'merchant_id_fk')


I have the following chain like dependency for foreign keys:


This errors as myModel does not have have zipCodeIdFK:


How do I make MyModel searchable by Zipcodes?



Hi Gaur, welcome to the forum.







$criteria->compare('addressIdFk.city_name', $cityNameToSearch);

$criteria->compare('zipCodeIdFk.zip_code', $zipCodeToSearch);