Creates a form to create a SurveyCategory entity.

@param SurveyCategory $entity The entity

@return \Symfony\Component\Form\Form The form
515708
private function createCreateForm(SurveyCategory $entity)
    {
        $form = $this->createForm(new SurveyCategoryType(), $entity, array(
            'action' => $this->generateUrl('surveycategory_create'),
            'method' => 'POST',
        ));

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

        return $form;
    }
821893
public function setResponse(Entity $entity)
    {
        $body = $entity->getBody();

        $body['ToUserName'] = $this['FromUserName'];
        $body['FromUserName'] = $this['ToUserName'];
        $body['MsgType'] = $entity->getType();
        $body['CreateTime'] = time();

        $response = new XmlResponse($body);
        $response->send();
    }
163563
public function createCreateForm(SakonninFile $entity)
    {
        $form = $this->createForm(\BisonLab\SakonninBundle\Form\SakonninFileType::class, $entity, array(
            'action' => $this->generateUrl('file_new'),
            'method' => 'POST',
        ));
        $form->add('file', VichFileType::class, [
            'required' => true,
            'allow_delete' => true,
        ]);
        $form->add('submit', SubmitType::class, array('label' => 'Engage'));

        return $form;
    }
478894
protected function deleteEntity($entity)
    {
        $this->checkEntityType($entity);

        $delete = new Delete($this->aggregate($entity), $this->newQueryBuilder());

        $delete->execute();
    }
814115
public function createAction(Request $request)
    {
        $entity = new Collection();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('admin_collection_show', array('id' => $entity->getId())));
        }

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
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;
    }
509091
public function create(Entity $entity)
    {
        if (!$entity->getValidator()->validate()) {
            throw new Exception\ValidatorException($entity->getValidator());
        }

        $values = $entity->getData();

        $reflection = $entity::getReflection();

        // Prevent to force empty primary property
        if ($reflection->hasPrimary()) {

            $primaryName = $reflection->getPrimaryProperty()->getName();

            if (empty($values[$primaryName])) {
                unset($values[$primaryName]);
            }
        }

        try {
            $primaryValue = $this->query()->insert($values)->run($this->connection);
        } catch (Exception\QueryException $e) {
            throw new Exception\RepositoryException($e->getMessage());
        }

        $this->_saveAssociated($primaryValue, $entity);

        return $primaryValue;
    }
444665
public function newAction($categoryId)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Category $category */
        $category = $em->getRepository('EcommerceBundle:Category')->find($categoryId);

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

        $entity = new Category();
        $form   = $this->createForm(new SubcategoryType(), $entity);

        return array(
            'entity' => $entity,
            'category' => $category,
            'form'   => $form->createView(),
        );
    }
846372
private function createCreateForm(Collection $entity)
    {
        $form = $this->createForm($this->get('amulen.classification.form.collection'), $entity, array(
            'action' => $this->generateUrl('admin_collection_create'),
            'method' => 'POST',
        ));

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

        return $form;
    }
1362001
private function createMenuItemCreateForm(MenuItem $entity)
    {
        $form = $this->createForm(new MenuItemType(), $entity, array(
            'action' => $this->generateUrl('admin_menu_item_create', array('id' => $entity->getMenu()->getId())),
            'method' => 'POST',
        ));

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

        return $form;
    }
229462
private function createCreateForm(Country $entity)
    {
        $form = $this->createForm(new CountryType($this->get('doctrine.orm.entity_manager')->getRepository('OrkestroLocaleBundle:Locale')), $entity, array(
            'action' => $this->generateUrl('orkestro_backend_country_create'),
            'method' => 'POST',
        ));

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

        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;
    }
248453
public function setEntity(Entity $entity)
    {
        $this->each(
            function(Record $record) use ($entity) {
                $record->setEntity($entity);
                $record->setEntityClass(get_class($entity));
            }
        );

        return $this;
    }
342178
public function create(CategoryRequest $request)
    {

        $category = $this->repository->newInstance([]);
        return $this->response->title(trans('app.new') . ' ' . trans('faq::category.name')) 
            ->view('faq::category.create', true) 
            ->data(compact('category'))
            ->output();
    }
584684
public function actionCreate($entity)
    {
        /* @var $commentModel CommentModel */
        $commentModel = Yii::createObject($this->getModule()->commentModelClass);
        $event = Yii::createObject(['class' => CommentEvent::class, 'commentModel' => $commentModel]);
        $commentModel->setAttributes($this->getCommentAttributesFromEntity($entity));
        $this->trigger(self::EVENT_BEFORE_CREATE, $event);
        if ($commentModel->load(Yii::$app->request->post()) && $commentModel->saveComment()) {
            $this->trigger(self::EVENT_AFTER_CREATE, $event);

            return ['status' => 'success'];
        }

        return [
            'status' => 'error',
            'errors' => ActiveForm::validate($commentModel),
        ];
    }
443718
private function createEditForm(Role $entity)
    {
        $form = $this->createForm('sam_role', $entity, array(
            'action' => $this->generateUrl('sam_role_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        return $form;
    }