/**
* Load cache models from xml mapping.
* @param SimpleXmlElement cache node.
*/
protected function loadCacheModel($node)
{
$cacheModel = new TSqlMapCacheModel();
$properties = array('id', 'implementation');
foreach ($node->attributes() as $name => $value) {
if (in_array(strtolower($name), $properties)) {
$cacheModel->{'set' . $name}((string) $value);
}
}
$cache = Prado::createComponent($cacheModel->getImplementationClass(), $cacheModel);
$this->setObjectPropFromNode($cache, $node, $properties);
foreach ($node->xpath('property') as $propertyNode) {
$name = $propertyNode->attributes()->name;
if ($name === null || $name === '') {
continue;
}
$value = $propertyNode->attributes()->value;
if ($value === null || $value === '') {
continue;
}
if (!TPropertyAccess::has($cache, $name)) {
continue;
}
TPropertyAccess::set($cache, $name, $value);
}
$this->loadFlushInterval($cacheModel, $node);
$cacheModel->initialize($cache);
$this->_manager->addCacheModel($cacheModel);
foreach ($node->xpath('flushOnExecute') as $flush) {
$this->loadFlushOnCache($cacheModel, $node, $flush);
}
}