summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/Entity/Exception/AmbiguousEntityClassException.php
blob: 3992bba0050375b97652b3cf54b1c2baf79f8284 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

/**
 * @file
 * Contains \Drupal\Core\Entity\Exception\AmbiguousEntityClassException.
 */

namespace Drupal\Core\Entity\Exception;

/**
 * Exception thrown if multiple subclasses exist for an entity.
 *
 * This might occur if an entity is subclassed multiple times and the base
 * class is altered to use one of the subclasses instead. If a static method on
 * the base class is then invoked it is impossible to determine which of the
 * subclasses is responsible for it.
 *
 * @see hook_entity_info_alter()
 * @see \Drupal\Core\Entity\Entity::getEntityTypeFromStaticClass()
 */
class AmbiguousEntityClassException extends \Exception {

  /**
   * Constructs an AmbiguousEntityClassException.
   *
   * @param string $class
   *   The entity parent class.
   */
  public function __construct($class) {
    $message = sprintf('Multiple subclasses provide an entity type for %s.', $class);
    parent::__construct($message);
  }

}