original_string: protected function doUpdateObjects(Sport $model, $data) {
  		// remove all relationships before
  		ObjectQuery::create()->filterBySport($model)->delete();
  
  		// add them
  		$errors = [];
  		foreach ($data as $entry) {
  			if (!isset($entry['id'])) {
  				$errors[] = 'Missing id for Object';
  			} else {
  				$related = ObjectQuery::create()->findOneById($entry['id']);
  				$model->addObject($related);
  			}
  		}
  
  		if (count($errors) > 0) {
  			throw new ErrorsException($errors);
  		}
  	}
code: protected function doUpdateObjects(Sport $model, $data) {
  		// remove all relationships before
  		ObjectQuery::create()->filterBySport($model)->delete();
  
  		// add them
  		$errors = [];
  		foreach ($data as $entry) {
  			if (!isset($entry['id'])) {
  				$errors[] = 'Missing id for Object';
  			} else {
  				$related = ObjectQuery::create()->findOneById($entry['id']);
  				$model->addObject($related);
  			}
  		}
  
  		if (count($errors) > 0) {
  			throw new ErrorsException($errors);
  		}
  	}
code_tokens: protected function doUpdateObjects ( Sport $ model , $ data ) { // remove all relationships before ObjectQuery :: create ( ) -> filterBySport ( $ model ) -> delete ( ) ; // add them $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Object' ; } else { $ related = ObjectQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addObject ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
docstring: Internal update mechanism of Objects on Sport
  
  @param Sport $model
  @param mixed $data
docstring_tokens: Internal update mechanism of Objects on Sport