I want to use “getpoll” ,which is action of users controller ,in another controller(events controller).
How can i use it?
in advance thanks…to all…
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.
You should write the db query of the
getPoll()action as a method in the poll model, that way in your user controller you can just call$this->User->Poll->getPolls()to grab the polls, and if associations are setup correctly,$this->Event->Poll->getPolls()from your events controller.For example in your poll model: