错误:$ this->容器

时间:2017-03-27 08:15:37

标签: php symfony

我正在尝试创建一个为客户端发送邮件的ws

当我使用private function sendMailAlert($listeSuiveur, $listePostulant, $statut, $mission) { $DateTimeFrench = new DateTimeFrench(); $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://"; $missionurl = $protocol . $_SERVER['HTTP_HOST'] . '/mission?id=' . $mission->getId(); foreach ($listeSuiveur as $suiveur) { $messageToSend = \Swift_Message::newInstance() ->setSubject('notification suite au changement à la mission que vous suivez ') ->setFrom($this->container->getParameter('mail_address'), $this->container->getParameter('sender_name')) ->setTo($suiveur["email"]) ->setBody( $this->renderView( 'Emails/notifieCandidat.html.twig', array( 'statut' => $statut, 'missiontitre' => $mission->getTitre(), 'missiondescription' => strip_tags($mission->getDescription()), 'date'=>$DateTimeFrench->format($mission->getDatePublication()->format('d F Y ')), 'societe'=>$mission->getSociete()->getNom(), 'missionurl' => $missionurl, 'subject' => 'notification suite au changement à la mission ', 'sendername' => $suiveur["prenom"] . " " . $suiveur["nom"], ) ), 'text/html' ); $this->get('mailer')->send($messageToSend); } } 容器时,在此函数中出现此错误:

  

在非对象

上调用成员函数getParameter()

这是我的代码:

parameter.yml

这是我的# This file is auto-generated during the composer install parameters: mail_address: noreply@test.com sender_name: 'test'

$( function() {
    $( "#dialog-message" ).dialog({
      modal: true,
      "allowScrolling": false,
      buttons: {
        Ok: function() {
          $( this ).dialog( "close" );
        }
      }
    });
} );

任何建议?

0 个答案:

没有答案