As you have using Factory and there is not the meaning of use o CustomAttribute
You can save using dice_sum and place_of_birth using seter function like
$customer->setDiceSum('9999');
$customer->setPlaceOfBirth('dome');
So, you have to replace
$customer = $this->_customerFactory->create();
$customer->setWebsiteId(1);
$customer->setFirstname($data['firstname']);
$customer->setLastname($data['lastname']);
$customer->setPassword($data['password']);
$customer->setGender($data['gender']);
$customer->setDob($data['dob']);
$customer->setEmail($data['email']);
$customer->save();
$customer = $this->_customerRepoInterface->getById($customer->getId());
$customer->setCustomAttribute('dice_sum', '23');
$customer->setCustomAttribute('place_of_birth','joan');
$this->_customerRepoInterface->save($customer);
BY
$customer = $this->_customerFactory->create();
$customer->setWebsiteId(1);
$customer->setFirstname($data['firstname']);
$customer->setLastname($data['lastname']);
$customer->setPassword($data['password']);
$customer->setGender($data['gender']);
$customer->setDob($data['dob']);
$customer->setEmail($data['email']);
$customer->setDiceSum('9999');
$customer->setPlaceOfBirth('dome')
$customer->save();
BEST SOLUTION:
If you have used service provider class means RepositoryInterface
, Then I suggest to you use service provider for create the new customer.
<?php
namespace Exchanges\Test\Test;
/**
* Description of customerCustomAttribute
*
*/
class customerCustomAttribute {
/**
* @var \Magento\Customer\Api\CustomerRepositoryInterface
*/
protected $customer;
/**
* @var \Magento\Customer\Api\Data\CustomerInterface
*/
protected $customerData;
public function __construct(
\Magento\Customer\Api\CustomerRepositoryInterface $customer,
\Magento\Customer\Api\Data\CustomerInterface $customerData
) {
$this->customerData = $customerData;
$this->customer = $customer;
}
public function saveCustomer()
{
$customer = $this->customerData;
$customer->setWebsiteId(1);
$customer->setFirstname($data['firstname']);
$customer->setLastname($data['lastname']);
$customer->setPassword($data['password']);
$customer->setGender($data['gender']);
$customer->setDob($data['dob']);
$customer->setEmail($data['email']);
$customer->setCustomAttribute('dice_sum', '23');
$customer->setCustomAttribute('place_of_birth','joan');
$this->customer->save($customer);
}
}