Skip to content

Commit

Permalink
[BUGFIX] Use the decorator to get metadata
Browse files Browse the repository at this point in the history
In the decorated resource, use the subject to get the underlying
metadata information.
  • Loading branch information
Mateu Aguiló Bosch committed Feb 15, 2016
1 parent c93e064 commit 162251e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
11 changes: 1 addition & 10 deletions src/Plugin/resource/DataProvider/CacheDecoratedDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ class CacheDecoratedDataProvider implements CacheDecoratedDataProviderInterface
*/
protected $cacheController;

/**
* Array of metadata. Use this as a mean to pass info to the render layer.
*
* @var ArrayCollection
* Key value store.
*/
protected $metadata;

/**
* Constructs a CacheDecoratedDataProvider object.
*
Expand All @@ -54,7 +46,6 @@ class CacheDecoratedDataProvider implements CacheDecoratedDataProviderInterface
public function __construct(DataProviderInterface $subject, \DrupalCacheInterface $cache_controller) {
$this->subject = $subject;
$this->cacheController = $cache_controller;
$this->metadata = new ArrayCollection();
}

/**
Expand Down Expand Up @@ -274,7 +265,7 @@ public function getResourcePath() {
* {@inheritdoc}
*/
public function getMetadata() {
return $this->metadata;
return $this->subject->getMetadata();
}

/**
Expand Down
8 changes: 5 additions & 3 deletions src/Plugin/resource/DataProvider/DataProviderNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

namespace Drupal\restful\Plugin\resource\DataProvider;


use Drupal\restful\Exception\BadRequestException;

/**
* Class DataProviderNode.
*
* @package Drupal\restful\Plugin\resource\DataProvider
*/
class DataProviderNode extends DataProviderEntity implements DataProviderInterface {

/**
Expand Down

0 comments on commit 162251e

Please sign in to comment.