Respond to HTTP POST method with data, without :id
@see \Zend\Mvc\Controller\AbstractRestfulController::create()
974128
public function create($data)
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_201);
		
		$request = $this->getRequest();
		$content = $request->getContent();
		$content = !empty($content) ? Json::decode($content, Json::TYPE_ARRAY) : array();
		$post = array_merge_recursive(
			$request->getPost()->toArray(),
			$content
		);
		
		// Inject user data if connected checking if it is not the admin
		// write better this part, peraphs in some service or using doctrine
		$main = $this->getServiceLocator()->get('neobazaar.service.main');
		$userRepository = $main->getUserEntityRepository();
		if($this->zfcUserAuthentication()->hasIdentity()) {
			$identity = $this->zfcUserAuthentication()->getIdentity();
			$userModel = new UserModel($identity, $this->getServiceLocator());
			$classifiedId = 
				isset($post['document']) && isset($post['document']['id']) ? 
				$post['document']['id'] : 
				null;
			
			// Set identity values in any case!!
			$post['user'] = array (
				'email' => $identity->getEmail(),
				'name' => $identity->getName(),
				'id' => $userRepository->getEncryptedId($identity->getUserId())
			);
			
			// admin that want to edit other user classified, 
			// set the correct user to the data.
			if($userModel->isAdmin && null !== $classifiedId) {
				// must check if the classified owner is the admin
				$documentRepository = $main->getDocumentEntityRepository();
				$classified = $documentRepository->findByEncryptedId($classifiedId, 'documentId'); 
				if(null !== $classified) {
					if($classified->getUser()->getUserId() == $identity->getUserId()) {
						$name = $identity->getName();
						$post['user'] = array(
							'email' => $identity->getEmail(),
							'name' => strlen($name) > 2 ? $name : 'xx',
							'id' => $userRepository->getEncryptedId($identity->getUserId())
						);
					} else {
						$user = $userRepository->find($classified->getUser()->getUserId());
						$name = $user->getName();
						$post['user'] = array(
							'email' => $user->getEmail(),
							'name' => strlen($name) > 2 ? $name : 'xx',
							'id' => $userRepository->getEncryptedId($user->getUserId())
						);
					}
				}
			}
		}
		
		try {
			$classifiedService = $this->getServiceLocator()->get('document.service.classified');
			$document = $classifiedService->save($post);
			$data = array(
				'status' => 'success',
				'message' => $document->getDocumentId()
			);
		} catch(\Exception $e) {
			$this->getResponse()
				->setStatusCode(Response::STATUS_CODE_500);
			$data = @unserialize($e->getMessage());
			
			if(!is_array($data)) {
				$data = array(
					'status' => 'danger',
					'message' => $e->getMessage()
				);
			}
		}
		
		return new JsonModel($data);
	}
136859
public function createAction()
    {
        /**
         * @var $form \Zend\Form\Form
         */
        $form = $this->getCreateForm();

        if ($this->getRequest()->isPost()) {
            $form->setData($this->getRequest()->getPost());

            if ($form->isValid()) {
                $objectManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
                $entity = $this->getEntity();
                $hydrator = new DoctrineHydrator($objectManager);
                $hydrator->hydrate($form->getData(), $entity);
                $objectManager->persist($entity);
                $objectManager->flush();
                $controller = explode('/', $this->getRequest()->getUri()->getPath())[2];
                if (!$this->getRequest()->isXmlHttpRequest()) {
                    return $this->redirect()->toRoute(null, ['controller' => $controller]);
                }
                return;
            } else {
                $this->getResponse()->setStatusCode(400);
            }
        }
        $viewModel = $this->getViewModel();
        $viewModel->setTerminal($this->getRequest()->isXmlHttpRequest());

        return $viewModel->setVariables(['form' => $form]);
    }
779023
public static function create($post)
    {
        // If numeric, create the post
        if (is_numeric($post)) {
            // Retrieve the transient
            $transientKey = sprintf('WPMVC\Models\Post(%d)', $post);
            $storedData = WP::getTransient($transientKey);
            // If the transient doesn't yet exist, query for it!
            if ($storedData === false) {
                // Retrieve the post object
                $post = WP::getPost(intval($post));
                // Store the transient
                WP::setTransient($transientKey, $post, static::$transientTimeout);
            } else {
                $post = $storedData;
            }
        } elseif (is_array($post)) {
            // Convert array into object
            $post = (object) $post;
        }
        return new static($post);
    }
