/** * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer * * @throws \Spryker\Zed\Customer\Business\Exception\CustomerNotFoundException * * @return \Generated\Shared\Transfer\CustomerTransfer */ public function confirmRegistration(CustomerTransfer $customerTransfer) { $customerEntity = $this->queryContainer->queryCustomerByRegistrationKey($customerTransfer->getRegistrationKey())->findOne(); if ($customerEntity === null) { throw new CustomerNotFoundException(sprintf('Customer for registration key `%s` not found', $customerTransfer->getRegistrationKey())); } $customerEntity->setRegistered(new \DateTime()); $customerEntity->setRegistrationKey(null); $customerEntity->save(); $customerTransfer->fromArray($customerEntity->toArray(), true); return $customerTransfer; }