1

I have one doubt, I know the (Symfony2) controller's function and so I think is not correct to declare variables inside of these classes. But is possible?

In this way I could have one variable in all methods keeping its state.

Thanks.

2
  • That's the convention, so yes, it's perfectly right to do the logic within a controller. Commented Feb 5, 2013 at 9:48
  • Thanks you too. As in most examples I had not seen declare variables inside of Controllers I had not clear this question. But for concepts I supposed that it could be correct. Thanks to all for clear my mind!! Commented Feb 5, 2013 at 10:02

1 Answer 1

1

Yes, it is possible and correct.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.