105857
private function postData()
    {
        if (strtolower($this->env->get('REQUEST_METHOD')) == 'put' || strtolower($this->env->get('REQUEST_METHOD')) == 'delete') {
            //put方法
            $body = file_get_contents('php://input');
            $bodys = [];
            parse_str($body, $bodys);
            $_POST = array_merge($bodys, $_POST);
        }
        $data = $_POST;
        $this->body = new Set($data);
        return $this;
    }
1168647
public function createAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth(self::CONTROLLER_CHECK_RESOURCE, Dealer::getModuleCode(),
                AccessManager::CREATE)
        ) {
            return $response;
        }

        // Create the Creation Form
        $creationForm = $this->getCreationForm($this->getRequest());

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

        try {
            // Check the form against constraints violations
            $form = $this->validateForm($creationForm, "POST");
            // Get the form field values
            $data = $form->getData();

            if (empty($data["day"])) {
                $dataAM = $this->formatData($data);
                $dataPM = $this->formatData($data, 'PM');

                if ($this->hasNullDate($dataAM) && $this->hasNullDate($dataPM)) {
                    $this->getService()->createFromArray($dataAM, $this->getCurrentEditionLocale());
                } else {
                    if (!$this->hasNullDate($dataAM)) {
                        $this->getService()->createFromArray($dataAM, $this->getCurrentEditionLocale());
                    }
                    if (!$this->hasNullDate($dataPM)) {
                        $this->getService()->createFromArray($dataPM, $this->getCurrentEditionLocale());
                    }
                }
            } else {
                foreach ($data["day"] as $day) {
                    $currentData = $data;
                    $currentData["day"] = $day;
                    $dataAM = $this->formatData($currentData);
                    $dataPM = $this->formatData($currentData, 'PM');

                    if ($this->hasNullDate($dataAM) && $this->hasNullDate($dataPM)) {
                        $this->getService()->createFromArray($dataAM, $this->getCurrentEditionLocale());
                    } else {
                        if (!$this->hasNullDate($dataAM)) {
                            $this->getService()->createFromArray($dataAM, $this->getCurrentEditionLocale());
                        }
                        if (!$this->hasNullDate($dataPM)) {
                            $this->getService()->createFromArray($dataPM, $this->getCurrentEditionLocale());
                        }
                    }
                }
            }


            // Substitute _ID_ in the URL with the ID of the created object
            $successUrl = $creationForm->getSuccessUrl();

            $con->commit();

            // Redirect to the success URL
            return $this->generateRedirect($successUrl);
        } catch (FormValidationException $ex) {
            $con->rollBack();
            // Form cannot be validated
            $error_msg = $this->createStandardFormValidationErrorMessage($ex);
        } catch (\Exception $ex) {
            $con->rollBack();
            // Any other error
            $error_msg = $ex->getMessage();
        }
        if (false !== $error_msg) {
            $this->setupFormErrorContext(
                $this->getTranslator()->trans("%obj creation", ['%obj' => static::CONTROLLER_ENTITY_NAME]),
                $error_msg,
                $creationForm,
                $ex
            );

            // At this point, the form has error, and should be redisplayed.
            return $this->generateErrorRedirect($creationForm);
        }
    }
1125257
final public function create() {
        global $DB, $USER;

        if ($this->raw_get('id')) {
            // The validation methods rely on the ID to know if we're updating or not, the ID should be
            // falsy whenever we are creating an object.
            throw new coding_exception('Cannot create an object that has an ID defined.');
        }

        if (!$this->is_valid()) {
            throw new invalid_persistent_exception($this->get_errors());
        }

        // Before create hook.
        $this->before_create();

        // We can safely set those values bypassing the validation because we know what we're doing.
        $now = time();
        $this->raw_set('timecreated', $now);
        $this->raw_set('timemodified', $now);
        $this->raw_set('usermodified', $USER->id);

        $record = $this->to_record();
        unset($record->id);

        $id = $DB->insert_record(static::TABLE, $record);
        $this->raw_set('id', $id);

        // We ensure that this is flagged as validated.
        $this->validated = true;

        // After create hook.
        $this->after_create();

        return $this;
    }
