Creates a new person entity.

@Route("/new/", name="message_new", methods={"GET", "POST"})
555412
public function newAction(Request $request, $access)
    {
        $message = new Message();
        if ($message_type = $request->get('message_type')) {
            $em = $this->getDoctrineManager();
            $message->setMessageType(
                $em->getRepository('BisonLabSakonninBundle:MessageType')
                    ->find($message_type)
            );
        }
        $form = $this->createForm('BisonLab\SakonninBundle\Form\MessageType',
            $message);
        $form->handleRequest($request);

        // Should or should not use the service createmessage here?
        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrineManager();
            $message->setFromType('INTERNAL');
            $em->persist($message);
            $em->flush($message);

            return $this->redirectToRoute('message_show',
                array('access' => $access, 'id' => $message->getId()));
        }

        return $this->render('BisonLabSakonninBundle:Message:new.html.twig',
            array('entity' => $message, 'form'   => $form->createView()));
    }
165378
public static function createContact()
    {
        $person = self::getPerson();

        // New person check
        if (isset($person->resourceName)) {
            throw new Exception("You should use newPeron() before create", 500);
        }
        
        return self::getService()->people->createContact($person);
    }
390210
def register_new(self, entity_class, entity):
        
        EntityState.manage(entity, self)
        EntityState.get_state(entity).status = ENTITY_STATUS.NEW
        self.__entity_set_map[entity_class].add(entity)
