Skip to content

NamingStrategy as Service #7

Description

@glassp

Unrelated (and invisible) to this PR:

I'd much rather prefer having a service that acts as a registry, which generates the naming strategies for various domain languages, so that it could be easily extended.

E.g. this code:

        $actionName = new UnicodeString($input->getOption("command-action"));
        $actionName = $actionName->camel()->title()->toString();

        if ("en" === $this->getDomainLanguage($domain)) {
            $commandNamespace = $actionName . $entity;
        }
        else {
            $commandNamespace = $entity . $actionName;
        }

would become this:

        $actionName = new UnicodeString($input->getOption("command-action"));
        
        $namingStrategy = $this->domainNamingStrategyRegistry->getForDomain($domain);
        $commandNamespace = $namingStategy->generateCommandNamespace(new DomaindNamingStategyInput($domain, $actionName, $entity));

Originally posted by @keichinger in #6 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions