ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
PersistenceTrackingDataImplementation.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 {
25  private bool $contains_changes = false;
26 
30  abstract public function isPersisted(): bool;
31 
35  abstract protected function getSubData(): \Generator;
36 
42  final public function containsChanges(): bool
43  {
44  if (!$this->isPersisted() || $this->contains_changes) {
45  return true;
46  }
47  foreach ($this->getSubData() as $sub_datum) {
48  if ($sub_datum->containsChanges()) {
49  return true;
50  }
51  }
52  return false;
53  }
54 
55  final protected function markAsChanged(): void
56  {
57  $this->contains_changes = true;
58  }
59 }
containsChanges()
Was the contained data (including sub-objects) altered with respect to what is persisted? Returns true if not persisted.