Firestore/src/WriteBatch.php
private function enqueueTransforms($document, array $transforms, array $options = [])
    {
        $operations = [];

        foreach ($transforms as $transform) {
            if (!($transform instanceof DocumentTransformInterface)) {
                continue;
            }

            $args = $transform->args();
            if (!$transform->sendRaw()) {
                if (is_array($args) && !$this->isAssoc($args)) {
                    $args = $this->valueMapper->encodeArrayValue($args);
                } else {
                    $args = $this->valueMapper->encodeValue($args);
                }
            }

            $operations[] = [
                'fieldPath' => $transform->fieldPath()->pathString(),
                $transform->key() => $args
            ];
        }

        if ($operations) {
            $this->writes[] = $this->createDatabaseWrite(self::TYPE_TRANSFORM, $document, [
                'fieldTransforms' => $operations
            ] + $options);
        }
    }
private function enqueueTransforms($document, array $transforms, array $options = [])
    {
        $operations = [];

        foreach ($transforms as $transform) {
            if (!($transform instanceof DocumentTransformInterface)) {
                continue;
            }

            $args = $transform->args();
            if (!$transform->sendRaw()) {
                if (is_array($args) && !$this->isAssoc($args)) {
                    $args = $this->valueMapper->encodeArrayValue($args);
                } else {
                    $args = $this->valueMapper->encodeValue($args);
                }
            }

            $operations[] = [
                'fieldPath' => $transform->fieldPath()->pathString(),
                $transform->key() => $args
            ];
        }

        if ($operations) {
            $this->writes[] = $this->createDatabaseWrite(self::TYPE_TRANSFORM, $document, [
                'fieldTransforms' => $operations
            ] + $options);
        }
    }
private function enqueueTransforms ( $ document , array $ transforms , array $ options = [ ] ) { $ operations = [ ] ; foreach ( $ transforms as $ transform ) { if ( ! ( $ transform instanceof DocumentTransformInterface ) ) { continue ; } $ args = $ transform -> args ( ) ; if ( ! $ transform -> sendRaw ( ) ) { if ( is_array ( $ args ) && ! $ this -> isAssoc ( $ args ) ) { $ args = $ this -> valueMapper -> encodeArrayValue ( $ args ) ; } else { $ args = $ this -> valueMapper -> encodeValue ( $ args ) ; } } $ operations [ ] = [ 'fieldPath' => $ transform -> fieldPath ( ) -> pathString ( ) , $ transform -> key ( ) => $ args ] ; } if ( $ operations ) { $ this -> writes [ ] = $ this -> createDatabaseWrite ( self :: TYPE_TRANSFORM , $ document , [ 'fieldTransforms' => $ operations ] + $ options ) ; } }
Enqueue transforms for CREATE, UPDATE, and SET calls.

@param DocumentReference|string $document The document to target, either
as a string document name, or DocumentReference object.
@param DocumentTransformInterface[] $transforms
@param array $options
@return void
Enqueue transforms for CREATE UPDATE and SET calls .