\CopyFactory
Synopsis
class CopyFactory
extends Object
{
- // members
- private static Boolean $debug = false;
- private static Boolean $for_real = false;
- private static Int $start_time = 0;
- private static Array $title_map_for_display_of_record_name = ;
- private static String $copy_fields_prefix = "Copy";
- private static String $completed_field_appendix = "_Completed";
- private static array $singleton_holder = ;
- private static String $dry_run_for_session_base_name = "CopyFactorySessionVariable";
- private static string $dry_run_for_class_name = "";
- private static string $dry_run_for_id = "";
- protected Boolean $isForReal = "";
- protected String $recordSession = "";
- protected String $myClassName = "";
- protected array $baseIgnoreFields = ;
- // methods
- public static CopyFactory create()
- protected static void add_to_session()
- public static String title_for_object()
- public static String preferred_title_field()
- public void setIgnoreFields()
- public void addIgnoreField()
- public CopyFactory setIsForReal()
- public Boolean getIsForReal()
- protected String getCopyFactorySessionName()
- public CopyFactory copyObject()
- public CopyFactory copyOriginalHasOneItem()
- public CopyFactory copyHasOneRelation()
- public CopyFactory attachToMoreRelevantHasOne()
- public void copyOriginalHasManyItems()
- public CopyFactory copyHasManyRelation()
- public CopyFactory attachToMoreRelevantHasMany()
- public CopyFactory copyOriginalManyManyItems()
- public void attachToMoreRelevantManyMany()
Hierarchy
Extends
- Object
Members
private
- $completed_field_appendix
—
String
the field where we save the ID of the completed copy action should be the same of the field where we saved the original dataobject to be copied + an appendix. - $copy_fields_prefix
—
String
The part at the start of the copy field e.g. MyDataObject becomes CopyMyDataObject. - $debug
—
Boolean
saves all the changes to the debug::log file.. - $dry_run_for_class_name
—
string
static variable that holds the details for the current dry run... - $dry_run_for_id
—
string
static variable that holds the details for the current dry run... - $dry_run_for_session_base_name
—
String
base name for session variables... - $for_real
—
Boolean
is this a real copy event? - $singleton_holder
—
array
holds all the singletons - $start_time
—
Int
the time the copy was started. - $title_map_for_display_of_record_name
—
Array
list of classes and their preferred title field e.g.
protected
- $baseIgnoreFields
—
array
fields that are never copied - $isForReal
—
Boolean
are records actually been written ... - $myClassName
—
String
used for reference only saves the class of the current singleton instance that initiated the copy - $recordSession
—
String
used for reference only saves the class of the current singleton instance that initiated the copy
Methods
protected
- add_to_session() — adds additional info to current session
- getCopyFactorySessionName()
public
- addIgnoreField() — add one field to ignore
- attachToMoreRelevantHasMany() — Usage: an object has many children, the children have already been copied, but they are not pointing at the new parent object.
- attachToMoreRelevantHasOne() — Usage: Find the copied ("NEW") equivalent of the old has-one relation and attach it to the newObject ...
- attachToMoreRelevantManyMany()
- copyHasManyRelation() — Usage: an object has many children and we want to also copy the children and add them to the copied into parent ...
- copyHasOneRelation() — Usage: an object has one child and we want to also copy the child and add it to the copied into parent ...
- copyObject() — Copy one object into another including has-one fields
- copyOriginalHasManyItems() — Usage: an object has many children but we do NOT copy the children ...
- copyOriginalHasOneItem() — From a copied object, copy the has-one of the copyFrom Object to the newObject.
- copyOriginalManyManyItems() — copies Many-Many relationship Without copying the items linked to ...
- create() — returns a CopyFactory specific to a Class.
- getIsForReal()
- preferred_title_field() — returns the name of a method / db field that can be used to describe the object ...
- setIgnoreFields() — set a list of fields that should always be ignored ...
- setIsForReal()
- title_for_object() — provides a meaningful title for an object