Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add overloaded method for register dirty with relationships #400

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ public interface fflib_ISObjectUnitOfWork
* @param relatedToParentRecord A SObject instance of the parent record (should also be registered as new separately)
**/
void registerNew(SObject record, Schema.SObjectField relatedToParentField, SObject relatedToParentRecord);
/**
* Register newly created records to be inserted when commitWork is called,
* it also provides a reference to the single parent record instance (should also be registered as new separately)
*
* @param records newly created records of the same SObjectType to be inserted during commitWork
* @param relatedToParentField A SObjectField reference to the child field that associates the child record with its parent
* @param relatedToParentRecord A SObject instance of the parent record (should also be registered as new separately)
**/
void registerNew(List<SObject> records, Schema.SObjectField relatedToParentField, SObject relatedToParentRecord);
/**
* Register a relationship between two records that have yet to be inserted to the database. This information will be
* used during the commitWork phase to make the references only when related records have been inserted to the database.
Expand All @@ -59,6 +68,15 @@ public interface fflib_ISObjectUnitOfWork
* @param relatedTo A SObject instance (yet to be committed to the database)
*/
void registerRelationship(SObject record, Schema.SObjectField relatedToField, SObject relatedTo);
/**
* Register a relationship between two records that have yet to be inserted to the database. This information will be
* used during the commitWork phase to make the references only when related records have been inserted to the database.
*
* @param records Existing or newly created records
* @param relatedToField A SObjectField reference to the field that relates the given records to the relatedTo record
* @param relatedTo A SObject instance (yet to be committed to the database)
*/
void registerRelationship(List<SObject> records, Schema.SObjectField relatedToField, SObject relatedTo);
/**
* Registers a relationship between a record and a Messaging.Email where the record has yet to be inserted
* to the database. This information will be
Expand Down
Loading