Add full support for sets
This commit is contained in:
parent
c2f3e7493e
commit
6c700c6f24
|
@ -109,7 +109,14 @@ class Database
|
|||
if ($newRecord->hasContent() || Configuration::getInstance()->deletedRecords !== 'no') {
|
||||
$oldRecord->setContent($newRecord->getContent(), false);
|
||||
$oldRecord->setLastChanged($newRecord->getLastChanged());
|
||||
// TODO: Add full set support.
|
||||
// Add new sets.
|
||||
foreach (array_diff($newRecord->getSets(), $oldRecord->getSets()) as $newSet) {
|
||||
$oldRecord->addSet($newSet);
|
||||
}
|
||||
// Remove old sets.
|
||||
foreach (array_diff($oldRecord->getSets(), $newRecord->getSets()) as $oldSet) {
|
||||
$oldRecord->removeSet($oldSet);
|
||||
}
|
||||
} else {
|
||||
$this->entityManager->remove($oldRecord);
|
||||
}
|
||||
|
|
|
@ -209,4 +209,14 @@ class Set extends Entity
|
|||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the set's string representation for comparison.
|
||||
*
|
||||
* @return string The set's unique spec
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->getSpec();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue