Hello guys,
I’m new here and still learning yii.
I have a table studio
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`city_id` int(5) NOT NULL,
`descr` varchar(2600) DEFAULT NULL,
`lng` decimal(14,10) DEFAULT NULL,
`lat` decimal(14,10) DEFAULT NULL,
`address` varchar(100) DEFAULT NULL,
`tel` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_city_id` (`city_id`),
CONSTRAINT `fk_city_id` FOREIGN KEY (`city_id`) REFERENCES `city` (`id`)
)
city table contains 4 columns, but in this case only two are necessary
id, name
Using gii I created:
public function relations()
{
return array(
'city' => array(self::BELONGS_TO, 'City', 'city_id'),
);
}
On the Website I’d like to have a search field where I type the city name, press ‘submit’ button and get the studios in this city.
I have completely no idea how to do it in Yii. I will appreciate any help.
It’s not necessary to do it now, but then I’d like to use the results (studios in the city) to show them on the map using egmap.