I'm reading a book on ZF2 "Using Zend Framework 2" and saw something that confused me.
It was an example of using Zend\Form in a standard MVC style app where a variable is injected into a view like normal:
return new ViewModel(array(
'form' => $form
));
But in the template it does this:
<?php
$form = $this->form;
$form->prepare();
?>
Why is $this->form being assigned to a local variable? I can just do $form->prepare() and it looks like it works. If I just call $form->prepare() does it not permanently modify the $form variable container? Do you have to copy it to a local variable first before calling prepare()?