I need to store the IP address of the users who comment, in the database after form submission.
Is there any symfony2 function to get the IP? Or any other way to get
For Symfony 2.6+ use the following code (within your controller:
$this->container->get('request_stack')->getCurrentRequest()->getClientIp();