Commit d815f330 authored by keven's avatar keven
Browse files

Cache parent stream to avoid superfluous HTTP requests

parent 00faf4c5
......@@ -49,6 +49,13 @@ class Stream extends Entity implements StreamInterface
*/
protected $hrefParent;
/**
*
* @Exclude
* @var StreamInterface
*/
protected $_parent;
/**
*
* @param string $title
......@@ -184,12 +191,17 @@ class Stream extends Entity implements StreamInterface
/**
*
* @return \Libcast\Client\Model\StreamInterface
* @return StreamInterface
*/
public function parent()
{
if ($this->hrefParent and $this->client) {
return $this->client->stream($this->hrefParent->href);
if (!$this->_parent)
{
if ($this->hrefParent and $this->client) {
$this->_parent = $this->client->stream($this->hrefParent->href);
}
}
return $this->_parent;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment