Changeset 15
- Timestamp:
- 08/27/06 23:09:45 (2 years ago)
- Files:
-
- trunk/XJConf/converters/ConstructorValueConverter.php (modified) (1 diff)
- trunk/examples/xml/defines-primitives.xml (modified) (1 diff)
- trunk/examples/xml/test-primitives.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/XJConf/converters/ConstructorValueConverter.php
r14 r15 53 53 try { 54 54 $refClass = new ReflectionClass($this->className); 55 $instance = $refClass->newInstance($cParams); 55 if (method_exists($refClass, 'newInstanceArgs')) { 56 $instance = $refClass->newInstanceArgs($cParams); 57 } elseif (count($cParams) == 1) { 58 $instance = $refClass->newInstance($cParams[0]); 59 } else { 60 throw new ValueConversionException('Could not create instance of "' . $this->className . '" as Reflection does not support newInstanceArgs().'); 61 } 56 62 } catch (ReflectionException $re) { 57 63 throw new ValueConversionException('Could not create instance of "' . $this->className . '": ' . $re->getMessage()); trunk/examples/xml/defines-primitives.xml
r14 r15 4 4 5 5 <tag name="color" type="ColorPrimitives"> 6 <constructor><cdata type="string"/></constructor> 6 7 <attribute name="red" type="int"/> 7 8 <attribute name="green" type="int"/> trunk/examples/xml/test-primitives.xml
r14 r15 4 4 <bool id="bool">true</bool> 5 5 6 <color red="100" green="50" blue="20" />6 <color red="100" green="50" blue="20">My color</color> 7 7 </configuration>
