/**
  * @return Form
  */
 public function getForm()
 {
     if ($this->entity->getOptions()->getForm()) {
         $formAlias = $this->entity->getOptions()->getForm();
         $form = $this->entity->getServiceLocator()->get($formAlias);
     } else {
         $builder = new AnnotationBuilder();
         $form = $builder->createForm($this->entity->getClassName());
         $form->add(new Button('submit', ['label' => 'save']));
         $form->get('submit')->setAttribute('type', 'submit');
         if ($form->getHydrator() instanceof ArraySerializable) {
             $reflection = new \ReflectionClass($this->entity->getClassName());
             if (!$reflection->hasMethod('getArrayCopy')) {
                 $form->setHydrator(new ClassMethods());
             }
         }
     }
     return $form;
 }