original_string: private function queryFor(MapInterface $entities): Query
      {
          $query = new Query\Query;
          $this->variables = new Stream('string');
  
          $partitions = $entities->partition(function(Identity $identity, object $entity): bool {
              $meta = ($this->metadata)(\get_class($entity));
  
              return $meta instanceof Aggregate;
          });
          $query = $partitions
              ->get(true)
              ->reduce(
                  $query,
                  function(Query $carry, Identity $identity, object $entity): Query {
                      return $this->createAggregate($identity, $entity, $carry);
                  }
              );
          $query = $partitions
              ->get(false)
              ->reduce(
                  $query,
                  function(Query $carry, Identity $identity, object $entity): Query {
                      return $this->createRelationship($identity, $entity, $carry);
                  }
              );
          $this->variables = null;
  
          return $query;
      }
code: private function queryFor(MapInterface $entities): Query
      {
          $query = new Query\Query;
          $this->variables = new Stream('string');
  
          $partitions = $entities->partition(function(Identity $identity, object $entity): bool {
              $meta = ($this->metadata)(\get_class($entity));
  
              return $meta instanceof Aggregate;
          });
          $query = $partitions
              ->get(true)
              ->reduce(
                  $query,
                  function(Query $carry, Identity $identity, object $entity): Query {
                      return $this->createAggregate($identity, $entity, $carry);
                  }
              );
          $query = $partitions
              ->get(false)
              ->reduce(
                  $query,
                  function(Query $carry, Identity $identity, object $entity): Query {
                      return $this->createRelationship($identity, $entity, $carry);
                  }
              );
          $this->variables = null;
  
          return $query;
      }
code_tokens: private function queryFor ( MapInterface $ entities ) : Query { $ query = new Query \ Query ; $ this -> variables = new Stream ( 'string' ) ; $ partitions = $ entities -> partition ( function ( Identity $ identity , object $ entity ) : bool { $ meta = ( $ this -> metadata ) ( \ get_class ( $ entity ) ) ; return $ meta instanceof Aggregate ; } ) ; $ query = $ partitions -> get ( true ) -> reduce ( $ query , function ( Query $ carry , Identity $ identity , object $ entity ) : Query { return $ this -> createAggregate ( $ identity , $ entity , $ carry ) ; } ) ; $ query = $ partitions -> get ( false ) -> reduce ( $ query , function ( Query $ carry , Identity $ identity , object $ entity ) : Query { return $ this -> createRelationship ( $ identity , $ entity , $ carry ) ; } ) ; $ this -> variables = null ; return $ query ; }
docstring: Build the whole cypher query to insert at once all new nodes and relationships
  
  @param MapInterface<Identity, object> $entities
docstring_tokens: Build the whole cypher query to insert at once all new nodes and relationships