Form to create a new lookup table record
GET /{lookup table}/create

@return Response
423041
public function create()
    {
        // Is this user allowed to do this?
        if (!$this->repository->isUserAllowed('create'))
        {
            Session::flash('status_code', 400 );
            $message = "You are not allowed to create ".$this->table_type_plural;
            Session::flash('message', $message);
            return view('formhandling::warnings/' . config('lasallecmsadmin.admin_template_name') . '/user_not_allowed', [
                'package_title'        => $this->package_title,
                'table_type_plural'    => $this->table_type_plural,
                'table_type_singular'  => $this->table_type_singular,
                'resource_route_name'  => $this->resource_route_name,
                'HTMLHelper'           => HTMLHelper::class,
            ]);
        }

        return view('formhandling::lookuptables/' . config('lasallecmsadmin.admin_template_name') . '/create', [
            'package_title'        => $this->package_title,
            'table_type_plural'    => $this->table_type_plural,
            'table_type_singular'  => $this->table_type_singular,
            'resource_route_name'  => $this->resource_route_name,
            'DatesHelper'          => DatesHelper::class,
            'HTMLHelper'           => HTMLHelper::class,
        ]);
    }
1219601
public function create()
    {
        $sm = $this->em->getConnection()->getSchemaManager();
        $table = $this->em->getClassMetadata(self::$entityName)->getTableName();

        return $sm->tablesExist(array($table));
    }
558606
private function create()
    {
        $response = $this->sendRequest(
            self::METHOD_POST,
            self::$endPoints['create'],
            $this->requestData
        );
        $this->resetRequestData();
        return $response;
    }
1285596
public function createFacetAction()
    {
        $form = $this->formFactory->create(new FacetType(), new Facet());
        $form->handleRequest($this->request);

        if ($form->isValid()) {
            $facet = $this->facetManager->createFacet($form->get('name')->getData(), $form->get('forceCreationForm')->getData());

            return new JsonResponse(
                array('name' => $facet->getName(), 'position' => $facet->getPosition(), 'id' => $facet->getId())
            );
        }

       return $this->render(
           'ClarolineCoreBundle:Administration\Facet:facetForm.html.twig',
           array('form' => $form->createView())
       );
    }
1229717
public function createQuery()
    {
        return $this->getParent()->getMongator()->getRepository($this->getDocumentClass())->createQuery(array(
            '_id' => array('$in' => $this->doInitializeSavedData()),
        ));
    }
93701
public function getForm() {
		$form = new Form();
		
		$useBlacklist = (count($this->propertyBlacklist) > 0) ? true : false;
		$useWhitelist = (count($this->propertyWhitelist) > 0) ? true : false;
		
		$properties = EntityReader::getProperties($this->entityNamespace);
		foreach ($properties as $property) {
			$name = $property->getName();
			if (($useWhitelist && !in_array($name, $this->propertyWhitelist)) || ($useBlacklist && in_array($name, $this->propertyBlacklist))) {
				continue;
			}
			
			switch ($property->getType()) {
				case Property::PROPERTY_TYPE_COLUMN:
					if (!($property->getAnnotation() instanceof \Doctrine\ORM\Mapping\Id)) {
						$this->addColumnElementToForm($form, $property);
					}
					break;
				case Property::PROPERTY_TYPE_REF_ONE:
					$this->addSingleSelecterElementToForm($form, $property);
					break;
				case Property::PROPERTY_TYPE_REF_MANY:
					$this->addMultiSelecterElementToForm($form, $property);
					break;
				default:
					continue 2;
			}
		}
		
		$submit = new Submit('save');
		$submit->setValue('save');
		$form->add($submit);
		
		return $form;
	}
