/**
  * Calculates the DB updates to be performed to update data from $old to
  * $new.
  *
  * @param array $old
  * @param array $new
  * @return array
  * @throws DataModelException
  */
 public function calcUpdates(array $old, array $new)
 {
     $changeSet = ObjectManager::calcUpdatesWithoutValidation($old, $new);
     foreach ($this->obsoleteUpdateColumns as $val) {
         // Need to use array_key_exists to check null value
         if (array_key_exists($val, $changeSet)) {
             unset($changeSet[$val]);
         }
     }
     if (is_array($this->allowedUpdateColumns)) {
         $extra = array_diff(array_keys($changeSet), $this->allowedUpdateColumns);
         if ($extra) {
             throw new DataModelException('Update not allowed on: ' . implode(', ', $extra), 'process-data');
         }
     }
     return $changeSet;
 }
 /**
  * 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;
 }