650536
public function postAction(Request $request)
    {
        // Get the response object from container
        $response = $this->getResponse();
        $model = $this->getModel();

        $this->restUtils->checkJsonRequest($request, $response, $this->getModel());

        $record = $this->restUtils->validateRequest($request->getContent(), $model);

        // Insert the new record
        $record = $model->insertRecord($record);

        // store id of new record so we dont need to reparse body later when needed
        $request->attributes->set('id', $record->getId());

        // Set status code
        $response->setStatusCode(Response::HTTP_CREATED);

        $response->headers->set(
            'Location',
            $this->getRouter()->generate($this->restUtils->getRouteName($request), array('id' => $record->getId()))
        );

        return $response;
    }
386603
public function createAction()
    {
        // Load form
        $entityClass = $this->getModuleNamespace() . '\Entity\\' . $this->getEntityName();
        $entity      = new $entityClass();
        $form        = $this->getForm('Create' . $this->getEntityName());
        $form->bind($entity);

        // Implement Post/Redirect/Get pattern
        $prg = $this->prg();
        if ($prg instanceof Response) {
            return $prg;
        } else if (false !== $prg) {

            // Set form data
            $form->setData($prg);

            // Create account
            $result = $this->getService()->create();
            if ($result) {
                return $this->redirect()->toRoute($this->indexRoute);
            }
        }

        // Set up view model
        $viewModel = new ViewModel(array(
            'entityName' => $this->getEntityName(),
            'form'       => $form,
        ));
        $viewModel->setTemplate('infinity-base/crud/create');

        return $viewModel;
    }
726637
public function newAction()
    {
        $model = $this->loadModel();
        if (!$model->isObjectNew()) {
            $this->_forward('noroute');
            return;
        }

        if ($this->getRequest()->isPost()) {
            $postData = $this->getRequest()->getPost();
            try {
                $model->isObjectNew(true);
                foreach ($this->preprocessPostData($postData) as $key => $value) {
                    $model->setDataUsingMethod($key, $value);
                }
                $model->save();
                $this->_redirectUrl($this->getHelper()->getGridUrl());
                $this->_getSession()->addSuccess('Saved Successfully');
                return;
            } catch (Exception $e) {
                $message = $e->getMessage();
                if ($e instanceof Zend_Db_Statement_Exception && $e->getChainedException() instanceof PDOException) {
                    /** @var PDOException $e */
                    $e = $e->getChainedException();
                    if (isset($e->errorInfo[0]) && $e->errorInfo[0] == 23000 && isset($e->errorInfo[1]) && $e->errorInfo[1] == 1062) {
                        $message = $this->getHelper()->__(
                            "Record already exists for %s '%s'",
                            $model->getIdFieldName(),
                            $model->getId()
                        );
                    }
                }
                Mage::logException($e);
                $this->_getSession()->addError($message);
            }
        }

        $this->loadLayout();
        $this->renderLayout();
    }
167302
public function createAction()
	{
		$cntl = $this->createAdmin();

		if( ( $html = $cntl->create() ) == '' ) {
			return $this->setPsrResponse( $cntl->getView()->response() );
		}

		$this->view->assign( 'content', $html );
	}
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());
	}
1004401
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->model->table;
            Session::flash('message', $message);
            return view('formhandling::warnings/' . config('lasallecmsadmin.admin_template_name') . '/user_not_allowed', [
                'package_title'                => $this->model->package_title,
                'table_type_plural'            => $this->model->table,
                'resource_route_name'          => $this->model->resource_route_name,
                'table_type_singular'          => strtolower($this->model->model_class),
                'HTMLHelper'                   => HTMLHelper::class,
            ]);
        }

        return view('lasallecmsemail::admin/emailhandling/create',
        [
            'user'                             => Auth::user(),
            'repository'                       => $this->repository,
            'package_title'                    => $this->model->package_title,
            'table_name'                       => $this->model->table,
            'model_class'                      => $this->model->model_class,
            'resource_route_name'              => $this->model->resource_route_name,
            'DatesHelper'                      => DatesHelper::class,
            'HTMLHelper'                       => HTMLHelper::class,
            'Config'                           => Config::class,
            'admin_template_name'              => config('lasallecmsadmin.admin_template_name'),
        ]);
    }
