@@ -44,6 +44,7 @@ public function __construct()
44
44
'array_append ' => function ($ operand , $ v , $ x ) {
45
45
$ operand ->validateScalarArray ($ v );
46
46
$ v [] = $ x ;
47
+
47
48
return $ v ;
48
49
},
49
50
'array ' => function () {
@@ -85,45 +86,20 @@ public function __construct()
85
86
public function updateNode (RowInterface $ row , $ propertyData )
86
87
{
87
88
$ node = $ row ->getNode ($ propertyData ['selector ' ]);
88
-
89
- if ($ node ->hasProperty ($ propertyData ['name ' ])) {
90
- $ value = $ this ->handleExisting ($ row , $ node , $ propertyData );
91
- } else {
92
- $ value = $ propertyData ['value ' ];
93
- }
94
-
95
- $ node ->setProperty ($ propertyData ['name ' ], $ value );
96
- }
97
-
98
- private function handleExisting ($ row , $ node , $ propertyData )
99
- {
100
- $ phpcrProperty = $ node ->getProperty ($ propertyData ['name ' ]);
101
89
$ value = $ propertyData ['value ' ];
102
90
103
91
if ($ value instanceof FunctionOperand) {
104
- return $ this ->handleFunction ($ row, $ node , $ phpcrProperty , $ propertyData );
92
+ $ value = $ this ->handleFunction ($ row , $ propertyData );
105
93
}
106
94
107
- return $ value ;
95
+ $ node -> setProperty ( $ propertyData [ ' name ' ], $ value) ;
108
96
}
109
97
110
- private function handleFunction ($ row , $ node , $ phpcrProperty , $ propertyData )
98
+ private function handleFunction ($ row , $ propertyData )
111
99
{
112
- $ currentValue = $ phpcrProperty ->getValue ();
113
100
$ value = $ propertyData ['value ' ];
114
-
115
101
$ value = $ value ->execute ($ this ->functionMap , $ row );
116
102
117
- if ($ phpcrProperty ->isMultiple ()) {
118
- // do not allow updating multivalue with scalar
119
- if (false === is_array ($ value ) && sizeof ($ currentValue ) > 1 ) {
120
- throw new \InvalidArgumentException (sprintf (
121
- '<error>Cannot update multivalue property "%s" with a scalar value.</error> ' ,
122
- $ phpcrProperty ->getName ()
123
- ));
124
- }
125
- }
126
-
127
103
return $ value ;
128
104
}
129
105
}
0 commit comments