/** * Magic getter. * Gets the values of the fields that require initialization. * * @param string $name Name of property that is accessed * * @return mixed Returns property value */ public function __get($name) { switch ($name) { case 'settings': if (empty($this->_settings)) { $this->_settings = new SettingsCollection('Scalr\\Tests\\Fixtures\\Model\\Entity\\TestEntitySetting', [['testEntityId' => &$this->id]], ['testEntityId' => &$this->id]); } return $this->_settings; default: return parent::__get($name); } }
/** * {@inheritdoc} * @see AbstractEntity::__get() */ public function __get($prop) { switch ($prop) { case 'metric': return $this->_metric; default: return parent::__get($prop); } }
/** * Magic getter * * @param string $name Name of property that is accessed * * @return mixed Returns property value */ public function __get($name) { switch ($name) { case 'settings': if (empty($this->_settings)) { $this->_settings = new SettingsCollection('Scalr\\Model\\Entity\\FarmSetting', [['farmId' => &$this->id]], ['farmId' => &$this->id]); } return $this->_settings; case 'farmRoles': if (empty($this->_farmRoles)) { $this->_farmRoles = FarmRole::findByFarmId($this->id); } return $this->_farmRoles; case 'servers': if (empty($this->_servers)) { $this->_servers = Server::findByFarmId($this->id); } return $this->_servers; default: return parent::__get($name); } }
/** * Magic getter. * Gets the values of the properties that require initialization. * * @param string $name Property name * * @return mixed Requested property */ public function __get($name) { switch ($name) { case 'properties': if (empty($this->_properties)) { $this->_properties = new SettingsCollection('Scalr\\Model\\Entity\\CloudCredentialsProperty', [['cloudCredentialsId' => &$this->id]], ['cloudCredentialsId' => &$this->id]); } return $this->_properties; case 'environments': if (!$this->envsLoaded) { $this->_envBinds = []; /* @var $envCloudCreds EnvironmentCloudCredentials */ foreach (EnvironmentCloudCredentials::findByCloudCredentialsId($this->id) as $envCloudCreds) { $this->_envBinds[$envCloudCreds->envId] = $envCloudCreds; } $this->envsLoaded = true; } return $this->_envBinds; default: return parent::__get($name); } }
public function __get($name) { switch ($name) { case 'settings': if (empty($this->_settings)) { $this->_settings = new SettingsCollection('Scalr\\Model\\Entity\\FarmRoleSetting', [['farmRoleId' => &$this->id]], ['farmRoleId' => &$this->id]); } return $this->_settings; case 'farm': if (empty($this->_farm) && !empty($this->farmId)) { $this->_farm = Farm::findPk($this->farmId); } return $this->_farm; case 'role': if (empty($this->_role) && !empty($this->roleId)) { $this->_role = Role::findPk($this->roleId); } return $this->_role; default: return parent::__get($name); } }
/** * Magic getter. * Gets the values of the properties that require initialization. * * @param string $name Name of property that is accessed * * @return mixed Returns property value */ public function __get($name) { switch ($name) { case 'settings': if (empty($this->_settings)) { $this->_settings = new SettingsCollection('Scalr\\Model\\Entity\\FarmRoleSetting', [['farmRoleId' => &$this->id]], ['farmRoleId' => &$this->id]); } return $this->_settings; // @deprecated // @deprecated case 'farm': if (empty($this->_farm) && !empty($this->farmId)) { $this->_farm = Farm::findPk($this->farmId); } return $this->_farm; // @deprecated // @deprecated case 'role': if (!empty($this->roleId)) { if (empty($this->_role) || $this->_role->id != $this->roleId) { $this->_role = Role::findPk($this->roleId); } } return $this->_role; case 'farmRoleMetrics': if (empty($this->_farmRoleMetrics)) { $farmRoleMetrics = []; /* @var $farmRoleMetric FarmRoleScalingMetric */ foreach (FarmRoleScalingMetric::findByFarmRoleId($this->id) as $farmRoleMetric) { $farmRoleMetrics[$farmRoleMetric->metricId] = $farmRoleMetric; } if (!empty($farmRoleMetrics)) { /* @var $metric ScalingMetric */ foreach (ScalingMetric::find([['id' => ['$in' => array_keys($farmRoleMetrics)]]]) as $metric) { /* @var $farmRoleMetric FarmRoleScalingMetric */ $farmRoleMetric = $farmRoleMetrics[$metric->id]; $farmRoleMetric->metric = $metric; $this->_farmRoleMetrics[$metric->name] = $farmRoleMetric; } } } return $this->_farmRoleMetrics; default: return parent::__get($name); } }
/** * Magic getter * * @param string $name Name of property that is accessed * * @return mixed Returns property value */ public function __get($name) { switch ($name) { case 'properties': if (empty($this->_properties)) { $this->_properties = new SettingsCollection('Scalr\\Model\\Entity\\ServerProperty', [['serverId' => &$this->serverId]], ['serverId' => &$this->serverId]); } return $this->_properties; case 'scalarizr': $this->_scalarizr = new stdClass(); // Get list of namespaces $refl = new ReflectionClass('Scalr_Net_Scalarizr_Client'); foreach ($refl->getConstants() as $c => $v) { if (substr($c, 0, 9) == 'NAMESPACE') { $this->_scalarizr->{$v} = Scalr_Net_Scalarizr_Client::getClient($this->__getDBServer(), $v, $this->getPort(self::PORT_API)); } } return $this->_scalarizr; case 'scalarizrUpdateClient': $this->_scalarizrUpdateClient = new Scalr_Net_Scalarizr_UpdateClient($this->__getDBServer(), $this->getPort(self::PORT_UPDC), \Scalr::config('scalr.system.instances_connection_timeout')); return $this->_scalarizrUpdateClient; default: return parent::__get($name); } }