Author: sb
Date: Mon Nov 12 12:40:18 2007
New Revision: 6709

Log:
- Implement issue #11862.

Added:
    trunk/Workflow/tests/data/ServiceObjectWithArguments3_1.xml
Modified:
    trunk/Workflow/ChangeLog
    trunk/Workflow/src/definition_storage/xml.php
    trunk/Workflow/tests/definition_xml_test.php

Modified: trunk/Workflow/ChangeLog
==============================================================================
--- trunk/Workflow/ChangeLog [iso-8859-1] (original)
+++ trunk/Workflow/ChangeLog [iso-8859-1] Mon Nov 12 12:40:18 2007
@@ -1,3 +1,5 @@
+- Implemented issue #11862: Allow arrays to have automatically generated keys.
+
 1.1alpha1 - Monday 29 October 2007
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 

Modified: trunk/Workflow/src/definition_storage/xml.php
==============================================================================
--- trunk/Workflow/src/definition_storage/xml.php [iso-8859-1] (original)
+++ trunk/Workflow/src/definition_storage/xml.php [iso-8859-1] Mon Nov 12 
12:40:18 2007
@@ -511,7 +511,16 @@
 
                 foreach ( $element->getElementsByTagName( 'element' ) as 
$element )
                 {
-                    $variable[(string)$element->getAttribute ('key') ] = 
self::xmlToVariable( $element->childNodes->item( 1 ) );
+                    $value = self::xmlToVariable( $element->childNodes->item( 
1 ) );
+
+                    if ( $element->hasAttribute ( 'key' ) )
+                    {
+                        $variable[ (string)$element->getAttribute ('key') ] = 
$value;
+                    }
+                    else
+                    {
+                        $variable[] = $value;
+                    }
                 }
             }
             break;

Added: trunk/Workflow/tests/data/ServiceObjectWithArguments3_1.xml
==============================================================================
--- trunk/Workflow/tests/data/ServiceObjectWithArguments3_1.xml (added)
+++ trunk/Workflow/tests/data/ServiceObjectWithArguments3_1.xml [iso-8859-1] 
Mon Nov 12 12:40:18 2007
@@ -1,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workflow name="ServiceObjectWithArguments" version="1">
+  <node id="1" type="Start">
+    <outNode id="2"/>
+  </node>
+  <node id="2" type="Action" serviceObjectClass="ServiceObjectWithConstructor">
+    <arguments>
+      <array>
+        <element>
+          <string>Sebastian</string>
+        </element>
+      </array>
+    </arguments>
+    <outNode id="3"/>
+  </node>
+  <node id="3" type="End"/>
+</workflow>

Modified: trunk/Workflow/tests/definition_xml_test.php
==============================================================================
--- trunk/Workflow/tests/definition_xml_test.php [iso-8859-1] (original)
+++ trunk/Workflow/tests/definition_xml_test.php [iso-8859-1] Mon Nov 12 
12:40:18 2007
@@ -488,6 +488,11 @@
         $this->workflow = $this->definition->loadByName( 
'ServiceObjectWithArguments2' );
     }
 
+    public function testLoadServiceObjectWithArguments3()
+    {
+        $this->workflow = $this->definition->loadByName( 
'ServiceObjectWithArguments3' );
+    }
+
     public function testLoadNestedLoops()
     {
         $this->workflow = $this->definition->loadByName( 'NestedLoops' );


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to