关于symfony后端代码的问题

发布于 2024-08-25 19:32:40 字数 2090 浏览 1 评论 0原文

这是后端生成的索引操作和模板 模型“coche”。

public function executeIndex(sfWebRequest $request)
   {
     // sorting
     if ($request->getParameter('sort') &&
$this->isValidSortColumn($request->getParameter('sort')))
     {
       $this->setSort(array($request->getParameter('sort'),
$request->getParameter('sort_type')));
     }

     // pager
     if ($request->getParameter('page'))
     {
       $this->setPage($request->getParameter('page'));
     }

     $this->pager = $this->getPager();
     $this->sort = $this->getSort();
   }

这是索引模板:

<?php use_helper('I18N', 'Date') ?>
<?php include_partial('coche/assets') ?>

<div id="sf_admin_container">
<h1><?php echo __('Coche List', array(), 'messages') ?></h1>

<?php include_partial('coche/flashes') ?>

<div id="sf_admin_header">
<?php include_partial('coche/list_header', array('pager' => $pager)) ?>
</div>

<div id="sf_admin_bar">
<?php include_partial('coche/filters', array('form' => $filters,
'configuration' => $configuration)) ?>
</div>

<div id="sf_admin_content">
<form action="<?php echo url_for('coche_coche_collection',
array('action' => 'batch')) ?>" method="post">
<?php include_partial('coche/list', array('pager' => $pager, 'sort' =>
$sort, 'helper' => $helper)) ?>
<ul class="sf_admin_actions">
<?php include_partial('coche/list_batch_actions', array('helper' =>
$helper)) ?>
<?php include_partial('coche/list_actions', array('helper' => $helper)) ?>
</ul>
</form>
</div>

<div id="sf_admin_footer">
<?php include_partial('coche/list_footer', array('pager' => $pager)) ?>
</div>
</div>

在模板中有这一行:

include_partial('coche/filters', array('form' => $filters,
'configuration' => $configuration)) ?>

但我找不到变量 $this->filters 和 $this->configuration 索引动作。

这怎么可能?

哈维

this is the index action and template generated at the backend for the
model "coche".

public function executeIndex(sfWebRequest $request)
   {
     // sorting
     if ($request->getParameter('sort') &&
$this->isValidSortColumn($request->getParameter('sort')))
     {
       $this->setSort(array($request->getParameter('sort'),
$request->getParameter('sort_type')));
     }

     // pager
     if ($request->getParameter('page'))
     {
       $this->setPage($request->getParameter('page'));
     }

     $this->pager = $this->getPager();
     $this->sort = $this->getSort();
   }

This is the index template:

<?php use_helper('I18N', 'Date') ?>
<?php include_partial('coche/assets') ?>

<div id="sf_admin_container">
<h1><?php echo __('Coche List', array(), 'messages') ?></h1>

<?php include_partial('coche/flashes') ?>

<div id="sf_admin_header">
<?php include_partial('coche/list_header', array('pager' => $pager)) ?>
</div>

<div id="sf_admin_bar">
<?php include_partial('coche/filters', array('form' => $filters,
'configuration' => $configuration)) ?>
</div>

<div id="sf_admin_content">
<form action="<?php echo url_for('coche_coche_collection',
array('action' => 'batch')) ?>" method="post">
<?php include_partial('coche/list', array('pager' => $pager, 'sort' =>
$sort, 'helper' => $helper)) ?>
<ul class="sf_admin_actions">
<?php include_partial('coche/list_batch_actions', array('helper' =>
$helper)) ?>
<?php include_partial('coche/list_actions', array('helper' => $helper)) ?>
</ul>
</form>
</div>

<div id="sf_admin_footer">
<?php include_partial('coche/list_footer', array('pager' => $pager)) ?>
</div>
</div>

In the template there is this line:

include_partial('coche/filters', array('form' => $filters,
'configuration' => $configuration)) ?>

but i can not find the variables $this->filters and $this->configuration in the
index action.

How is that possible?

Javi

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风为裳 2024-09-01 19:32:40

索引操作是否扩展了一个类?如果是的话,就是这样!

Is the index action extending a class? If yes, that's how!

巨坚强 2024-09-01 19:32:40

它看起来像是由管理生成器生成的模块。如果是这样,那么这些变量将在 autoCocheActions 类中设置,该类驻留在项目缓存中并动态生成。

It looks like a module generated by admin generator. If it's so, then these vars are set in autoCocheActions class which resides in project cache and is generated on the fly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文