public function WsConfig::__construct in Web Service Data 7
Overrides Entity::__construct
File
- modules/
wsconfig/ wsconfig.entity.inc, line 20 - Entity classes
Class
- WsConfig
- The class used for wsconfig entities
Code
public function __construct($values = array()) {
parent::__construct($values, 'wsconfig');
$this->wsconfig_type = wsconfig_type_load($this->type);
if (isset($this->wsconfig_type->data['connector']) and class_exists($this->wsconfig_type->data['connector'])) {
$this->connector = new $this->wsconfig_type->data['connector']($this->wsconfig_type
->getEndpoint());
// Configure connector with caching settings.
if ($this->connector
->supportsCaching()) {
if (is_string($this->data)) {
$data = unserialize($this->data);
}
else {
$data = $this->data;
}
$cache_default_time = isset($data['cache_default_time']) ? $data['cache_default_time'] : 0;
$cache_default_override = isset($data['cache_default_override']) ? $data['cache_default_override'] : FALSE;
$stale_cache = isset($data['stale_cache']) ? $data['stale_cache'] : FALSE;
$this->connector
->defaultCache($cache_default_time, $cache_default_override, $stale_cache);
}
}
}