Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Commit

Permalink
Save original AC values on entity load.
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed May 14, 2018
1 parent 090ec9a commit 7f887ae
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ class Entity implements EntityInterface {
* @access private
*/
private $useSkipAc = false;
/**
* The AC properties' values when the entity was loaded.
*
* @var array
* @access private
*/
private $originalAcValues = [];

/**
* Load an entity.
Expand Down Expand Up @@ -698,6 +705,10 @@ public function getSData() {
return $this->sdata;
}

public function getOriginalAcValues() {
return $this->originalAcValues;
}

public function getValidatable() {
if ($this->isASleepingReference) {
$this->referenceWake();
Expand Down Expand Up @@ -892,6 +903,15 @@ public function putData($data, $sdata = []) {
}
$this->data = $data;
$this->sdata = $sdata;

$this->originalAcValues['user'] = $this->user;
$this->originalAcValues['group'] = $this->group;
$this->originalAcValues['acUser'] = $this->acUser;
$this->originalAcValues['acGroup'] = $this->acGroup;
$this->originalAcValues['acOther'] = $this->acOther;
$this->originalAcValues['acRead'] = $this->acRead;
$this->originalAcValues['acWrite'] = $this->acWrite;
$this->originalAcValues['acFull'] = $this->acFull;
}

/**
Expand Down
6 changes: 6 additions & 0 deletions src/EntityInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ public function getData($includeSData = false);
* @access protected
*/
public function getSData();
/**
* Get the original values of the AC properties.
*
* @return array An associative array of AC properties.
*/
public function getOriginalAcValues();
/**
* Get a stdClass object that holds the same data as the entity.
*
Expand Down

0 comments on commit 7f887ae

Please sign in to comment.