You are here

public function InvoiceType::calculateDependencies in Commerce Invoice 8.2

Calculates dependencies and stores them in the dependency property.

Return value

$this

Overrides ConfigEntityBase::calculateDependencies

See also

\Drupal\Core\Config\Entity\ConfigDependencyManager

File

src/Entity/InvoiceType.php, line 274

Class

InvoiceType
Defines the invoice type entity class.

Namespace

Drupal\commerce_invoice\Entity

Code

public function calculateDependencies() {
  parent::calculateDependencies();

  // The invoice type must depend on the module that provides the workflow.
  $workflow_manager = \Drupal::service('plugin.manager.workflow');
  $workflow = $workflow_manager
    ->createInstance($this
    ->getWorkflowId());
  $this
    ->calculatePluginDependencies($workflow);

  // Add the logo entity as dependency if a UUID was specified.
  if ($this->logo && ($file = $this
    ->getLogoFile())) {
    $this
      ->addDependency($file
      ->getConfigDependencyKey(), $file
      ->getConfigDependencyName());
  }
  return $this;
}