class ArchivableBehaviorObjectBuilderModifier
Keeps tracks of an ActiveRecord object, even after deletion
Methods
__construct(ArchivableBehavior $behavior)
|
||
string |
objectAttributes(PHP5ObjectBuilder $builder)
Add object attributes to the built class. |
|
string |
postInsert(PHP5ObjectBuilder $builder)
Add code to the postInsert hook. |
|
string |
postUpdate(PHP5ObjectBuilder $builder)
Add code to the postUpdate hoook. |
|
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(ArchivableBehavior $behavior)
at line 39
public string
objectAttributes(PHP5ObjectBuilder $builder)
Add object attributes to the built class.
at line 69
public string
postInsert(PHP5ObjectBuilder $builder)
Add code to the postInsert hook.
at line 89
public string
postUpdate(PHP5ObjectBuilder $builder)
Add code to the postUpdate hoook.
at line 111
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 124
public string
objectMethods($builder)
at line 152
public string
addGetArchive($builder)
at line 163
public string
addArchive($builder)
at line 177
public string
addRestoreFromArchive($builder)
at line 191
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 211
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).
at line 234
public string
addSaveWithoutArchive($builder)
at line 246
public string
addDeleteWithoutArchive($builder)