php - Zend Framework 2 inherid variables from parent view -


i have following code returns view subview. can see, subview repeats variable $form , array &fields duplicating pass of variables view.

how can inherit userprofileinformationview these variables responseview , inject them responseview?

    $responseview = new viewmodel();     $responseview->setvariables(array(         'form' => $form,           'fields' => $fields,           'usertype' => $usertype,                     ));     $responseview->settemplate('templates/logged_user_profile');     $responseview->setterminal(true);     $userprofileinformationview = new viewmodel();     $userprofileinformationview->settemplate('templates/logged_user_profile_information');     $userprofileinformationview->setvariables(array(         'form' => $form,  //i don't want         'fields' => $fields,  //i don't want     ));     $responseview->addchild($userprofileinformationview, 'userprofileinformation');          return $responseview; 

i know 1 way code this:

    <?php     $responseview = new viewmodel();     $responseview->setvariables(array(         'form' => $form,           'fields' => $fields,           'usertype' => $usertype,                     ));     $responseview->settemplate('templates/logged_user_profile');     $responseview->setterminal(true);     $userprofileinformationview = new viewmodel();     $userprofileinformationview->settemplate('templates/logged_user_profile_information');      $userprofileinformationview->setvariables($responseview->getvariables());      $responseview->addchild($userprofileinformationview, 'userprofileinformation');          return $responseview;     ?> 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -