Creates a form to create a Menu entity.

@param Menu $entity The entity

@return Form The form
173709
private function createCreateForm(Menu $entity)
    {
        $form = $this->createForm(new MenuType(), $entity, array(
            'action' => $this->generateUrl('admin_menu_create'),
            'method' => 'POST',
        ));

        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }
1029817
private function createEditForm(Contract $entity)
    {
        $form = $this->createForm(new ContractType(), $entity, array(
            'action' => $this->generateUrl('ecommerce_contract_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

//        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
969546
private function createCreateForm(User $entity)
    {
        $form = $this->createForm(new UserType(), $entity, array(
            'action' => $this->generateUrl('admin_user_create'),
            'method' => 'POST',
            'is_creation' => true
        ));

        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }
788631
public function form()
    {
        $menuModel = config('admin.database.menu_model');
        $permissionModel = config('admin.database.permissions_model');
        $roleModel = config('admin.database.roles_model');

        $form = new Form(new $menuModel());

        $form->display('id', 'ID');

        $form->select('parent_id', trans('admin.parent_id'))->options($menuModel::selectOptions());
        $form->text('title', trans('admin.title'))->rules('required');
        $form->icon('icon', trans('admin.icon'))->default('fa-bars')->rules('required')->help($this->iconHelp());
        $form->text('uri', trans('admin.uri'));
        $form->multipleSelect('roles', trans('admin.roles'))->options($roleModel::all()->pluck('name', 'id'));
        if ($form->model()->withPermission()) {
            $form->select('permission', trans('admin.permission'))->options($permissionModel::pluck('name', 'slug'));
        }

        $form->display('created_at', trans('admin.created_at'));
        $form->display('updated_at', trans('admin.updated_at'));

        return $form;
    }
1207977
private function createMapper($entity)
    {
        $mapper = new EntityMapper();
        $mapper->setAdapter(
            $this->adapters->get(
                $this->getAdapterAlias($entity)
            )
        )
            ->setEntityClassName($entity);
        $this->mappers->set($entity, $mapper);
        return $mapper;
    }
914740
public function setMenuPage(\Core\Entity\MenuPage $menuPage = null)
    {
        $this->menuPage = $menuPage;

        return $this;
    }
59031
private function createDeleteForm(Parameter $entity)
    {
        return $this->createFormBuilder()
            ->setAction($this->generateUrl('core_parameter_delete', array('id' => $entity->getId())))
            ->setMethod('DELETE')
            ->getForm()
        ;
    }
853406
private function createEditForm(MediaType $entity)
    {
        $form = $this->createForm(new MediaTypeType(), $entity, array(
            'action' => $this->generateUrl('mediatype_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
359372
public static function generateCreateRequest( Entity $entity ) {
        /* Generate the CreateRequest message */
        $createRequestDOM = new DOMDocument();
        $createNode       = $createRequestDOM->appendChild( $createRequestDOM->createElementNS( 'http://schemas.microsoft.com/xrm/2011/Contracts/Services', 'Create' ) );
        $createNode->appendChild( $createRequestDOM->importNode( $entity->getEntityDOM(), true ) );

        /* Return the DOMNode */

        return $createNode;
    }
850790
private function createEditForm(ProductOrderItem $entity)
    {
        $form = $this->createForm(new ProductOrderItemType(), $entity, array(
            'action' => $this->generateUrl('admin_orderitem_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
558079
private function createEditForm(UserGroup $entity) {
        $form = $this->createForm(new UserGroupType(), $entity, array(
            'action' => $this->generateUrl('admin_usergroup_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
358171
public function updateMenuItemLabelAction(Request $request, MenuItemLabel $menuItemLabel)
    {
        $em = $this->getDoctrine()->getManager();

        if (!$menuItemLabel) {
            throw $this->createNotFoundException('Unable to find MenuItem entity.');
        }

        $editForm = $this->createForm($this->get("amulen.page.form.menuitemlabel"), $menuItemLabel, array(
            'action' => $this->generateUrl('admin_menu_item_label_update', array('id' => $menuItemLabel->getId())),
            'method' => 'PUT',
        ));
        $editForm->add('submit', 'submit', array('label' => 'Update'));
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {

            $em->flush();

            return $this->redirect($this->generateUrl('admin_menu_items', array('id' => $menuItemLabel->getMenuItem()->getMenu()->getId())));
        }

        return array(
            'entity' => $menuItemLabel,
            'form' => $editForm->createView(),
        );
    }
1114045
public function createAction()
    {
        $form = $this->createForm();
        $submit = new Submit();
        $lng = \Cmf\Language\Factory::get($this);
        $submit->setValue($lng['create']);
        $form->setElement($submit);

        $response = [
            'form' => $form,
            'actionLinks' => ActionLinkFactory::createLinks($this->getActionLinkConfig()),
        ];

        if ($form->isSubmitted()) {
            $form->getValuesFromRequest();
            if ($form->validate()) {
                $entity = new $this->entityName();
                $this->fillEntityFromForm($entity, $form);
                $this->fillEntityForCreate($entity);

                try {
                    $em = $this->getEntityManager();
                    $em->persist($entity);
                    $em->flush();
                    $result = true;
                } catch (\Exception $e) {
                    $lng = \Cmf\Language\Factory::get($this);
                    $form->getMessages()->setItem(new Message($lng[self::ERR_DB]));
                    $result = false;
                }
                if ($result) {
                    $response = new PostRedirectGet($this);
                    $response->setRedirectPath([
                        'module' => $this->request->getModuleName(),
                        'controller' => $this->getControllerName(),
                        'action' => 'creationOk',
                    ]);
                }
            }
        }

        return $response;
    }
949734
public function create()
    {
        /**
         * @var Menu $menu
         */
        $classNamespace = $this->getEntityNamespace();
        $menu = new $classNamespace();
        $menu
            ->setDescription('')
            ->setSubnodes(new ArrayCollection())
            ->setEnabled(false);

        return $menu;
    }
1309598
private function createCreateForm(Contract $entity)
    {
        $form = $this->createForm(new ContractType(), $entity, array(
            'action' => $this->generateUrl('ecommerce_contract_create'),
            'method' => 'POST',
        ));

//        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }
45059
public function setMenu(\Wucdbm\Bundle\MenuBuilderBundle\Entity\Menu $menu) {
        $this->menu = $menu;

        return $this;
    }
1218225
public function createMainMenu(Request $request)
    {
        $menu = $this->factory->createItem('root');

        $repositoriesMenu = $this->repositoryMenu->getMenu();

        foreach ($repositoriesMenu as $repositoryActions) {
            $oneRepoMenu = $menu->addChild($repositoryActions->getName());

            /** @var RepositoryActionInterface $action */
            foreach ($repositoryActions as $action) {
                $oneRepoMenu->addChild($action->getName(), ['route' => $action->getRouteName()]);
            }
        }

        return $menu;
    }