mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE: Added LastChange() method to BulkLoader_Result
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64807 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
4bc5848734
commit
8abb5b020f
@ -262,6 +262,13 @@ class BulkLoader_Result extends Object {
|
||||
*/
|
||||
protected $deleted = array();
|
||||
|
||||
/**
|
||||
* Stores the last change.
|
||||
* It is in the same format as {@link $created} but with an additional key, "ChangeType", which will be set to
|
||||
* one of 3 strings: "created", "updated", or "deleted"
|
||||
*/
|
||||
protected $lastChange = array();
|
||||
|
||||
/**
|
||||
* Returns the count of all objects which were
|
||||
* created or updated.
|
||||
@ -317,16 +324,26 @@ class BulkLoader_Result extends Object {
|
||||
return $this->mapToDataObjectSet($this->deleted);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last change.
|
||||
* It is in the same format as {@link $created} but with an additional key, "ChangeType", which will be set to
|
||||
* one of 3 strings: "created", "updated", or "deleted"
|
||||
*/
|
||||
public function LastChange() {
|
||||
return $this->lastChange;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $obj DataObject
|
||||
* @param $message string
|
||||
*/
|
||||
public function addCreated($obj, $message = null) {
|
||||
$this->created[] = array(
|
||||
$this->created[] = $this->lastChange = array(
|
||||
'ID' => $obj->ID,
|
||||
'ClassName' => $obj->class,
|
||||
'Message' => $message
|
||||
);
|
||||
$this->lastChange['ChangeType'] = 'created';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -334,11 +351,12 @@ class BulkLoader_Result extends Object {
|
||||
* @param $message string
|
||||
*/
|
||||
public function addUpdated($obj, $message = null) {
|
||||
$this->updated[] = array(
|
||||
$this->updated[] = $this->lastChange = array(
|
||||
'ID' => $obj->ID,
|
||||
'ClassName' => $obj->class,
|
||||
'Message' => $message
|
||||
);
|
||||
$this->lastChange['ChangeType'] = 'updated';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -346,11 +364,12 @@ class BulkLoader_Result extends Object {
|
||||
* @param $message string
|
||||
*/
|
||||
public function addDeleted($obj, $message = null) {
|
||||
$this->deleted[] = array(
|
||||
$this->deleted[] = $this->lastChange = array(
|
||||
'ID' => $obj->ID,
|
||||
'ClassName' => $obj->class,
|
||||
'Message' => $message
|
||||
);
|
||||
$this->lastChange['ChangeType'] = 'deleted';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user