Вопрос по коду бэкенда из symfony - PullRequest
0 голосов
/ 18 марта 2010

это действие индекса и шаблон, сгенерированный в бэкэнде для Модель "Коче".

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 в Индексное действие.

Как это возможно?

Хави

Ответы [ 2 ]

0 голосов
/ 18 марта 2010

Похоже на модуль, сгенерированный администратором генератора. Если это так, то эти переменные задаются в классе autoCocheActions, который находится в кэше проекта и генерируется на лету.

0 голосов
/ 18 марта 2010

Расширяет ли действие индекса класс? Если да, то вот как!

...