getType() sounds to me like it gets you a string plugin ID. However, it gets an instance.

This should be renamed to getTypePlugin, and also added to the interface.

  /**
   * Gets the license type plugin instance.
   *
   * @return \Drupal\commerce_license\Plugin\LicenseType
   *   The license type plugin.
   */
  public function getType();

Will clash with #2898613: license type plugin instances are created with a license name passed in for $config, but nothing uses it, so postponed on that for now.

Comments

joachim created an issue. See original summary.

jurgenhaas’s picture

The patch in #2894862-17: implement license workflow using State Machine makes this function redundant and it appears that getType() or getTypePlugin() is not used elsewhere, so I suppose this issue could be closed as well.

jurgenhaas’s picture

Status: Postponed » Needs review
StatusFileSize
new1.96 KB

Rename function to getTypePlugin() and include that into interface

  • joachim committed aac8e80 on 8.x-2.x authored by jurgenhaas
    Issue #2898618 by jurgenhaas: Renamed License::getType() and added it to...
joachim’s picture

Status: Needs review » Fixed

Committed. Thanks!

I've tweaked the docs to make it clear that the plugin instance you get doesn't have any configuration. When you get a license plugin out of a product variation, it IS configured, so I think there's a possibility of confusion!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.