Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 一旦用户单击某个内容,如何更新现有记录?_Php_Symfony 1.4 - Fatal编程技术网

Php 一旦用户单击某个内容,如何更新现有记录?

Php 一旦用户单击某个内容,如何更新现有记录?,php,symfony-1.4,Php,Symfony 1.4,我正在使用symfony 1.4理论,我的项目遇到了问题。如何在symfony中更新现有记录 这是我的一个场景。在我的项目的后端应用程序上,管理员(处理后端应用程序)可以在用户将其预订表发送到后端时收到信息/记录(我的项目是会议室预订系统)。管理员将通过电子邮件通知他/她,如果他/她的请求得到批准或没有,我得到了所有权利=)。问题是,我不知道,因为我是symfony的新手,如果管理员单击approved链接,如何从“待定请求”(从请求批准)更改为approved,如果单击Unapprove按钮,

我正在使用symfony 1.4理论,我的项目遇到了问题。如何在symfony中更新现有记录

这是我的一个场景。在我的项目的后端应用程序上,管理员(处理后端应用程序)可以在用户将其预订表发送到后端时收到信息/记录(我的项目是会议室预订系统)。管理员将通过电子邮件通知他/她,如果他/她的请求得到批准或没有,我得到了所有权利=)。问题是,我不知道,因为我是symfony的新手,如果管理员单击approved链接,如何从“待定请求”(从请求批准)更改为approved,如果单击Unapprove按钮,则如何从“待定请求”更改为approved

我还有可以发送邮件的代码(除了更新记录外,此代码有效,以防您可能会更改我代码中的某些内容) 有人能帮我吗?你能给我一些提示吗?一些php代码还是symfony代码

apps/backend/modules/reservation/actions/actions.class.php

<?php

require_once dirname(__FILE__).'/../lib/reservationGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/reservationGeneratorHelper.class.php';

class reservationActions extends autoReservationActions
{
     public function executeListApprove(sfWebRequest $request)
  {

    $reservation = $this->getRoute()->getObject();
    $reservation->approve(true);


    $mailer = $this->getMailer()->composeAndSend(
      'supervisor@teleserv.local',
      $reservation->getEmail(),
      'Request Approval',
      '
          Good Day. Hello This is Martin from the tech dept.
       We have received your request.You can now use the 
       conference room due to your requested schedule. If 
       you have questions of your approval or your request,
       Please contact me within 24 hrs. Thank you.

       Martin
       Junior Programmer
       '
      );

      $this->getUser()->setFlash('notice', 'Sent mail approval:');
      $this->redirect('reservation/index');

  }

     public function executeListDisapprove(sfWebRequest $request)
  {
    $reservation = $this->getRoute()->getObject();
    $reservation->Disapprove(true);

    $mailer = $this->getMailer()->composeAndSend(
      'supervisor@teleserv.local',
       $reservation->getEmail(),
      'Request Disapproval',
      '
          Good Day. Hello This is Martin from the tech dept.
       We have received your request.Unfortunately, We
       can\'t approve your request due: 
        1.Conflicts with the schedule. 
        2.Invalid request information.
       If you have questions of your disapproval or your
       request, Please contact me within 24 hrs. Thank you

       Martin
       Junior Programmer'
      );



      $this->getUser()->setFlash('notice', 'Sent mail disapproval:');
      $this->redirect('reservation/index');

  }  
}
apps/backend/modules/reservation/actions/actions.class.php
马丁

您应该在更改后保存对象

$reservation->save();
提示:

  • 不要混合使用控制器层和视图层
  • 使用配置(app_yml)

$reservation = $this->getRoute()->getObject();
$reservation->approve(true);
$reservation->save();

$mailer = $this->getMailer()->composeAndSend(
  sfConfig::get('app_email_sender'),
  $reservation->getEmail(),
  'Request Approval',
  $this->getPartial('email_approve_body')
);

$this->getUser()->setFlash('notice', 'Sent mail approval:');
$this->redirect('reservation/index');