Skip to content

Commit

Permalink
Added to Mapping class isFilteringIncludedResources method
Browse files Browse the repository at this point in the history
  • Loading branch information
nilportugues committed Dec 6, 2015
1 parent 7e23933 commit 07041a0
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/Mapping/Mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ class Mapping
/**
* @var array
*/
private $included = [];
private $includedKeys = [];

/**
* @var bool
*/
private $filteringIncluded = false;

/**
* @param $className
Expand Down Expand Up @@ -378,14 +383,15 @@ public function getCuries()
return $this->curies;
}


/**
* Used by JSON API included resource filtering.
*
* @param $resource
*/
public function addIncludedResource($resource)
{
$this->included[] = $resource;
public function addIncludedResource($resource) {

$this->includedKeys[] = $resource;
}

/**
Expand All @@ -395,7 +401,16 @@ public function addIncludedResource($resource)
*/
public function getIncludedResources()
{
return $this->included;
return $this->includedKeys;
}


/**
* @param bool $filtering
*/
public function filteringIncludedResources($filtering = true)
{
$this->filteringIncluded = $filtering;
}

/**
Expand All @@ -405,6 +420,6 @@ public function getIncludedResources()
*/
public function isFilteringIncludedResources()
{
return (empty($this->included)) ? false : true;
return $this->filteringIncluded;
}
}

0 comments on commit 07041a0

Please sign in to comment.