/** * Initialise from configuration instance * * @param \TechDivision\Configuration\Interfaces\ConfigurationInterface $configuration The configuration instance * * @return void */ public function initFromConfiguration(ConfigurationInterface $configuration) { // create a UUID and set the UUID of the parent node if ($configuration->getData('uuid') == null) { $this->setUuid($this->newUuid()); } else { $this->setUuid($configuration->getData('uuid')); } // set the node name from the configuration $this->setNodeName($configuration->getNodeName()); // iterate over the PROTECTED properties and initialize them with the configuration data $reflectionObject = new \ReflectionObject($this); foreach ($reflectionObject->getProperties(\ReflectionProperty::IS_PROTECTED) as $reflectionProperty) { // ONLY use PROTECTED properties, NOT PRIVATE, else UUID's will be overwritten!! $this->getValueForReflectionProperty($reflectionProperty, $configuration); } }