public static function add($lat, $lng, $radius, $id) { $model = Node::firstByAttributes(array('circle_id' => $id)); if (!$model) { $model = new Node(); } $model->latitude = $lat; $model->longitude = $lng; $model->radius = $radius; $model->circle_id = $id; $model->weight = 1; $model->path_id = 1; if ($model->save()) { return TRUE; } return FALSE; }