i have a doubt about separate classes forms
- Majkl578
- Moderator | 1364
There is nice article on the forum, sadly only in czech, but concept should be clear.
What about components and control? There say that i can make forms as components but i dont undertand it.
That probably means you can encapsulate a form within a control, e.g. you create LoginControl which contains only form definition and form rendering. Simply put, something like:
- Majkl578
- Moderator | 1364
Jan Endel wrote:
Can @Majkl578 describe me, why is extending form class antipatern?
Yes. It is an abuse of inheritance. Inheritance in OOP should extend
functionality in terms of behavior. Similar situation – would you extend
DateTime to set current time and time zone?
But please, read the referenced topic first before starting offtopic here.
- alnux
- Member | 139
Majkl578 wrote:
Jan Endel wrote:
Can @Majkl578 describe me, why is extending form class antipatern?
Yes. It is an abuse of inheritance. Inheritance in OOP should extend functionality in terms of behavior. Similar situation – would you extend DateTime to set current time and time zone?
But please, read the referenced topic first before starting offtopic here.
Now i understand your point, that is the way why david develop that (in the post you suggest me) ja ja ja the way that Jan Endel suggest is more easy (by the way thanks too to Jan Endel)
- alnux
- Member | 139
Majkl578 wrote:
Felix wrote:
Extends form is not antipattern in case of adding new inputs/controls, behaviour etc.
Missed your comment – yes, of course, if you are adding new such methods, then yes. But not building form within itself.
Majkl578 i solved it based on david topic bu calling just one service to many Forms. It for all developers that want do the same.
config.neon
FormContainer.php
HomePresenter.php calling example
LoginForm.php
and finally BaseForm.php
Last edited by alnux (2014-06-23 00:25)