For example I have:
public function executeTestOne(sfWebRequest $request)
{
$this->value = Doctrine::getTable('Test')->createQuery('a')->where('id = ?', $request->getParameter('id') ) ->execute();
}
public function executeTestTwo(sfWebRequest $request)
{
$this->value = Doctrine::getTable('Test')->createQuery('a')->wh开发者_如何转开发ere('id = ?', $request->getParameter('id') ) ->execute();
}
I would like to use include_partial
or render_partial
etc in action:
public function executePartial ????
{
$this->value = Doctrine::getTable('Test')->createQuery('a')->where('id = ?', $request->getParameter('id') ) ->execute();
}
public function executeTestOne(sfWebRequest $request)
{
include_partial($this->value ??);
}
public function executeTestTwo(sfWebRequest $request)
{
include_partial($this->value ??);
}
Is this possible?
I don't really get what you're trying to do, but what about this?
public function executeTestQuery($id) {
$this->value = Doctrine::getTable('Test')->createQuery('a')->where('id = ?', $id ) ->execute();
}
public function executeTestOne(sfWebRequest $request)
{
executeTestQuery($request->getParameter('id'));
}
public function executeTestTwo(sfWebRequest $request)
{
executeTestQuery($request->getParameter('id'));
}
Technically yes if you load the PartialHelper
. But if you're doing this then you're doing something very wrong in your application, so please never under any circumstances do this... ever.
If you really can't think of a better way to do this, then what you really need is a component
not a partial. See here.
精彩评论