/** * Exports to the configuration. * * @return \TechDivision\Configuration\Interfaces\ConfigurationInterface The configuraton instance */ public function exportToConfiguration() { // create a new configuration instance $configuration = new Configuration(); $configuration->setNodeName($this->getNodeName()); $configuration->setData('uuid', $this->getUuid()); // iterate over the PROTECTED properties and initialize them with the configuration data $reflectionObject = new \ReflectionObject($this); // iterate over all members and add their values to the configuration foreach ($reflectionObject->getProperties(\ReflectionProperty::IS_PROTECTED) as $reflectionProperty) { // ONLY use PROTECTED properties, NOT PRIVATE, else UUID's will be overwritten!! $this->setConfigurationByReflectionProperty($reflectionProperty, $configuration); } // return the configuration instance return $configuration; }