public function init()
{
parent::init();
if (is_null($this->attribute)) {
throw new Exception("Module \"attribute\" attribute must be set");
}
if (is_null($this->latitudeAttribute)) {
throw new Exception("Module \"latitudeAttribute\" attribute must be set");
}
if (is_null($this->longitudeAttribute)) {
throw new Exception("Module \"longitudeAttribute\" attribute must be set");
}
if (is_null($this->jsonAttribute)) {
throw new Exception("Module \"jsonAttribute\" attribute must be set");
}
if (is_null($this->class)) {
$this->class = __NAMESPACE__ . '\\models\\Locations';
}
$location = new $this->class();
$location->setAttributes(['destinationAttribute' => $this->attribute, 'latitudeAttribute' => $this->latitudeAttribute, 'longitudeAttribute' => $this->longitudeAttribute, 'jsonAttribute' => $this->jsonAttribute]);
$this->location = $location;
Event::on(Locations::className(), Locations::EVENT_ADD_LOCATION, [Locations::className(), 'addLocation']);
Event::on(Locations::className(), Locations::EVENT_GET_LOCATION, [Locations::className(), 'getLocation']);
return true;
}