private function matchAggregate(
        Identity $identity,
        object $entity,
        Aggregate $meta,
        MapInterface $changeset,
        Query $query
    ): Query {
        $name = $this->name->sprintf(\md5($identity->value()));
        $query = $query
            ->match(
                (string) $name,
                $meta->labels()->toPrimitive()
            )
            ->withProperty(
                $meta->identity()->property(),
                (string) $name
                    ->prepend('{')
                    ->append('_identity}')
            )
            ->withParameter(
                (string) $name->append('_identity'),
                $identity->value()
            );
        $this->variables = $this->variables->put(
            $name,
            $this->buildProperties(
                $changeset,
                $meta->properties()
            )
        );

        return $meta
            ->children()
            ->filter(static function(string $property) use ($changeset): bool {
                return $changeset->contains($property);
            })
            ->reduce(
                $query,
                function(Query $carry, string $property, Child $child) use ($changeset, $name): Query {
                    $changeset = $changeset->get($property);
                    $childName = null;
                    $relName = $name
                        ->append('_')
                        ->append($property);
                    $this->variables = $this->variables->put(
                        $relName,
                        $this->buildProperties(
                            $changeset,
                            $child->relationship()->properties()
                        )
                    );

                    if ($changeset->contains($child->relationship()->childProperty())) {
                        $childName = $relName
                            ->append('_')
                            ->append(
                                $child->relationship()->childProperty()
                            );
                        $this->variables = $this->variables->put(
                            $childName,
                            $changeset->get(
                                $child->relationship()->childProperty()
                            )
                        );
                    }

                    return $carry
                        ->match((string) $name)
                        ->linkedTo(
                            $childName ? (string) $childName : null,
                            $child->labels()->toPrimitive()
                        )
                        ->through(
                            (string) $child->relationship()->type(),
                            (string) $relName
                        );
                }
            );
    }
private function matchAggregate(
        Identity $identity,
        object $entity,
        Aggregate $meta,
        MapInterface $changeset,
        Query $query
    ): Query {
        $name = $this->name->sprintf(\md5($identity->value()));
        $query = $query
            ->match(
                (string) $name,
                $meta->labels()->toPrimitive()
            )
            ->withProperty(
                $meta->identity()->property(),
                (string) $name
                    ->prepend('{')
                    ->append('_identity}')
            )
            ->withParameter(
                (string) $name->append('_identity'),
                $identity->value()
            );
        $this->variables = $this->variables->put(
            $name,
            $this->buildProperties(
                $changeset,
                $meta->properties()
            )
        );

        return $meta
            ->children()
            ->filter(static function(string $property) use ($changeset): bool {
                return $changeset->contains($property);
            })
            ->reduce(
                $query,
                function(Query $carry, string $property, Child $child) use ($changeset, $name): Query {
                    $changeset = $changeset->get($property);
                    $childName = null;
                    $relName = $name
                        ->append('_')
                        ->append($property);
                    $this->variables = $this->variables->put(
                        $relName,
                        $this->buildProperties(
                            $changeset,
                            $child->relationship()->properties()
                        )
                    );

                    if ($changeset->contains($child->relationship()->childProperty())) {
                        $childName = $relName
                            ->append('_')
                            ->append(
                                $child->relationship()->childProperty()
                            );
                        $this->variables = $this->variables->put(
                            $childName,
                            $changeset->get(
                                $child->relationship()->childProperty()
                            )
                        );
                    }

                    return $carry
                        ->match((string) $name)
                        ->linkedTo(
                            $childName ? (string) $childName : null,
                            $child->labels()->toPrimitive()
                        )
                        ->through(
                            (string) $child->relationship()->type(),
                            (string) $relName
                        );
                }
            );
    }
private function matchAggregate ( Identity $ identity , object $ entity , Aggregate $ meta , MapInterface $ changeset , Query $ query ) : Query { $ name = $ this -> name -> sprintf ( \ md5 ( $ identity -> value ( ) ) ) ; $ query = $ query -> match ( ( string ) $ name , $ meta -> labels ( ) -> toPrimitive ( ) ) -> withProperty ( $ meta -> identity ( ) -> property ( ) , ( string ) $ name -> prepend ( '{' ) -> append ( '_identity}' ) ) -> withParameter ( ( string ) $ name -> append ( '_identity' ) , $ identity -> value ( ) ) ; $ this -> variables = $ this -> variables -> put ( $ name , $ this -> buildProperties ( $ changeset , $ meta -> properties ( ) ) ) ; return $ meta -> children ( ) -> filter ( static function ( string $ property ) use ( $ changeset ) : bool { return $ changeset -> contains ( $ property ) ; } ) -> reduce ( $ query , function ( Query $ carry , string $ property , Child $ child ) use ( $ changeset , $ name ) : Query { $ changeset = $ changeset -> get ( $ property ) ; $ childName = null ; $ relName = $ name -> append ( '_' ) -> append ( $ property ) ; $ this -> variables = $ this -> variables -> put ( $ relName , $ this -> buildProperties ( $ changeset , $ child -> relationship ( ) -> properties ( ) ) ) ; if ( $ changeset -> contains ( $ child -> relationship ( ) -> childProperty ( ) ) ) { $ childName = $ relName -> append ( '_' ) -> append ( $ child -> relationship ( ) -> childProperty ( ) ) ; $ this -> variables = $ this -> variables -> put ( $ childName , $ changeset -> get ( $ child -> relationship ( ) -> childProperty ( ) ) ) ; } return $ carry -> match ( ( string ) $ name ) -> linkedTo ( $ childName ? ( string ) $ childName : null , $ child -> labels ( ) -> toPrimitive ( ) ) -> through ( ( string ) $ child -> relationship ( ) -> type ( ) , ( string ) $ relName ) ; } ) ; }
Add match clause to match all parts of the aggregate that needs to be updated

@param MapInterface<string, mixed> $changeset
Add match clause to match all parts of the aggregate that needs to be updated