Changeset 16

Show
Ignore:
Timestamp:
08/27/06 23:14:29 (2 years ago)
Author:
schst
Message:

Do not call setters for children, that have been used in the constructor.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/XJConf/converters/AbstractObjectValueConverter.php

    r14 r16  
    99 */ 
    1010abstract class AbstractObjectValueConverter implements ValueConverter { 
    11  
    1211 
    1312    /** 
     
    4544     * @throws  ValueConversionException 
    4645     */ 
    47     protected function addChildrenToValue(Tag $tag, Definition $def, $instance) { 
     46    protected function addChildrenToValue(Tag $tag, Definition $def, $instance, $ignore = array()) { 
    4847        // traverse all children 
    4948        $children = $tag->getChildren(); 
     
    5251        } 
    5352 
    54 //        $ignore = $tag->get->constructor->getUsedChildrenNames(); 
    55         $ignore = array(); 
    5653        $class  = new ReflectionClass($this->getType()); 
    57  
    5854        foreach ($children as $child) { 
    5955            if (in_array($child->getName(), $ignore) == true) { 
    6056                continue; 
    6157            } 
    62  
    6358            try { 
    6459                $class->getMethod($child->getSetterMethod())->invoke($instance, $child->getConvertedValue()); 
  • trunk/XJConf/converters/ConstructorValueConverter.php

    r15 r16  
    6868            $this->addAttributesToValue($tag, $def, $instance); 
    6969        } 
    70                $this->addChildrenToValue($tag, $def, $instance); 
     70        $this->addChildrenToValue($tag, $def, $instance, $constructor->getUsedChildrenNames()); 
    7171 
    7272        return $instance;