/**
  * @param DbFactory $dbFactory
  * @param string $table
  * @param string[] $primaryKey
  * @throws DataModelException
  */
 public function __construct(DbFactory $dbFactory, $table, array $primaryKey)
 {
     if (!$primaryKey) {
         throw new DataModelException('PK required', 'process-data');
     }
     parent::__construct($dbFactory);
     $this->table = $table;
     $this->primaryKey = $primaryKey;
 }
 /**
  * Gets the required updates.  Any changes to External Store will be reflected in
  * the returned array.
  *
  * @param array $old Associative array mapping prior columns to old values
  * @param array $new Associative array mapping updated columns to new values
  *
  * @return array Validated change set as associative array, mapping columns to
  *   change to their new values
  */
 public function calcUpdates(array $old, array $new)
 {
     // First, see if there are any changes to content at all.
     // If not, processExternalStore will know not to insert a useless row for
     // unchanged content (if updating content is allowed).
     $unvalidatedChangeset = ObjectManager::calcUpdatesWithoutValidation($old, $new);
     // We check here so if it's not allowed, we don't insert a wasted External
     // Store entry, then throw an exception in the parent calcUpdates.
     if ($this->isUpdatingExistingRevisionContentAllowed()) {
         $unvalidatedChangeset = $this->processExternalStore($unvalidatedChangeset);
     }
     // The parent calcUpdates does the validation that we're not changing a non-allowed
     // field, regardless of whether explicitly passed in, or done by processExternalStore.
     $validatedChangeset = parent::calcUpdates(array(), $unvalidatedChangeset);
     return $validatedChangeset;
 }