283803
public function createAction()
    {
        if (! $this->getSecurityContext()->hasCustomerUser()) {
            $customerCreation = $this->createForm(FrontForm::CUSTOMER_CREATE);

            try {
                $form = $this->validateForm($customerCreation, "post");

                $customerCreateEvent = $this->createEventInstance($form->getData());

                $this->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $customerCreateEvent);

                $newCustomer = $customerCreateEvent->getCustomer();

                // Newsletter
                if (true === $form->get('newsletter')->getData()) {
                    $newsletterEmail = $newCustomer->getEmail();
                    $nlEvent = new NewsletterEvent(
                        $newsletterEmail,
                        $this->getRequest()->getSession()->getLang()->getLocale()
                    );
                    $nlEvent->setFirstname($newCustomer->getFirstname());
                    $nlEvent->setLastname($newCustomer->getLastname());

                    // Security : Check if this new Email address already exist
                    if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterEmail)) {
                        $nlEvent->setId($newsletter->getId());
                        $this->dispatch(TheliaEvents::NEWSLETTER_UPDATE, $nlEvent);
                    } else {
                        $this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $nlEvent);
                    }
                }

                if (ConfigQuery::isCustomerEmailConfirmationEnable() && ! $newCustomer->getEnable()) {
                    $response = $this->generateRedirectFromRoute('customer.login.view');
                } else {
                    $this->processLogin($customerCreateEvent->getCustomer());

                    $cart = $this->getSession()->getSessionCart($this->getDispatcher());
                    if ($cart->getCartItems()->count() > 0) {
                        $response = $this->generateRedirectFromRoute('cart.view');
                    } else {
                        $response = $this->generateSuccessRedirect($customerCreation);
                    }
                }

                return $response;
            } catch (FormValidationException $e) {
                $message = $this->getTranslator()->trans(
                    "Please check your input: %s",
                    [
                        '%s' => $e->getMessage()
                    ],
                    Front::MESSAGE_DOMAIN
                );
            } catch (\Exception $e) {
                $message = $this->getTranslator()->trans(
                    "Sorry, an error occured: %s",
                    [
                        '%s' => $e->getMessage()
                    ],
                    Front::MESSAGE_DOMAIN
                );
            }

            Tlog::getInstance()->error(
                sprintf(
                    "Error during customer creation process : %s. Exception was %s",
                    $message,
                    $e->getMessage()
                )
            );

            $customerCreation->setErrorMessage($message);

            $this->getParserContext()
                ->addForm($customerCreation)
                ->setGeneralError($message)
            ;

            // Redirect to error URL if defined
            if ($customerCreation->hasErrorUrl()) {
                return $this->generateErrorRedirect($customerCreation);
            }
        }
    }
1321461
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->model->table;
            Session::flash('message', $message);
            return view('formhandling::warnings/' . config('lasallecmsadmin.admin_template_name') . '/user_not_allowed', [
                'package_title'        => $this->model->package_title,
                'table_type_plural'    => $this->model->table,
                'table_type_singular'  => strtolower($this->model->model_class),
                'resource_route_name'  => $this->model->resource_route_name,
                'HTMLHelper'           => HTMLHelper::class,
            ]);
        }

        // Specifically for Post Updates
        if (empty(Input::get('post_id'))) {
            $post_id = 0;
            //$related_table

        } else {

            $post_id = Input::get('post_id');

            if ( (int) $post_id < 1 )
            {
                // flash message with redirect
                Session::flash('status_code', 400 );
                $message = 'Please initiate the creation of a new update for your post by clicking the icon ';
                $message .= 'in the row of the post you want to update.';
                Session::flash('message', $message);
                return Redirect::route('admin.'.$this->model->resource_route_name.'.index');
            }
        }

        // Are there mandatory related tables that have no records? If so, can't create/edit
        $isNotNullableRelatedTablesWithNoRecords = $this->repository->isNotNullableRelatedTablesWithNoRecords($this->getFieldList());

        if ($isNotNullableRelatedTablesWithNoRecords['mandatory_no_records'])
        {
            Session::flash('status_code', 400 );
            $message  = "You are not allowed to create ".HTMLHelper::pluralToSingular($this->model->table)." because ";
            $message .= "there are no enabled records in the ";

            if ( !empty($isNotNullableRelatedTablesWithNoRecords['field']['alternate_form_name']) )
            {
                $message .= $isNotNullableRelatedTablesWithNoRecords['field']['alternate_form_name'];
            } else {
                $message .= $isNotNullableRelatedTablesWithNoRecords['field']['name'];
            }

            $message .= ' table. You must add enabled records to the "';
            $message .= $isNotNullableRelatedTablesWithNoRecords['field']['related_table_name'];

            $message .= '" table first!';
            Session::flash('message', $message);
            return Redirect::route('admin.'.$this->model->resource_route_name.'.index');
        }

        return view('formhandling::adminformhandling/' . config('lasallecmsadmin.admin_template_name') . '/create',
        [
            'post_id'                      => $post_id,
            'repository'                   => $this->repository,
            'package_title'                => $this->model->package_title,
            'table_name'                   => $this->model->table,
            'model_class'                  => $this->model->model_class,
            'resource_route_name'          => $this->model->resource_route_name,
            'field_list'                   => $this->getFieldList(),
            'namespace_formprocessor'      => $this->model->namespace_formprocessor,
            'classname_formprocessor_create' => $this->model->classname_formprocessor_create,
            'DatesHelper'                  => DatesHelper::class,
            'HTMLHelper'                   => HTMLHelper::class,
            'carbon'                       => Carbon::class,
            'Config'                       => Config::class,
            'Form'                         => Form::class,
            'admin_size_input_text_box'    => Config::get('lasallecmsadmin.admin_size_input_text_box'),
        ]);
    }
