简体   繁体   English

您可以从 Symfony 的操作中手动调用 sfDoctrineRoute 吗?

[英]Can you manually call an sfDoctrineRoute from within an action in Symfony?

As the question says.正如问题所说。 I'd like to dispatch to an sfDoctrineRoute from within another action, but I'd like to preserve the current request.我想从另一个操作中分派到 sfDoctrineRoute,但我想保留当前请求。 That way I'm not redirecting and losing the current request info....这样我就不会重定向和丢失当前的请求信息......

Have a look at the forward() method in case it's what you're looking for:看看 forward() 方法,以防它是你正在寻找的:

http://www.symfony-project.org/api/1_4/sfAction http://www.symfony-project.org/api/1_4/sfAction

As a side note, I'm sure you have your reasons for wanting this but I'd probably approach so that whatever you need from that other action is contained in the models.作为旁注,我相信你有你想要这个的理由,但我可能会接近,以便你需要从其他动作中得到的任何东西都包含在模型中。 This way when you call it, you can pass the request parameters to it and "preserve" the current request - wherever in your application you're calling it from.这样,当您调用它时,您可以将请求参数传递给它并“保留”当前请求 - 您在应用程序中的任何位置调用它。 If you really need to call another action, then I'd go ahead push the request to it fully.如果你真的需要调用另一个动作,那么我会提前 go 将请求完全推送给它。 You can always redirect/forward and pass the request parameters with it.您始终可以重定向/转发并使用它传递请求参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM