English 中文(简体)
缩略语
原标题:symfony2 routing issue

Okay,因此,我有一个实体,有 cr,创造了权利......,它给我提供了实体的篡改文件......。

在“午餐”档案中,我指明了一条路线,例如:

manager_agentview:
    pattern: /manager/{id}/view
    defaults: { _controller: "EcsCrmBundle:Management:agentview" }

...... 然而,该网页的内容是一份清单......

我的职责就是:

public function agentviewAction($id, $start = null, $end = null) {
        $em = $this->getDoctrine()->getEntityManager();
        $request = $this->getRequest();
            $today = time();
            echo $end;
            if ($end == null) {
                if (date( l ) == "Saturday") { $end = date("Y-m-d 23:59:59"); } else { $end = date("Y-m-d 23:59:59", strtotime( next saturday , $today)); }
            }
            if ($start == null) {
                if (date( l ) == "Sunday") { $start = date( Y-m-d 00:00:00 ); } else { $start = date( Y-m-d 00:00:00 , strtotime( last sunday , $today)); }
            }
            $entities = $em->getRepository( EcsCrmBundle:TimeClock );
            $query = $entities->createQueryBuilder( t );
            $query = $query->select( t )
                  ->where( t.daydate BETWEEN :start AND :end )
                  ->andwhere("t.noteBy = :id")
                  ->orderBy("t.id",  ASC )
                  ->setParameter( start , $start)
                  ->setParameter( end , $end)
                  ->setParameter( id , $id)
                  ->getQuery();
            $entities = $query->getArrayResult();
            $dateRangeForm = $this->createForm(new DateRangeType());

            $query = $em->getRepository( EcsAgentManagerBundle:User )->find($id);

            //return new Response( yep , 200);
            return $this->render( EcsCrmBundle:TimeClock:view.html.twig , array( entity  =>$entities,  user  => $query,  start  => $start,  end  => $end,  form  => $dateRangeForm -> createView(),));  
    }

RangeForm只是制造了2个 j虫。

But, when I add in {start}/{end} to my route, it constantly tells me that it can t find the proper route.... Since I want the URL to stay the same (ultimately - without the dates being in the URL) -- I ve got to figure out how to post the data to the same function without breaking the ability to just view it by just going to something like: site.dev/manager/12/view

最佳回答
问题回答

暂无回答




相关问题
Rails: Proxy Pass?

I ve got a web-app that I want to migrate to Rails, which is currently just plain HTML with an Apache proxy to another server, running a custom database/webserver that serves the site s dynamic ...

MVC routing is not handling one of my directories

I m using ASP.NET MVC with IIS 7.0. I ve got 404 errors hooked up fine through my Application_Error override. In addition to "Controllers", "Models", "Helpers" etc. I have a directory called Files ...

Ruby on Rails conditional routing

I have a site listing many jobs, but I also want each account to be able to access its jobs in one place. Thus, I am using these routes: map.resources :jobs map.resource :account, :has_many => :...

Clean URL s using OpenCart s router class

How do you write clean URL s in OpenCart using their built in Router class? Here is my .htaccess file: RewriteEngine On RewriteRule ^(system) - [F,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{...

subdomain routing to multiple controller issue

I have a site: www.mydomain.com where we have administrative controls hidden away from normal customer view. I would like to only access the administrative features under a subdomain such as admin....

Can controller names in RESTful routes be optional?

With a standard map.resource routing mechanics and several nested resources the resultant routes are unnecessarily long. Consider the following route: site.org/users/pavelshved/blogs/blogging-horror/...

Help with rails routes

Im having a little trouble setting up routes. I have a users controller/model/views set up restfully so users is set up to be a resource in my routes. I want to change that to be usuarios ...

热门标签