Skip to content

Instantly share code, notes, and snippets.

@EclipseGc
Created April 22, 2014 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EclipseGc/11190303 to your computer and use it in GitHub Desktop.
Save EclipseGc/11190303 to your computer and use it in GitHub Desktop.
RestResourceDerivativeDecorator
<?php
class RestResourceDerivativeDecorator extends DerivativeDiscoveryDecorator {
public function __construct(DiscoveryInterface $decorated, RouteCollection $collection) {
parent::__construct($decorated);
$this->collection = $collection;
}
protected function getDerivativeFetcher($base_plugin_id, $base_definition) {
if (!isset($this->derivativeFetchers[$base_plugin_id])) {
$this->derivativeFetchers[$base_plugin_id] = FALSE;
$class = $this->getDerivativeClass($base_definition);
if ($class) {
$this->derivativeFetchers[$base_plugin_id] = new $class($base_plugin_id, $this->collection);
}
}
return $this->derivativeFetchers[$base_plugin_id] ?: NULL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment