Zend Framework 2&Doctrine 2 - 如何正确保存表单/水合作用?

Using Zend Framework 2, I've build a simple form and a corresponding Doctrine 2 entity. Now I am wondering how I correctly save the form using Doctrine.

If I understood correctly, I can use a hydrator for that – the posted data in array format will be transformed into an object which then can be handled by Doctrine (or something like that), is this correct?

Currently my form looks like this:

use Zend\Form\Form;

class MyForm extends Form
{
    public function __construct()
    {
        parent::__construct('MyForm');

        $this->add(array(
            'type' => 'text',
            'name' => 'firstName',
            'options' => array(
                'label' => 'First Name',
            )
        ));

        $this->add(array(
            'type' => 'submit',
            'name' => 'submit',
            'options' => array(
                'label' => Submit'
            ),
            'attributes' => array(
                'value' => 'Submit Form',
            ),
        ));
    }
}

And the entity like this:

class Form
{
    protected $firstName;

    public function getFirstName()
    {
        return $this->firstName;
    }

    public function setFirstName($firstName)
    {
        $this->firstName = $firstName;
    }
}

As you can see, the field name matches the corresponding variable in the entity. Is this required? I got it to work like this with the following controller code, but I don't really think it's the right approach:

use SomeForm\Form\MyForm;
use DoctrineModule\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator;

class FormsController extends AbstractActionController
{
    public function saveAction()
    {
        $entityManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
        $hydrator = new DoctrineHydrator($entityManager);
        $request = $this->getRequest();
        $form = new MyForm();
        $form->setHydrator($hydrator);
        $entity = new \SomeForm\Entity\Form();
        $form->bind($entity);

        if ($request->isPost()) {
            $data = $request->getPost();
            $form->setData($data);

            // Nothing is validated here
            if ($form->isValid()) {
                $entityManager->persist($entity);
                $entityManager->flush();
                return $this->redirect()->toRoute('home');
            }
        }
    }
}

While doing a research on how this works, I also encountered code examples that contain a function called populate in the entity that maps the forms' post data to the entity. Do I need such a function? How can I change the field names without breaking anything? Is my code correct or am I doing things not how they are supposed to be?

I know ZF2 has a ClassMethods hydrator that uses the entities getter/setter methods – is Doctrine 2 doing the same?