623869
public function newAction()
    {
        $entity = new Service();
        $form   = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
136876
public function newAction()
        {

            $oCustomer = new Customer();
            $form      = $this->createCreateForm($oCustomer);

            return $this->render('SlashworksAppBundle:Customer:new.html.twig', array(
                'entity' => $oCustomer,
                'form'   => $form->createView(),
            ));
        }
481728
public function newInstance(
        string $createdByUserId,
        string $createdReason = Tracking::UNKNOWN_REASON
    ) {
        /** @var ContainerInterface|ContainerAbstract $new */
        $new = parent::newInstance(
            $createdByUserId,
            $createdReason
        );

        $new->lastPublished = new \DateTime();

        $new->revisions = new ArrayCollection();

        if (!empty($new->publishedRevision)) {
            $revision = $new->publishedRevision->newInstance(
                $createdByUserId,
                $createdReason
            );
            $new->removePublishedRevision();
            $new->revisions->add($revision);
            $new->setStagedRevision($revision);
        } elseif (!empty($new->stagedRevision)) {
            $revision = $new->stagedRevision->newInstance(
                $createdByUserId,
                $createdReason
            );
            $new->setStagedRevision($revision);
            $new->revisions->add($revision);
        }

        return $new;
    }
863506
function author($new = null, $return_entity = false)
    {
        if (isset($new)){
            if ($new instanceof Entity){
                $this->_author = $new;
                $new = $new->uri();
            }else{
                $this->_author = null; // for reloading
            }
            if ($new != $this->_attributes['author']){
                $this->change('author', $new);
            }
        }
        if ($return_entity){
            if (!isset($this->_author)){
                if (isset($this->_attributes['author'])){
                    $this->_author = Data::read($this->_attributes['author']);
                }else{
                    $this->_author = false;
                }
            }
            return $this->_author;
        }
        return $this->_attributes['author'];
    }
631032
def create
      @object = resource.new(object_params)
      authorize_for(action: :create,
                    resource: resource.name.underscore.to_sym,
                    object: @object)
      if @object.save
        render json: @object.to_json, status: :created
      else
        render json: @object.errors, status: :unprocessable_entity
      end
    end
961028
public function newAction(Request $request)
    {
        $user = $this->getUser();
        $repository = $this->get('ekyna_user.address.repository');

        $address = $repository->createNew();
        $address->setUser($user);

        $cancelPath = $this->generateUrl('ekyna_user_address_list');

        /** @var \Symfony\Component\Form\FormInterface $form */
        $form = $this
            ->createForm('ekyna_user_address', $address, [
                '_redirect_enabled' => true,
            ])
            ->add('actions', 'form_actions', [
                'buttons' => [
                    'save' => [
                        'type' => 'submit', 'options' => [
                            'button_class' => 'primary',
                            'label' => 'ekyna_core.button.save',
                            'attr' => [
                                'icon' => 'ok',
                            ],
                        ],
                    ],
                    'cancel' => [
                        'type' => 'button', 'options' => [
                            'label' => 'ekyna_core.button.cancel',
                            'button_class' => 'default',
                            'as_link' => true,
                            'attr' => [
                                'class' => 'form-cancel-btn',
                                'icon' => 'remove',
                                'href' => $cancelPath,
                            ],
                        ],
                    ],
                ],
            ])
        ;

        $form->handleRequest($request);
        if ($form->isValid()) {
            $event = $this->get('ekyna_user.address.operator')->create($address);
            if (!$event->isPropagationStopped()) {
                $this->addFlash('ekyna_user.address.message.create.success', 'success');
                if (null !== $redirectPath = $form->get('_redirect')->getData()) {
                    return $this->redirect($redirectPath);
                }
                return $this->redirect($cancelPath);
            }
            $this->addFlash('ekyna_user.address.message.create.failure', 'danger');
        }

        return $this->render('EkynaUserBundle:Address:new.html.twig', [
            'form' => $form->createView()
        ]);
    }
193915
public function __new($navigation = array())
    {
        // Create new entity
        $entity = new Material();
        $entity->Active = 1;
        $entity->Created = date('Y-m-d H:m:s');

        // Set user
        $user = $this->system->module('social')->user();

        if (isset($user->user_id)) {
            $entity->UserID = $user->userId;
        }
        else {
            $entity->UserID = '1';
        }

        // Persist
        $entity->save();

        // Set name for created material
        $entity->Name = t($this->name, true).' №'.$entity->id;
        $entity->Url = utf8_translit($entity->Name);

        // Check unique url for material
        if ($this->query->entity(Material::class)->where(Material::F_IDENTIFIER, utf8_translit($entity->Name))->first()) {
            $entity->Url = md5(utf8_translit($entity->Name));
        }

        // Persist
        $entity->save();

        Event::fire('samsoncms.app.material.new', array(&$entity));

        $navigation = is_array($navigation) ? $navigation : array($navigation);

        // Set navigation relation
        foreach (array_merge($navigation, static::$structures) as $structureID) {
            // Create relation with structure
            $structureMaterial = new NavigationMaterial();
            $structureMaterial->MaterialID = $entity->id;
            $structureMaterial->StructureID = $structureID;
            $structureMaterial->Active = '1';
            $structureMaterial->save();
        }

        // Go to correct form URL
        url()->redirect($this->system->module('cms')->baseUrl . '/' . $this->id . '/form/' . $entity->id);
    }
75471
public function newAction()
    {
        $entity = new Tag();
        $form   = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
585633
public function newAction()
        {
            $oUser = new User();
            $form   = $this->createCreateForm($oUser);

            return $this->render('SlashworksBackendBundle:User:new.html.twig', array(
                'entity' => $oUser,
                'form'   => $form->createView(),
            ));
        }
727811
public function createAction(Request $request)
    {
        $entity = new User();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $userService = $this->get("flowcode.user");
            $userService->create($entity);

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

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
726705
public function create()
  {
    $class = ClassGen::classGen(
      $this->name,
      $this->namespace,
      [
        'Phrest\API\Enums\RequestMethodEnum',
        'Phrest\SDK\Request\AbstractRequest',
        'Phrest\SDK\Request\RequestOptions',
        'Phrest\SDK\PhrestSDK'
      ],
      'AbstractRequest'
    );

    // Path
    $path = '/' . $this->version . '/'
      . strtolower($this->entityName)
      . $this->getPlaceholderUriFromUrl($this->action->url);

    $property = ClassGen::property('path', 'private', $path, 'string');
    $class->addPropertyFromGenerator($property);

    // Properties and constructor parameters
    /** @var ParameterGenerator[] $parameters */
    $parameters = [];

    // Get properties
    $getParams = $this->generateGetParamsFromUrl($this->action->url);
    if (!empty($getParams))
    {
      foreach ($getParams as $getParam)
      {
        $class->addPropertyFromGenerator(
          ClassGen::property($getParam, 'public', null)
        );

        $parameter = new ParameterGenerator($getParam);
        $parameter->setDefaultValue(null);

        $parameters[$getParam] = $parameter;
      }
    }

    // Post properties
    if (!empty($this->action->postParams))
    {
      foreach ($this->action->postParams as $name => $type)
      {
        if ($class->hasProperty($name))
        {
          continue;
        }

        $class->addPropertyFromGenerator(
          ClassGen::property($name, 'public', null, $type)
        );

        $parameter = new ParameterGenerator($name, $type);
        $parameter->setDefaultValue(null);

        $parameters[$name] = $parameter;
      }
    }

    // Constructor
    if (!empty($parameters))
    {
      $constructor = ClassGen::constructor($parameters);
      $class->addMethodFromGenerator($constructor);
    }

    // Create method
    $create = ClassGen::method('create', [], 'public', $this->getCreateBody());
    $class->addMethodFromGenerator($create);

    // Setters
    foreach ($parameters as $parameter)
    {
      $class->addMethodFromGenerator(
        ClassGen::setter($parameter->getName(), $parameter->getType())
      );
    }

    return $class;
  }
863532
public function createAction(Request $request, $id)
    {
        //get the business entity
        $businessEntity = $this->getBusinessEntity($id);

        /** @var BusinessTemplate $view */
        $view = $this->get('victoire_business_page.BusinessTemplate_chain')->getBusinessTemplate($id);
        $view->setBusinessEntityId($businessEntity->getId());

        $form = $this->createCreateForm($view);

        $form->handleRequest($request);

        $params = [
            'success' => false,
        ];

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

            //redirect to the page of the pagePattern
            $params['url'] = $this->generateUrl('victoire_business_template_show', ['id' => $view->getId()]);
            $params['success'] = true;

            $this->congrat($this->get('translator')->trans('victoire.business_template.create.success', [], 'victoire'));
        } else {
            //get the errors as a string
            $params['message'] = $this->container->get('victoire_form.error_helper')->getRecursiveReadableErrors($form);
        }

        return new JsonResponse($params);
    }
1062023
function Entity(route, opts) {
  if (!(this instanceof Entity)) return new Entity(route, opts);
  this._route = route;
  this._options = opts || {};
  this._methods = {};
  this.on('error', function() { /* stifle auto exit on error */ });
}
385235
public function newAction()
    {
        $entity = new Category();
        $form   = $this->createForm(new CategoryType(), $entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }