What the heck is Criteria, Presenter, Reposiotry
Created 7 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?

ryanthompson  —  7 years ago

I will be creating videos and there is some documentation on how they work now but .. in short:

Criteria is 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.

Presenters are the same as they are in Laravel. They decorate objects with logic for presenting the object (view layer / tables / etc).

Repositories are 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 repositories are a commonplace.

All of these 100% optional but help solve various problems and organize code too.

keevitaja  —  7 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.