Symfony1 获取并返回要执行的ID";编辑";行动

Symfony1 获取并返回要执行的ID";编辑";行动,symfony1,symfony-1.4,Symfony1,Symfony 1.4,我使用“选项卡”制作了一个模块,每个选项卡以这种方式调用一个组件: include_component('logotipo', 'index'); 下面是组件的代码: class logotipoComponents extends sfComponents { public function executeIndex(sfWebRequest $request) { $id_empresa = $this->getUser()->getGuardUser

我使用“选项卡”制作了一个模块,每个选项卡以这种方式调用一个组件:

include_component('logotipo', 'index');
下面是组件的代码:

class logotipoComponents extends sfComponents {

    public function executeIndex(sfWebRequest $request) {
        $id_empresa = $this->getUser()->getGuardUser()->getSfGuardUserProfile()->getIdempresa();
        $this->sdriving_logotipo = Doctrine_Core::getTable('SdrivingLogotipo')->createQuery('a')->leftJoin('a.SdrivingEmpresa e')->where('e.idempresa = ?', $id_empresa)->execute();
    }

}
这是模板
\u index.php

<?php if ($sdriving_logotipo->count() > 0): ?>
    <div class="span3">
        <span class="gris">Vista previa</span>
        <?php echo image_tag('/uploads/' . $sdriving_logotipo[0]->getArchivo()); ?>
    </div>
<?php else: ?>
    <div class="alert alert-block">
        <h4><?php echo __('Información!') ?></h4>
        <?php echo __('No se ha subido ningún logotipo aún. Haga clic en el botón "Subir nuevo" para crear uno.') ?>
    </div>
<?php endif; ?>
如果我选择了第一个选项,那么我需要构建一个查询,以便从数据库中获取文件名,然后从文件系统中删除该文件,上载新文件并使用上载文件的新ID更新
SdrivingEmpresa
表。在这种情况下,我不知道如何获取ID以及在哪里为这些操作编写逻辑:在
受保护函数processForm(sfWebRequest$request,sfForm$form){}
?在'doSave($con=null){}'中的
SdrivingLogotipoForm.class.php
?在哪里


有什么帮助吗?

我建议您使用ajax。创建一个名为ajax的模块,并在其中的操作和模板中开发逻辑

当您单击每个选项卡以运行ajax表单操作时

这是我的建议

祝你好运

SdrivingEmpresa:
  columns:
    idempresa:
      type: integer(4)
      unsigned: true
      primary: true
      autoincrement: true
    idlogotipo:
      type: integer(4)
      unsigned: true
      primary: true
    nombre_empresa:
      type: string(250)
      notnull: true
    ruta_emp:
      type: string(45)
      notnull: true
      autoincrement: false
  relations:
    SdrivingLogotipo:
      local: idlogotipo
      foreign: idlogotipo
      type: one
    SdrivingEmisor:
      local: idempresa
      foreign: idempresa
      type: many
    SdrivingMaquina:
      local: idempresa
      foreign: idempresa
      type: many
    SdrivingOperador:
      local: idempresa
      foreign: idempresa
      type: many
    SdrivingTurno:
      local: idempresa
      foreign: idempresa
      type: many
    SfGuardUserProfile:
      local: idempresa
      foreign: idempresa
      type: many

SdrivingLogotipo:
  columns:
    idlogotipo:
      type: integer(4)
      unsigned: true
      primary: true
      autoincrement: true
    archivo:
      type: string(250)
  relations:
    SdrivingEmpresa:
      local: idlogotipo
      foreign: idlogotipo
      type: many