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: README.md
+19
Original file line number
Diff line number
Diff line change
@@ -209,6 +209,25 @@ class SynchronizedFieldTask extends \Aternos\Taskmaster\Task\Task
209
209
210
210
The result of this task is `6` because the `counter` property is synchronized and increased on both sides.
211
211
212
+
### Serialization in other classes
213
+
The [`OnParent`](src/Task/OnParent.php), [`OnChild`](src/Task/OnChild.php) and [`OnBoth`](src/Task/OnBoth.php)
214
+
attributes are only available in your [`Task`](src/Task/Task.php) class. If other objects are serialized but
215
+
contain properties that should not be serialized, you can use the
216
+
[`SerializationTrait`](src/Communication/Serialization/SerializationTrait.php) in your class
217
+
and then add the [`Serializable`](src/Communication/Serialization/Serializable.php) or [`NotSerializable`](src/Communication/Serialization/NotSerializable.php)
218
+
attributes to your properties.
219
+
220
+
You can use the [`Serializable`](src/Communication/Serialization/Serializable.php) attribute to mark properties that should be serialized.
221
+
When using only the [`Serializable`](src/Communication/Serialization/Serializable.php) attribute, all properties that are not marked with the
222
+
[`Serializable`](src/Communication/Serialization/Serializable.php) attribute will be ignored.
223
+
224
+
You can use the [`NotSerializable`](src/Communication/Serialization/NotSerializable.php) attribute to mark properties that should not be serialized.
225
+
When using only the [`NotSerializable`](src/Communication/Serialization/NotSerializable.php) attribute, all properties that are not marked with the
226
+
[`NotSerializable`](src/Communication/Serialization/NotSerializable.php) attribute will be serialized.
227
+
228
+
When using both attributes, all properties **must** be marked with either the [`Serializable`](src/Communication/Serialization/Serializable.php)
229
+
or [`NotSerializable`](src/Communication/Serialization/NotSerializable.php) attribute, otherwise an exception will be thrown.
230
+
212
231
### Handling the result
213
232
214
233
The `Task::handleResult()` function is called when the task returns a value. It can be used to handle
0 commit comments