1101176
function create()
    {
        //Tablela ARTICLE
        $this->db->query("CREATE TABLE `article` (
                          `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                          `category` int(11) NOT NULL DEFAULT '1',
                          `status` int(11) NOT NULL,
                          `author` int(11) NOT NULL DEFAULT '1',
                          `rateup` int(11) NOT NULL DEFAULT '0',
                          `ratedown` int(11) NOT NULL DEFAULT '0',
                          `access` int(11) NOT NULL DEFAULT '0',
                          `pubdate` datetime DEFAULT NULL,
                          `editdate` datetime DEFAULT NULL,
                          `link` varchar(300) DEFAULT NULL,
                          `tags` varchar(300) DEFAULT NULL,
                          `title` varchar(300) DEFAULT NULL,
                          `media` text,
                          `resume` text,
                          PRIMARY KEY (`id`)
                        ) ENGINE=InnoDB DEFAULT CHARSET=utf8");

        //Tablela ARTICLECONTENT
            $this->db->query("CREATE TABLE `articlecontent` (
                          `article` int(10) unsigned NOT NULL,
                          `editdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
                          `content` longtext NOT NULL,
                          KEY `article` (`article`),
                          CONSTRAINT `articlecontent_ibfk_1` FOREIGN KEY (`article`) REFERENCES `article` (`id`)
                        ) ENGINE=InnoDB DEFAULT CHARSET=utf8");

        //Tablela CATEGORY
            $this->db->query("CREATE TABLE `category` (
                          `id` int(11) NOT NULL AUTO_INCREMENT,
                          `name` varchar(200) NOT NULL,
                          `description` varchar(500) NOT NULL,
                          PRIMARY KEY (`id`)
                        ) ENGINE=InnoDB DEFAULT CHARSET=latin1");

        //Tablela STATUS
            $this->db->query("CREATE TABLE `status` (
                          `id` int(11) NOT NULL AUTO_INCREMENT,
                          `name` varchar(200) NOT NULL,
                          `description` varchar(500) NOT NULL,
                          PRIMARY KEY (`id`)
                        ) ENGINE=InnoDB DEFAULT CHARSET=latin1");

        //Tablela STATUS - INSERT
            $this->db->query("INSERT INTO `status` (`id`, `name`, `description`) VALUES
                        (1, 'Publicar imediatamente', 'Artigo publicado imediatamente depois de criado/editado.'),
                        (2, 'Salvar como Rascunho', 'Mantém como um rascunho para futura edição (estacionado)'),
                        (3, 'Deletar ou Desabilitar', 'Sinaliza que o artigo está deletado, porém, se mantém salvo para futura auditoria. '),
                        (4, 'Acesso Restrito - logado', 'Permite acesso somente a leitores logados.'),
                        (5, 'Editando...',  'O registro fica reservado para edição por 24 horas.'),
                        (6, 'Livre para reúso', 'Registro usado anteriormente, porém, livre para reúso.')");

        //Tablela USUARIO
            $this->db->query("CREATE TABLE `usuario` (
                          `id` int(11) NOT NULL AUTO_INCREMENT,
                          `login` varchar(255) DEFAULT NULL,
                          `senha` varchar(300) DEFAULT NULL,
                          `nome` varchar(255) DEFAULT NULL,
                          `token` varchar(200) DEFAULT NULL,
                          `vida` int(11) unsigned DEFAULT NULL,
                          `nivel` varchar(45) DEFAULT NULL COMMENT '[A]dmin, [E]ditor, [G]uest',
                          `status` char(1) DEFAULT NULL COMMENT '[A]ctive, [D]isable',
                          PRIMARY KEY (`id`)
                        ) ENGINE=InnoDB DEFAULT CHARSET=utf8");

        //Tablela USUARIO - INSERT
            $this->db->query("INSERT INTO `usuario` (`id`, `login`, `senha`, `nome`, `token`, `vida`, `nivel`, `status`) VALUES
                        (1, 'admin',  'admin#123',  'Administrator',  'DrFol:LeinC%[4CBVcT$hW<mdLEXE)vdCiZVV%Vq', 908,  'A',  'A'),
                        (2, 'editor', 'editor#123', 'Editor', 'v!BPf#hePX30Ks>GK~çjj',  908,  'E',  'A'),
                        (3, 'jessica',  'jessica#123',  'Jessica Mendes', '=+$Wr%yLEbxe7P11iWm1=d)Y@O%47Vow(2r{mv*u', 908,  'A',  'A'),
                        (5, 'guest',  'guest#123',  'Guest',  'IK:QernGB9azWQuh-A6BD',  0,  'G',  'A'),
                        (6, 'test', 'test#123', 'Disabled User',  '![vw*$3lP_z!#IVfe.#n8NiTKBE8<F*=40/B5@tq', 908,  'A',  'D'),
                        (7, 'evora',  'evora123', 'Evora Simpson Smith',  'sadkljhsad9sa04)(sadjhd',  908,  'A',  'A')");

        //Tablela USUARIOPAR - PARAMETROS DE USUÁRIOS
            $this->db->query("CREATE TABLE `usuariopar` (
                        `id` int(11) NOT NULL AUTO_INCREMENT,
                        `usuario` int(11) NOT NULL,
                        `parametro` varchar(100) NOT NULL,
                        `valor` varchar(1000) NOT NULL,
                        PRIMARY KEY (`id`)
                      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Lista de parâmetros extras para cada usuário (opcional e varia entre usuários)'");

        //Tabela ACCESS
            $this->db->query("CREATE TABLE `access` (
                        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                        `data` datetime NOT NULL,
                        `ip` varchar(100) NOT NULL,
                        `uri` varchar(300) NOT NULL,
                        `method` varchar(20) NOT NULL,
                        `agent` varchar(500) NOT NULL,
                        PRIMARY KEY (`id`)
                      ) ENGINE=MyISAM DEFAULT CHARSET=utf8");
    }
546435
public function newAction()
    {
        $entity = new SurveyCategory();
        $form   = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
552068
public function createTask()
	{
		$this->requiresAuthentication();

		$name = $this->resolveModel();

		$properties = $model->getStructure()->getTableColumns($model->getTableName());
		$properties = $this->normalizeProperties($properties);

		foreach ($properties as $property => $type)
		{
			if ($property == $model->getPrimaryKey())
			{
				continue;
			}

			if ($type == 'integer')
			{
				$fields[$property] = Request::getInt($property, 0, 'post');
			}
			/*else if ($type == 'date')
			{
				$fields[$property] = Request::getString($property, with(new Date('now'))->toSql(), 'post');
			}*/
			else
			{
				$fields[$property] = Request::getVar($property, null, 'post');
			}
		}

		if (!$model->set($fields))
		{
			App::abort(500, Lang::txt('JLIB_APPLICATION_ERROR_BIND_FAILED', $model->getError()));
		}

		// Trigger before save event
		$result = Event::trigger('on' . $model->getModelName() . 'BeforeSave', array(&$model, true));

		// Save the data
		if (!$model->save())
		{
			App::abort(500, Lang::txt('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
		}

		// Trigger after save event
		Event::trigger('on' . $model->getModelName() . 'AfterSave', array(&$model, true));

		// Log activity
		if (method_exists($model, 'link'))
		{
			$base = rtrim(Request::base(), '/');
			$url  = str_replace('/api', '', $base . '/' . ltrim(Route::url($model->link()), '/'));
		}

		$recipients = array();

		if ($model->hasAttribute('created_by'))
		{
			$recipients[] = $model->get('created_by');
		}

		Event::trigger('system.logActivity', [
			'activity' => [
				'action'      => 'created',
				'scope'       => $this->_name . '.' . $model->getModelName(),
				'scope_id'    => $model->get($model->getPrimaryKey()),
				'description' => Lang::txt(
					'JLIB_ACTIVITY_ITEM_CREATED',
					$model->getModelName() . ' #' . $model->get($model->getPrimaryKey())
				),
				'details'     => $model->toArray()
			],
			'recipients' => $recipients
		]);

		/*if ($model->hasAttribute('created_by')
		 && $model->hasAttribute('anonymous'))
		{
			$model->set('created_by', 0);
		}*/

		// Format timestamps before sending output
		foreach ($properties as $property => $type)
		{
			if ($type == 'date' && $model->get($property) && $model->get($property) != '0000-00-00 00:00:00')
			{
				$model->set($property, with(new Date($model->get($property)))->format('Y-m-d\TH:i:s\Z'));
			}
		}

		// Send results
		$this->send($model->toObject());
	}
644710
public function newAction()
    {
        $entity = new Country();
        $form   = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
692140
public function getTableForCreate()
    {
        $schema = new Schema();

        $table = $schema->createTable($this->getTableName());

        $table->addColumn('id', 'integer', array('autoincrement' => true));
        $table->addColumn('meta_key', 'string', array('length' => 255));
        $table->addColumn('meta_value', 'object');
        $table->setPrimaryKey(array('id'));
        $table->addUniqueIndex(array('meta_key'));

        return $table;
    }
1091041
public function createAction()
    {
        $this->checkAuth(AdminResources::PRODUCT, [], AccessManager::CREATE);

        $baseForm = $this->createForm(ApiForm::PRODUCT_SALE_ELEMENTS, "form", [], [
            "validation_groups" => ["create", "Default"],
            'csrf_protection' => false,
            "cascade_validation" => true,
        ]);

        $con = Propel::getConnection(ProductSaleElementsTableMap::DATABASE_NAME);
        $con->beginTransaction();

        $createdIds = array();

        try {
            $form = $this->validateForm($baseForm);

            $entries = $form->getData();

            foreach ($entries["pse"] as $entry) {
                $createEvent = new ProductSaleElementCreateEvent(
                    ProductQuery::create()->findPk($entry["product_id"]),
                    $entry["attribute_av"],
                    $entry["currency_id"]
                );

                $createEvent->bindForm($form);

                $this->dispatch(TheliaEvents::PRODUCT_ADD_PRODUCT_SALE_ELEMENT, $createEvent);

                $this->processUpdateAction(
                    $entry,
                    $pse = $createEvent->getProductSaleElement(),
                    $createEvent->getProduct()
                );

                $createdIds[] = $pse->getId();
            }

            $con->commit();
        } catch (\Exception $e) {
            $con->rollBack();

            return new JsonResponse(["error" => $e->getMessage()], 500);
        }

        return new JsonResponse(
            $this->getProductSaleElements(
                array_merge(
                    $this->getRequest()->query->all(),
                    ["id" => implode(",", $createdIds)]
                )
            ),
            201
        );
    }
1281601
public function DeliveryForm()
    {
        $form = DeliveryDetailsForm::create($this, 'DeliveryForm');

        $data = Session::get("Checkout.DeliveryDetailsForm.data");
        if (is_array($data)) {
            $form->loadDataFrom($data);
        }

        $this->extend("updateDeliveryForm", $form);

        return $form;
    }
1230454
protected function create()
	{
		// Only allow creation with new object, otherwise: clone first, create later
		if ( ! $this->is_new())
		{
			return false;
		}

		$this->observe('before_insert');

		// Set all current values
		$query = Query::forge(get_called_class(), static::connection(true));
		$primary_key = static::primary_key();
		$properties  = array_keys(static::properties());
		foreach ($properties as $p)
		{
			if ( ! (in_array($p, $primary_key) and is_null($this->{$p})))
			{
				$query->set($p, $this->{$p});
			}
		}

		// Insert!
		$id = $query->insert();

		// when there's one PK it might be auto-incremented, get it and set it
		if (count($primary_key) == 1 and $id !== false)
		{
			$pk = reset($primary_key);
			// only set it if it hasn't been set manually
			is_null($this->{$pk}) and $this->{$pk} = $id;
		}

		// update the original properties on creation and cache object for future retrieval in this request
		$this->_is_new = false;
		$this->_original = $this->_data;
		static::$_cached_objects[get_class($this)][static::implode_pk($this)] = $this;

		$this->observe('after_insert');

		return $id !== false;
	}
632188
public function create()
    {
        $roles = $this->roleRepositoryInterface->getAll()
                                               ->lists('name', 'slug');

        return $this->view('users.create')
                    ->with('roles', $roles);
    }
1157344
public function actionCreate()
    {
        /* @var $model ActiveRecord */
        $model = $this->createModel();
        $model->load(Yii::$app->request->post(), '');
        $model->save();

        return $model;
    }
1017139
public function getRecord() {
		$form = $this->getForm();
		if (!$this->record && $form) {
			if (($record = $form->getRecord()) && ($record instanceof DataObject)) {
				$this->record = $record;
			} elseif (($controller = $form->Controller())
				&& $controller->hasMethod('data')
				&& ($record = $controller->data())
				&& ($record instanceof DataObject)
			) {
				$this->setRecord($record);
			}
		}
		return $this->record;
	}