Creating a new person record
You can use the PersonManager
to create a new Person
record.
<?php
/** @var \Jadu\Quantum\ServiceApiClient\Manager\PersonManager $personManager */
$personManager = $container->get('quantum_service_api_client.manager.person');
$createPersonForm = $personManager->getCreateForm();
$createdPerson = $personManager->save($createPersonForm, [
'title' => 'Mr',
'forename' => 'John',
'middle_names' => 'Walter',
'surname' => 'Smith',
'email' => 'johnw@email.com',
'telephone_primary' => '07912345678',
'telephone_secondary' => '07654321098',
'address_reference' => '4DR3355-R3F3R3NC3',
]);
This will give you a Person
object, containing information such as:
- name
- address
- telephone
Note: Duplicate prevention checks
If there is an existing person record that matches the given forename, surname and address, no new record will be created. CXM will just return the existing matching person record.