729269
protected function handlePOST()
    {
        /** @var BaseSystemModel $modelClass */
        $modelClass = static::$model;

        if (!empty($this->resource)) {
            throw new BadRequestException('Create record by identifier not currently supported.');
        }

        $records = ResourcesWrapper::unwrapResources($this->getPayloadData());
        if (empty($records)) {
            throw new BadRequestException('No record(s) detected in request.' . ResourcesWrapper::getWrapperMsg());
        }

        $result = $modelClass::bulkCreate($records, $this->request->getParameters());

        $asList = $this->request->getParameterAsBool(ApiOptions::AS_LIST);
        $idField = $this->request->getParameter(ApiOptions::ID_FIELD, static::getResourceIdentifier());
        $result = ResourcesWrapper::cleanResources($result, $asList, $idField, ApiOptions::FIELDS_ALL);

        return ResponseFactory::create($result, null, ServiceResponseInterface::HTTP_CREATED);
    }
459330
public function create()
	{
		$arrNodes = false;

		if ($this->insideRoot)
		{
			$objContent = \ContentModel::findById($this->data->pid);

			$rootId = Controller::getRootPageId($objContent->ptable, $objContent->pid);

			if (null !== $rootId)
			{
				$objPage = \PageModel::findWithDetails($rootId);

				if ($this->insideLang || empty($objPage->domain))
				{
					$arrNodes = array($rootId);
				}
				else
				{
					$arrNodes = (array) \PageModel::findByDns($objPage->domain)->fetchEach('id');
				}
			}
		}
		
		if ($this->multiArticle)
		{
			$this->generateDCA('multiArticle', array
			(
				'inputType' => 'articleTree',
				'label'		=> array($this->label, $this->description),
				'eval'		=> array
				(
					'multiple'		=>	true,				
					'fieldType'		=>	'checkbox', 
					'orderField'	=>	$this->virtualFieldName('orderArticle'),
					'mandatory'		=> ($this->mandatory) ? true : false, 
					'rootNodes'		=>	$arrNodes,
					'tl_class'		=> 'clr'
				),
				'load_callback'		=> array
				(
					array('tl_content_contentblocks', 'prepareOrderPageValue'),
				),
				'save_callback'		=> array
				(
					array('tl_content_contentblocks', 'saveOrderPageValue'),
				),
			));
		}
		else
		{
			$this->generateDCA('singleArticle', array
			(
				'inputType' => 'articleTree',
				'label'		=> array($this->label, $this->description),
				'eval'		=> array
				(
					'fieldType'		=>	'radio', 
					'mandatory'		=> ($this->mandatory) ? true : false, 
					'rootNodes'		=>	$arrNodes,
					'tl_class'		=> 'clr'
				),
			));
		}
	}
226076
public function createAction()
    {
        $this->checkAuth($this->resources, $this->modules, AccessManager::CREATE);

        $baseForm = $this->getCreationForm();

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

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

            $event = $this->getCreationEvent($data);

            $dispatcher = $this->getDispatcher();
            foreach ($this->createEvents as $eventName) {
                $dispatcher->dispatch($eventName, $event);
            }

            $this->afterCreateEvents($event, $data);

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

            return new JsonResponse(["error" => $e->getMessage()], $e->getStatusCode());
        } catch (\Exception $e) {
            $con->rollBack();

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

        $obj = $this->extractObjectFromEvent($event);
        $id = $this->extractIdFromObject($obj);

        return new JsonResponse(
            $this->getLoopResults(
                array_merge(
                    $this->getRequest()->query->all(),
                    [$this->idParameterName => $id]
                )
            ),
            201
        );
    }