class ArchivableBehaviorObjectBuilderModifier
Keeps tracks of an ActiveRecord object, even after deletion
Methods
__construct($behavior) | ||
string | objectAttributes($builder) | |
string | postInsert($builder) | |
string | postUpdate($builder) | |
string |
preDelete($builder)
Using preDelete rather than postDelete to allow user to retrieve related records and archive them before cascade deletion. |
|
string | objectMethods($builder) | |
string | addGetArchive($builder) | |
string | addArchive($builder) | |
string | addRestoreFromArchive($builder) | |
string |
addPopulateFromArchive($builder)
Generates a method to populate the current AR object based on an archive object. |
|
boolean |
fakeAutoIncrementPrimaryKeyForConcreteInheritance()
Checks if the current table uses concrete_inheritance, and if it's parent has an auto-increment primary key. |
|
string | addSaveWithoutArchive($builder) | |
string | addDeleteWithoutArchive($builder) |
Details
at line 21
public
__construct($behavior)
at line 35
public string
objectAttributes($builder)
at line 61
public string
postInsert($builder)
at line 75
public string
postUpdate($builder)
at line 95
public string
preDelete($builder)
Using preDelete rather than postDelete to allow user to retrieve related records and archive them before cascade deletion.
The actual deletion is made by the query object, so the AR class must tell
the query class to enable or disable archiveOnDelete.
at line 108
public string
objectMethods($builder)
at line 138
public string
addGetArchive($builder)
at line 149
public string
addArchive($builder)
at line 163
public string
addRestoreFromArchive($builder)
at line 177
public string
addPopulateFromArchive($builder)
Generates a method to populate the current AR object based on an archive object.
This method is necessary because the archive's copyInto() may include the archived_at column
and therefore cannot be used. Besides, the way autoincremented PKs are handled should be explicit.
at line 197
public boolean
fakeAutoIncrementPrimaryKeyForConcreteInheritance()
Checks if the current table uses concrete_inheritance, and if it's parent has an auto-increment primary key.
In this case, we need to define the
populateFromArchive() method with the second parameter, in order to comply with
php strict standards. The parameter is not used (PKs are inserted regardless if
it is set to true or false).