protected function generateSearchForm()
    {
        $dir = $this->bundle->getPath();

        $parts = explode('\\', $this->entity);
        $entityClass = array_pop($parts);
        $entityNamespace = implode('\\', $parts);

        $target = sprintf('%s/Form/Search/%sSearch.php', $dir, $entityClass);

        $this->renderFile('form/FormSearch.php.twig', $target, array(
            'fields' => $this->getFieldsFromMetadata($this->metadata),
            'bundle' => $this->bundle->getName(),
            'entity' => $this->entity,
            'entity_class' => $entityClass,
            'namespace' => $this->bundle->getNamespace(),
            'entity_namespace' => $entityNamespace,
            'format' => $this->format,
            'form_type_name' => strtolower(str_replace('\\', '_', $this->bundle->getNamespace()) . ($parts ? '_' : '') . implode('_', $parts) . '_' . $this->entity),
        ));
    }