def register_command(rel_name, type, meta, parent_relation = nil)
      relation = relations[rel_name]

      type.create_class(rel_name, type) do |klass|
        klass.result(meta.fetch(:combine_type, result))

        if meta[:combine_type]
          setup_associates(klass, relation, meta, parent_relation)
        end

        plugins.each do |plugin|
          plugin_options = plugins_options.fetch(plugin) { EMPTY_HASH }
          klass.use(plugin, plugin_options)
        end

        gateway = gateways[relation.gateway]

        notifications.trigger(
          'configuration.commands.class.before_build',
          command: klass, gateway: gateway, dataset: relation.dataset, adapter: adapter
        )

        klass.extend_for_relation(relation) if klass.restrictable

        registry[rel_name][type] = klass.build(relation, input: relation.input_schema)
      end
    end
def register_command(rel_name, type, meta, parent_relation = nil)
      relation = relations[rel_name]

      type.create_class(rel_name, type) do |klass|
        klass.result(meta.fetch(:combine_type, result))

        if meta[:combine_type]
          setup_associates(klass, relation, meta, parent_relation)
        end

        plugins.each do |plugin|
          plugin_options = plugins_options.fetch(plugin) { EMPTY_HASH }
          klass.use(plugin, plugin_options)
        end

        gateway = gateways[relation.gateway]

        notifications.trigger(
          'configuration.commands.class.before_build',
          command: klass, gateway: gateway, dataset: relation.dataset, adapter: adapter
        )

        klass.extend_for_relation(relation) if klass.restrictable

        registry[rel_name][type] = klass.build(relation, input: relation.input_schema)
      end
    end
Build a command object for a specific relation

 The command will be prepared for handling associations if it's a combined
 relation. Additional plugins will be enabled if they are configured for
 this compiler.

 @param [Symbol] rel_name A relation identifier from the container registry
 @param [Symbol] type The command type
 @param [Hash] meta Meta information from relation AST
 @param [Symbol] parent_relation Optional parent relation identifier

 @return [ROM::Command]

 @api private