You are here

public function ResourceDecoratorBase::getPrimaryResource in RESTful 7.2

Gets the primary resource, the one that is not a decorator.

Return value

ResourceInterface The resource.

Overrides ResourceDecoratorInterface::getPrimaryResource

File

src/Plugin/resource/Decorators/ResourceDecoratorBase.php, line 44
Contains \Drupal\restful\Plugin\resource\Decorators\ResourceDecoratorBase.

Class

ResourceDecoratorBase
Class ResourceDecoratorBase.

Namespace

Drupal\restful\Plugin\resource\Decorators

Code

public function getPrimaryResource() {
  $resource = $this
    ->getDecoratedResource();
  while ($resource instanceof ResourceDecoratorInterface) {
    $resource = $resource
      ->getDecoratedResource();
  }
  return $resource;
}