|
|
@ -22,11 +22,10 @@ namespace yii\caching; |
|
|
|
class ChainedDependency extends Dependency |
|
|
|
class ChainedDependency extends Dependency |
|
|
|
{ |
|
|
|
{ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @var array list of dependencies that this dependency is composed of. |
|
|
|
* @var Dependency[] list of dependencies that this dependency is composed of. |
|
|
|
* Each array element should be a dependency object or a configuration array |
|
|
|
* Each array element must be a dependency object. |
|
|
|
* that can be used to create a dependency object via [[\Yii::createObject()]]. |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public $dependencies = array(); |
|
|
|
public $dependencies; |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @var boolean whether this dependency is depending on every dependency in [[dependencies]]. |
|
|
|
* @var boolean whether this dependency is depending on every dependency in [[dependencies]]. |
|
|
|
* Defaults to true, meaning if any of the dependencies has changed, this dependency is considered changed. |
|
|
|
* Defaults to true, meaning if any of the dependencies has changed, this dependency is considered changed. |
|
|
@ -37,9 +36,8 @@ class ChainedDependency extends Dependency |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Constructor. |
|
|
|
* Constructor. |
|
|
|
* @param array $dependencies list of dependencies that this dependency is composed of. |
|
|
|
* @param Dependency[] $dependencies list of dependencies that this dependency is composed of. |
|
|
|
* Each array element should be a dependency object or a configuration array |
|
|
|
* Each array element should be a dependency object. |
|
|
|
* that can be used to create a dependency object via [[\Yii::createObject()]]. |
|
|
|
|
|
|
|
* @param array $config name-value pairs that will be used to initialize the object properties |
|
|
|
* @param array $config name-value pairs that will be used to initialize the object properties |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function __construct($dependencies = array(), $config = array()) |
|
|
|
public function __construct($dependencies = array(), $config = array()) |
|
|
@ -54,9 +52,6 @@ class ChainedDependency extends Dependency |
|
|
|
public function evaluateDependency() |
|
|
|
public function evaluateDependency() |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach ($this->dependencies as $dependency) { |
|
|
|
foreach ($this->dependencies as $dependency) { |
|
|
|
if (!$dependency instanceof Dependency) { |
|
|
|
|
|
|
|
$dependency = \Yii::createObject($dependency); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$dependency->evaluateDependency(); |
|
|
|
$dependency->evaluateDependency(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -79,10 +74,7 @@ class ChainedDependency extends Dependency |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getHasChanged() |
|
|
|
public function getHasChanged() |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach ($this->dependencies as $i => $dependency) { |
|
|
|
foreach ($this->dependencies as $dependency) { |
|
|
|
if (!$dependency instanceof Dependency) { |
|
|
|
|
|
|
|
$this->dependencies[$i] = $dependency = \Yii::createObject($dependency); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($this->dependOnAll && $dependency->getHasChanged()) { |
|
|
|
if ($this->dependOnAll && $dependency->getHasChanged()) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} elseif (!$this->dependOnAll && !$dependency->getHasChanged()) { |
|
|
|
} elseif (!$this->dependOnAll && !$dependency->getHasChanged()) { |
|
|
|