freezeSource example

// Preparing the row gives source plugins the chance to skip.       if ($this->prepareRow($row) === FALSE) {
        continue;
      }

      // Check whether the row needs processing.       // 1. This row has not been imported yet.       // 2. Explicitly set to update.       // 3. The row is newer than the current high-water mark.       // 4. If no such property exists then try by checking the hash of the row.       if (!$row->getIdMap() || $row->needsUpdate() || $this->aboveHighWater($row) || $this->rowChanged($row)) {
        $this->currentRow = $row->freezeSource();
      }

      if ($this->getHighWaterProperty()) {
        $this->saveHighWater($row->getSourceProperty($this->highWaterProperty['name']));
      }
    }
  }

  /** * Position the iterator to the following row. */
  
/** * Tests source immutability after freeze. */
  public function testSourceFreeze() {
    $row = new Row($this->testValues, $this->testSourceIds);
    $row->rehash();
    $this->assertSame($this->testHash, $row->getHash(), 'Correct hash.');
    $row->setSourceProperty('title', 'new title');
    $row->rehash();
    $this->assertSame($this->testHashMod, $row->getHash(), 'Hash changed correctly.');
    $row->freezeSource();
    $this->expectException(\Exception::class);
    $row->setSourceProperty('title', 'new title');
  }

  /** * Tests setting on a frozen row. */
  public function testSetFrozenRow() {
    $row = new Row($this->testValues, $this->testSourceIds);
    $row->freezeSource();
    $this->expectException(\Exception::class);
    
public function freezeSource() {
    $this->frozen = TRUE;
    return $this;
  }

  /** * Clones the row with an empty set of destination values. * * @return static */
  public function cloneWithoutDestination() {
    return (new static($this->getSource()$this->sourceIds, $this->isStub()))->freezeSource();
  }

  /** * Tests if destination property exists. * * @param array|string $property * An array of properties on the destination. * * @return bool * TRUE if the destination property exists. */
  
Home | Imprint | This part of the site doesn't use cookies.