Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration to set ignored classes for defaultControl/Presenter resolvers #83

Open
MartinMystikJonas opened this issue Nov 30, 2022 · 9 comments
Assignees

Comments

@MartinMystikJonas
Copy link
Collaborator

No description provided.

@MartinMystikJonas MartinMystikJonas changed the title Configuration to set ignored vlasses for defaultControl/Presenter resolvers Configuration to set ignored classes for defaultControl/Presenter resolvers Dec 3, 2022
@MartinMystikJonas
Copy link
Collaborator Author

I just stubled upon need for this while writing custom resolvers. SO I will implement it. Whad do you think a out this format

latte:
    customResolve:
        - App/Components/BaseControl

Alternative names: customResolveClasses, skipDefaultResolve, skipDefaultResolveClasses, excludeDefaultResolve, excludeDefaultResolveClasses.

Any better idea?

@MartinMystikJonas MartinMystikJonas self-assigned this Dec 9, 2022
@lulco
Copy link
Contributor

lulco commented Dec 9, 2022

I think we should somehow create priorities for resolvers and each class should be resolved with only one resolver (as it was before). So all your custom resolvers will run first and then our default at the end (I think presenters first then controls). What do you think?

@MartinMystikJonas
Copy link
Collaborator Author

You can have multiple resolvers matching single class. As we already have one for presenter actions and another for presenter standalone templates. Similar to it I have custom resolver written for standalone control templates (our base control have default template file mechanism) but I also want to use default control resolver.

@MartinMystikJonas
Copy link
Collaborator Author

Maybe make resolver-template pair unique? But I am not sure how well it would work in other use cases

@MartinMystikJonas
Copy link
Collaborator Author

Or maybe make it part of resolver interface? So resolver can say whether other resolvers should try to resolve this class/node or if resolving is finished.

@MartinMystikJonas
Copy link
Collaborator Author

Or maybe another way. Resolver can implement method that allow it to can say it is authoritative for given classes. If resolver is authoritative then it replaces default resolvers.

@lulco
Copy link
Contributor

lulco commented Dec 9, 2022

I don’t know really :) I have to try it on some of our projects where it will be needed. Just don’t have enough time for it now.

maybe something like:

latte:
    resolvers:
        exclude:
            ResolverClassName: # classname of resolver to setup
                - ClassName::methodName # exact method from class
                - ClassName2::* # all methods from class
                - ClassName3::somePattern* # methods with name matching pattern

@MartinMystikJonas
Copy link
Collaborator Author

Like the idea of configuration per resolver. Also this could be a way to register resolvers. Not directly as services but as configuration that would be handled by some ResolversRegistry. It would aslo simplify adding resolvers. When used as service it has to be added by CLI option - - autoload-file. This was it could be added by config parameter bootstrapFiles I think.

@lulco
Copy link
Contributor

lulco commented Jan 25, 2023

I felt into this issue today, but I don’t need it at the end.

I have so called "plugins" in my apps. They are extended Controls with specialized method templatePath() which returns string - path to latte template.

First I've create whole new resolver but then these plugins were processed twice. Then I realize I need only PathCollector.

Same thing happens to me with components. All “global plugins” are components of each other plugin. Solved with custom ComponentsCollector.

So for now I solved everything with custom collectors.

If I will have some classes which are not resolved with built-in resolvers I'll create new one. It means there should not be any conflict. Each class will be resolved by one resolver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants