You are here

public function WSServer::__construct in Web Service Data 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/WSServer.php \Drupal\wsdata\Entity\WSServer::__construct()

Constructs an Entity object.

Parameters

array $values: An array of values to set, keyed by property name. If the entity type has bundles, the bundle key has to be specified.

string $entity_type: The type of the entity to create.

Overrides ConfigEntityBase::__construct

File

src/Entity/WSServer.php, line 71

Class

WSServer
Defines the Web Service Server entity.

Namespace

Drupal\wsdata\Entity

Code

public function __construct(array $values, $entity_type) {
  parent::__construct($values, $entity_type);
  $this->state = \Drupal::state()
    ->get('wsdata.wsserver.' . $this->id, []);
  $this->overrides = [];

  // Allow the state to override the configured endpoint.
  $this
    ->setEndpoint($this->endpoint);
  $wsconnectorman = \Drupal::service('plugin.manager.wsconnector');
  $wscdefs = $wsconnectorman
    ->getDefinitions();
  if (isset($wscdefs[$this->wsconnector])) {
    $this->wsconnectorInst = $wsconnectorman
      ->createInstance($this->wsconnector);
    $this->wsconnectorInst
      ->setEndpoint($this->endpoint);
  }
}