Better mapping configuration

5 years ago

Budry
Member | 88
+
0
-

Hi,
I often need in bigger project use more usable mapping configuration. Two stars are not enough.

In last project I need use more complicated module structure while maintaining PSR but with actual mapping implementation it was not possible.

I think that would be better when mapping works with module and presenter name instead of stars.

  1. Use <module> and <presenter> (or any better keywords) in mapping would be better
*: App\<module>Module\<module>\Presenters\<presenter>Presenter

2) The best would be if it were possible to number the modules
Example:


Presenter: One:Two:Three:Four
Mapping: App\<module3>\<module1>\<module2>Module\<module4>
Result presenter class: App\Three\One\TwoModule\Four

I tried implement (1 and 2) into last project as test.
Example is here
My implementation is not good, but it was necessary and work with is quite good.

I would like to see something similar in nette and what are your opinoins?

Edit: module name with number was really wrong idea

Last edited by Budry (2014-06-23 18:33)

5 years ago

mishak
Member | 100
+
0
-

Custom mappers for PresenterFactory could help instead of just convention written in code. It would reduce PresenterFactory complexity and enable cheap way of changing its behaviour since nobody really wants to implement it again. It would be very simillar to DatabaseReflection concept.

Last edited by mishak (2014-06-23 16:21)

5 years ago

Budry
Member | 88
+
0
-

@mishak Custom mapper would be best. I could try create a pull, but i don't know if I right man.

5 years ago

mishak
Member | 100
+
0
-

I appreciate you trying! And don't worry people will tell you soon enough. :)