Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to define routing in Symfony2

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 330
    Comment on it

    Hello Friends,

    If you are looking to implement routing in symfony2, like I have created a new controller like "listAction" in my controller file and now want to run this on browser. My controller file look like

    <?php
    
    
    namespace App\CamTaxsettingBundle\Controller;
    use App\CamTaxsettingBundle\Form\WorkflowForm;
    use Symfony\Bundle\FrameworkBundle\Controller\Controller;
    use Symfony\Component\HttpFoundation\Request;
    use Symfony\Component\HttpFoundation\Response;
    use Symfony\Component\Form\FormBuilderInterface;
    use Symfony\Component\Filesystem\Filesystem;
    
    class TaxsettingController extends Controller
    {
    
    public function listAction(){
    
    echo "routing is working fine";
    
    die;
    
    }
    
    }

     

    Now I did open my_project_name/app/config/routing.yml and add the below code::

    app_cam_taxsetting_list:
        path: /taxsetting/list/{status}
        defaults:
            _controller: AppCamTaxsettingBundle:Taxsetting:list
            status: inreview
            step: null
        requirements:
            status: inreview|accepted|declined|notcompleted|itinverify
            step: null|complete

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: