Question about controllers.
Can controller call it`s own class methods inside an action?
EDIT:
Oh sorry. I meant I dont want to repeat myself. 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Why not?
It’s all up to you, but I really don’t see the reason to avoid DRY ( LOL ). The sense of MVC is to have separated controller / model / view, nothing else 🙂
EDIT:
Still yes, controller can call it’s own methods inside of actions. Good practice would be to give action methods names like action_something or something_action, and have a ‘base’ controller which you’d extend later. Like;
where the first one would be some kind of ‘abstraction’ (framework-oriented) and others would take care of application logics. So later you’d have …
depending on what you want to use certain controller for.
It’s all up to you; you can put your own methods where ever you want to and call them from where ever you want to 🙂