2017-04-17 9 views
0

이 새 모듈과에서 양식을 작성 제출하면 모든 필드 값을 표시되지하지만 난 양식을 제출할 때 하나의 필드는 다른 모든 못하고 그들의 값 값을 인쇄되어 있습니다ZF2 양식

을 10 개 이상의 필드가 있지만 전자 메일 필드 만 해당 값을 인쇄합니다. 다른 모든 필드는 비어 있습니다. 다음과 같이

public function __construct($name = null) 
{ 
    // we want to ignore the name passed 
    parent::__construct('company'); 

    $this->add(array(
     'name' => 'id', 
     'type' => 'Hidden', 
    )); 


    $this->add(array(
     'name' => 'email', 
     'type' => 'Text', 
     'options' => array(
      //'label' => 'Strasse', 
      // 'placeholder' => 'Email' 

     ), 
     'attributes' => array(
     'placeholder' => 'Email', 
     ), 

    )); 
    $this->add(array(
     'name' => 'firstname', 
     'type' => 'Text', 
     'options' => array(
      //'label' => 'Strasse', 
      // 'placeholder' => 'Email' 

     ), 
     'attributes' => array(
     'placeholder' => 'Vorname', 
     ), 
    )); 

    $this->add(array(
     'name' => 'submit', 
     'type' => 'Submit', 
     'attributes' => array(
      'value' => 'Go', 
      'id' => 'submitbutton', 
     ), 
    )); 
} 

내가 내 모달의 값을 얻고 있지만 모든 값을 표시되지 :

이 내가 내 양식에있는 것입니다.

public function saveCompany(Company $company) 
{ 
    $data = array(
     'firstname'  => $company->firstname, 
     'email'  => $company->email, 

    ); 
    echo '<pre>'; print_r($data); 
     exit; 

왜 내가 틀렸는가를 지적하고 여기에 더 많은 코드가 필요하면 알려 주시기 바랍니다.

Out Put Image

답변

0

가 나는 분야가 exchageArray 기능에 누락 된 내가 그것을 업데이트 이제 잘 작동 고정 가지고 :

public function exchangeArray($data) 
{ 
    $this->id    = (!empty($data['id'])) ? $data['id'] : null; 
    $this->vorname   = (!empty($data['vorname'])) ? $data['vorname'] : null; 
    $this->nachname  = (!empty($data['nachname'])) ? $data['nachname'] : null; 
    $this->email   = (!empty($data['email'])) ? $data['email'] : null; 
    $this->volstangir  = (!empty($data['volstangir'])) ? $data['volstangir'] : null; 
    $this->strasse   = (!empty($data['strasse'])) ? $data['strasse'] : null; 
    $this->hausnummer  = (!empty($data['hausnummer'])) ? $data['hausnummer'] : null; 
    $this->plz    = (!empty($data['plz'])) ? $data['plz'] : null; 
    $this->ort    = (!empty($data['ort'])) ? $data['ort'] : null; 
    $this->telenummer  = (!empty($data['telenummer'])) ? $data['telenummer'] : null; 

}