Customer example

$this->attributeHydrator = $attributeHydrator;
        $this->customerGroupHydrator = $customerGroupHydrator;
    }

    /** * @param array<string, mixed> $data * * @return Customer */
    public function hydrate(array $data)
    {
        $customer = new Customer();
        $customer->setId($data['__customer_id']);
        $customer->setEncoder($data['__customer_encoder']);
        $customer->setEmail($data['__customer_email']);
        $customer->setActive($data['__customer_active']);
        $customer->setAccountMode($data['__customer_accountmode']);
        $customer->setConfirmationKey($data['__customer_confirmationkey']);
        $customer->setPaymentId($data['__customer_paymentID']);
        $customer->setValidation($data['__customer_validation']);
        $customer->setAffiliate($data['__customer_affiliate']);
        $customer->setPaymentPreset($data['__customer_paymentpreset']);
        $customer->setLanguageId($data['__customer_language']);
        
 else {
            // Check if the user has the rights to create a new customer             if (!$this->_isAllowed('create', 'customer')) {
                $this->View()->assign([
                    'success' => false,
                    'data' => $this->Request()->getParams(),
                    'message' => $namespace->get('no_create_rights', 'You do not have sufficient rights to view create a customer.'),
                ]);

                return;
            }
            $customer = new Customer();
        }

        if (!($paymentData instanceof PaymentData) && !empty($params['paymentData']) && !empty(array_filter($params['paymentData'][0]))) {
            $paymentData = new PaymentData();
            $customer->addPaymentData($paymentData);

            /** @var Payment $payment */
            $payment = $this->getManager()
                ->getRepository(Payment::class)
                ->find($paymentId);
            $paymentData->setPaymentMean($payment);
        }
$this->redirect(array_merge($location$params));
    }

    /** * @param array<string, mixed> $data * * @return FormInterface<Customer> */
    private function createCustomerForm(array $data): FormInterface
    {
        $customer = new Customer();
        $form = $this->createForm(PersonalFormType::class$customer);
        $form->submit($data);

        return $form;
    }

    /** * @param array<string, mixed> $data * * @return FormInterface<Address> */
    
Home | Imprint | This part of the site doesn't use cookies.