You are here

public function ResourceManager::__construct in RESTful 7.2

Constructor for ResourceManager.

Parameters

RequestInterface $request: The request object.

ResourcePluginManager $manager: The plugin manager.

File

src/Resource/ResourceManager.php, line 49
Contains \Drupal\restful\Resource\ResourceManager.

Class

ResourceManager

Namespace

Drupal\restful\Resource

Code

public function __construct(RequestInterface $request, ResourcePluginManager $manager = NULL) {
  $this->request = $request;
  $this->pluginManager = $manager ?: ResourcePluginManager::create('cache', $request);
  $options = array();
  foreach ($this->pluginManager
    ->getDefinitions() as $plugin_id => $plugin_definition) {

    // Set the instance id to articles::1.5 (for example).
    $options[$plugin_id] = $plugin_definition;
  }
  $this->plugins = new ResourcePluginCollection($this->pluginManager, $options);
}