You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: phpcr-shell/querying.rst
+44Lines changed: 44 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,13 @@ and are specific to PHPCRSH.
46
46
any updates before hand in a development environment and ensure that you
47
47
have a backup. We can take no responsibility for lost data!
48
48
49
+
50
+
.. note::
51
+
52
+
UPDATE and DELETE operations are performed in userland and are based upon
53
+
underlying SELECT operations, so any overhead incurred in an equivalent
54
+
SELECT will be the baseline for UPDATE or DELETE overheads.
55
+
49
56
Updating
50
57
--------
51
58
@@ -169,6 +176,40 @@ Arguments:
169
176
property
170
177
- **value**: Value to append
171
178
179
+
expr
180
+
""""
181
+
182
+
Evaluate an expression. This function is very powerful in that it enables
183
+
you to use the `Symfony Expression Language`_ to evaluate an expression, the
184
+
result of which can be assigned to a property.
185
+
186
+
Within the expression you have access to the `row` object
187
+
(`RowInterface`_).
188
+
189
+
Set the value of ``a.title`` to the node name:
190
+
191
+
.. code-block:: bash
192
+
193
+
PHPCRSH> UPDATE [nt:unstructured] AS a SET a.title = expr('row.getNode().getName()')
194
+
195
+
Set the value of ``a.title`` to the value of the property :
196
+
197
+
.. code-block:: bash
198
+
199
+
PHPCRSH> UPDATE [nt:unstructured] AS a SET a.title = expr('row.getNode().getProperty('some_property')')
200
+
201
+
Increment the value of a property:
202
+
203
+
.. code-block:: bash
204
+
205
+
PHPCRSH> UPDATE [nt:unstructured] AS a SET a.count = expr('row.getNode().getPropertyValue("count") + 1')
206
+
207
+
Set the value of ``a.title`` from the value of a joined node:
208
+
209
+
.. code-block:: bash
210
+
211
+
PHPCRSH> UPDATE [nt:unstructured] AS a INNER JOIN [nt:something] AS b ON a.foo = b.bar SET a.title = expr('row.getNode("b").getPropertyValue("something")')
212
+
172
213
mixin_add
173
214
"""""""""
174
215
@@ -201,3 +242,6 @@ without the column selection:
201
242
202
243
PHPCRSH > DELETE FROM [slinpTest:article] WHERE title="Home"
0 commit comments