87 function handle($properties, callable $callback) {
90 foreach ((array)$properties as $propertyName) {
92 if (array_key_exists($propertyName, $this->mutations) && !isset($this->result[$propertyName])) {
94 $usedProperties[] = $propertyName;
96 $this->result[$propertyName] = 202;
102 if (!$usedProperties) {
105 $this->propertyUpdateCallbacks[] = [
109 is_string($properties) ? $properties : $usedProperties,
131 foreach ($properties as $propertyName) {
133 $this->result[$propertyName] = 202;
135 $this->propertyUpdateCallbacks[] = [
152 foreach ((array)$properties as $propertyName) {
153 $this->result[$propertyName] = $resultCode;
156 if ($resultCode >= 400) {
157 $this->failed =
true;
187 foreach ($this->mutations as $propertyName => $propValue) {
188 if (!isset($this->result[$propertyName])) {
207 foreach ($this->mutations as $propertyName => $propValue) {
208 if (!isset($this->result[$propertyName])) {
228 foreach ($this->mutations as $propertyName => $value) {
230 if (!isset($this->result[$propertyName])) {
231 $this->failed =
true;
232 $this->result[$propertyName] = 403;
237 foreach ($this->propertyUpdateCallbacks as $callbackInfo) {
242 if (is_string($callbackInfo[0])) {
243 $this->doCallbackSingleProp($callbackInfo[0], $callbackInfo[1]);
245 $this->doCallbackMultiProp($callbackInfo[0], $callbackInfo[1]);
256 foreach ($this->result as $propertyName => $status) {
257 if ($status === 202) {
259 $this->result[$propertyName] = 424;
278 $result = $callback($this->mutations[$propertyName]);
281 if (is_null($this->mutations[$propertyName])) {
296 $this->result[$propertyName] =
$result;
298 $this->failed =
true;
313 foreach ($propertyList as $propertyName) {
314 $argument[$propertyName] = $this->mutations[$propertyName];
317 $result = $callback($argument);
320 foreach ($propertyList as $propertyName) {
321 if (!isset(
$result[$propertyName])) {
324 $resultCode =
$result[$propertyName];
326 if ($resultCode >= 400) {
327 $this->failed =
true;
329 $this->result[$propertyName] = $resultCode;
335 foreach ($argument as $propertyName => $propertyValue) {
336 $this->result[$propertyName] = is_null($propertyValue) ? 204 : 200;
341 $this->failed =
true;
342 foreach ($propertyList as $propertyName) {
343 $this->result[$propertyName] = 403;
doCallBackSingleProp($propertyName, callable $callback)
Executes a property callback with the single-property syntax.
This class represents a set of properties that are going to be updated.
if($state['core:TerminatedAssocId'] !==null) $remaining
setRemainingResultCode($resultCode)
Sets the result code for all properties that did not have a result yet.
doCallBackMultiProp(array $propertyList, callable $callback)
Executes a property callback with the multi-property syntax.
setResultCode($properties, $resultCode)
Sets the result code for one or more properties.
handle($properties, callable $callback)
Call this function if you wish to handle updating certain properties.
getRemainingMutations()
Returns the list of properties that don't have a result code yet.
getResult()
Returns the result of the operation.
getMutations()
Returns the full list of mutations.
handleRemaining(callable $callback)
Call this function if you wish to handle all properties that haven't been handled by anything else ye...
getRemainingValues()
Returns the list of properties that don't have a result code yet.
commit()
Performs the actual update, and calls all callbacks.
__construct(array $mutations)
Constructor.