2016-05-11 5 views
2

私のフォームのいずれかからデータを取得することはできません、ここにproblemeは私がちょうどフォーム私はボタンが提出された各フォームのデータを取得したい2つのフォームで、私はページを作成

の1のためのデータを得ることができますです

これは私のindexActionです:dateNaissa、「INSERT INTO DemandeCCP(NOM、 prenomを実行しながら

public function indexCcpAction() 
{ 

    $demanceCCP = new DemandeCCP(); 
    $ccp = new Ccp(); 
    $formDemanceCCP = $this->createForm(new DemandeCcpType(), $demanceCCP); 
    $formCcp = $this->createForm(new LoginCcpType(), $ccp); 
    $formCcp->handleRequest($this->get('request')); 
    $em = $this->getDoctrine()->getManager(); 
    if ($this->get("request")->getMethod() == "POST") { 
      if ($this->get("request")->request->has("DemandeCcpType") ) { 
       $demanceCCP = $formDemanceCCP->getData(); // i can't get data from this form 
       echo($demanceCCP->getNom()); 
       $em->persist($demanceCCP); 
       $em->flush(); 
      } 
      if ($this->get("request")->request->has("LoginCcpType")) { 
       $ccp = $formCcp->getData(); // but in this form work 
       echo ($ccp->getMdp()); 
      } 
    } 
    return $this->render('EgovPosteBundle:Ccp:DemanceCCP.html.twig', 
     array('formDemandeCcp'=>$formDemanceCCP->createView(), 
       'formLogin'=>$formCcp->createView())); 
} 

私は例外DemandeCcpType

のデータを挿入しようとすると、私はこの例外を取得しますが発生しましたNCE、lieuNaissance、職業、nationalite、 typePieceIdentite、numeroIdentite、住所、電子メール、TEL、codePostal、 sollicite、dateDemancde、statut)VALUES(?、?、?、?、?、?、?、?、?、?、 ????? 、、、、)」のparamsで[NULL、NULL、NULL、NULL、NULL、NULL、NULL、 NULL、NULL、NULL、NULL、NULL、NULL、「2016年5月11日03: 25:36" 、 "アンクール"]:

SQLSTATE [23000]:整合性制約違反:1048列 'NOM' は、あなただけの形式のいずれかのためのhandleRequestを求めている

答えて

2

nullにすることはできません。これは、両方のために呼び出される必要があります。

追加$formDemanceCCP->handleRequest($this->get('request'));

関連する問題