protected function doUpdateGroups(Sport $model, $data) {
		// remove all relationships before
		GroupQuery::create()->filterBySport($model)->delete();

		// add them
		$errors = [];
		foreach ($data as $entry) {
			if (!isset($entry['id'])) {
				$errors[] = 'Missing id for Group';
			} else {
				$related = GroupQuery::create()->findOneById($entry['id']);
				$model->addGroup($related);
			}
		}

		if (count($errors) > 0) {
			throw new ErrorsException($errors);
		}
	}
protected function doUpdateGroups(Sport $model, $data) {
		// remove all relationships before
		GroupQuery::create()->filterBySport($model)->delete();

		// add them
		$errors = [];
		foreach ($data as $entry) {
			if (!isset($entry['id'])) {
				$errors[] = 'Missing id for Group';
			} else {
				$related = GroupQuery::create()->findOneById($entry['id']);
				$model->addGroup($related);
			}
		}

		if (count($errors) > 0) {
			throw new ErrorsException($errors);
		}
	}
protected function doUpdateGroups ( Sport $ model , $ data ) { // remove all relationships before GroupQuery :: create ( ) -> filterBySport ( $ model ) -> delete ( ) ; // add them $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Group' ; } else { $ related = GroupQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addGroup ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Groups on Sport

@param Sport $model
@param mixed $data
Internal update mechanism of Groups on Sport