private function thenTheRelatedRecordIdentifierShouldHaveBeenUpdatedInTheRepository()
 {
     $identifier = $this->relatedRecord->getIdentifierAsString();
     $table = $this->relatedRecord->getTable();
     $repository = $table->getRepository();
     $this->assertFalse($repository->hasByInternalId($this->oldIdentifierRelatedRecord));
     $this->assertTrue($repository->hasByInternalId($identifier));
 }
Ejemplo n.º 2
0
 /**
  * Updates identity map on record insert/update or removes identity map entry on record delete
  * Refreshes record identity in repository
  *
  * @param Record $record
  * @param string $oldInternalIdentifier
  */
 public function refreshIdentity(Record $record, $oldInternalIdentifier = null)
 {
     $oid = $record->getOid();
     if (!$this->has($oid)) {
         return;
     }
     $id = $record->getIdentifierAsString();
     if ($record->exists()) {
         if ($oldInternalIdentifier) {
             unset($this->identityMap[$oldInternalIdentifier]);
         }
         $this->identityMap[$id] = $record->getOid();
     } else {
         unset($this->identityMap[$id]);
     }
 }