Updating the Playoff Classes/Objects for Sports Bench 2.0

So as a part of the run up to the release of Sports Bench 2.0, I’m going to go over what’s different with the various different sections of the plugin and the main theme.

And in this post I’m going to go over the two playoff classes: series and brackets. Most likely you probably aren’t using these classes unless you’re making pretty big changes to how playoffs are displayed on your site.

As you’ll see, there are some pretty dramatic changes to the Bracket and Series classes, especially in how you are able to get and set the properties for the object if you are using those classes.

So let’s discuss what will be different in the Bracket and Series classes in the version 2.0 release.

What’s new with the bracket and series classes?

The biggest change for the Bracket and Series classes is that the properties are now protected. That means that they can only be directly accessed through the class or a child class, and can’t be called externally.

So to help you continue to access them, I’ve created getter methods that you can use instead to get the properties. That way you won’t accidentally update a property instead of getting a property.

Bracket

  • get_bracket_id
  • get_num_teams
  • get_bracket_format
  • get_bracket_title
  • get_bracket_season

Series

  • get_series_id
  • get_bracket_id
  • get_series_format
  • get_playoff_round
  • get_team_one_id
  • get_team_one_seed
  • get_team_two_id
  • get_team_two_seed
  • get_game_ids

On the flip side, you can easily update a bracket or series by using the update method. This method accepts an array of key => value pairs that are “property” and then the value. It will then update the property for the object as well as update the bracket/series in the database as well.

All of the old functions are still available for you to use. Plus there are a few new ones you can use as well. You can check out the documentation for that shortly.

Get ready for Sports Bench

We’re less than two weeks away from Sports Bench 2.0 being released. To learn more about what changes are coming and how you can make sure that you’re ready when it’s released, check out this main blog post.