public function &getReceiver() { if ($this->_receiver == null) { $this->_receiver = __ComponentFactory::getInstance()->createComponent($this->_component_spec, $this->_component_index); if ($this->_receiver != null) { foreach ($this->_properties as $property_name => &$property_value) { $setter = 'set' . ucfirst($property_name); if (method_exists($this->_receiver, $setter)) { call_user_func(array($this->_receiver, $setter), $property_value); } else { throw __ExceptionFactory::getInstance()->createException('Method not found on ' . get_class($this->_receiver) . ': ' . $setter); } } } else { throw __ExceptionFactory::getInstance()->createException('Error on lazy load: Instance represented by virtual proxy does not exists (proxy class: ' . get_class($this) . ', proxy id: ' . $this->_id . ')'); } } return $this->_receiver; }
protected function _generateRemoteServiceCode($method_name, $arguments = array()) { $component_name = $method_name; $component_handler = __ComponentHandlerManager::getInstance()->getComponentHandler($this->_event_handler->getViewCode()); //get the remote_service_writer: $remote_service_spec = __ComponentSpecFactory::getInstance()->createComponentSpec('remoteservice'); $remote_service_spec->setId(substr(md5($this->_view_code . ':' . $method_name), 0, 8)); $remote_service_writer = $remote_service_spec->getWriter(); if ($component_handler->hasComponent($component_name)) { $remote_service = $component_handler->getComponent($component_name); } else { $remote_service = __ComponentFactory::getInstance()->createComponent($remote_service_spec); $remote_service->setName($component_name); foreach ($arguments as $argument_name => $argument_value) { $remote_service->{$argument_name} = $argument_value; } $component_handler->registerComponent($remote_service); } $remote_service_writer->bindComponentToClient($remote_service); $remote_service_writer->startRender($remote_service); }