apex-enterprise-patterns / fflib-apex-common

Common Apex Library supporting Apex Enterprise Patterns and much more!
BSD 3-Clause "New" or "Revised" License
903 stars 514 forks source link

Feature/unit of work bulk register with relation ship #399

Closed wimvelzeboer closed 2 years ago

wimvelzeboer commented 2 years ago

With this change we can link multiple records to the same parent record.

fflib_ISObjectUnitOfWork unitOfWork = Application.UnitOfWork.newInstance();
Account accountRecord = new Account(Name = 'Test');
unitOfWork.registerNew(accountRecord);

List<Contact> contactRecords = new List<Contact>
{
  new Contact(Lastname = 'Smith'),
  new Contact(LastName = 'Janssen')
};

unitOfWork.registerNew(contactRecords, Contact.AccountId, accountRecord);
unitOfWork.commitWork();

This change is Reviewable