What the heck is Criteria, Presenter, ReposiotryCreated 6 years ago by keevitaja
And how do they all work in custom modules and templates.
If i create a new plugin, lets call it News, then what should this news() twig plugin have to return, that all these gadgets would work?
keevitaja — 6 years ago
Yeah... but i still do not understand, how are all these patterns supposed to work in modules.
I have a module News with a twig plugin news(). Now what should this plugin return, to get these criterias and presenters working?
So the result should be simalar as i would have used the entries plugin, only that it uses my modules decorators and criterias too.
I will be creating videos and there is some documentation on how they work now but .. in short:
Criteriais a class system that let's you configure and interact with objects in the view layer. Like defining properties for a builder and then the criterial builds the object for you to use.
Presentersare the same as they are in Laravel. They decorate objects with logic for presenting the object (view layer / tables / etc).
Repositoriesare another standard pattern that help keep database logic out of your model. Pyro encourages treating models as entities but it doesn't limit the use. So
repositoriesare a commonplace.
All of these 100% optional but help solve various problems and organize code too.