Skip to content

Using trait to eliminate duplication? #178

@asakurayoh

Description

@asakurayoh

The pull request #176 has duplicated the 3 method from the AbstractController in each controller.

This could be mitigated by creating 2 traits: TranslatedErrorFlashMessage (for the getErrorFlashMessage method) and BlogAdminAccess (for the hasBlogAdminAccess and checkBlogAdminAccess methods).

That would apply the Composition over Inheritance principle.

I suppose it would need Interface to fit them, per https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/PhpArchitecture/Traits.html

Hum... Reading the doc, maybe the BlogAdminAccess trait should be a Service... BlogAccessService?

All in all, I don't like the duplicated code XD

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