function Book::updateEntity

Same name in other branches
  1. 9 core/modules/book/src/Plugin/migrate/destination/Book.php \Drupal\book\Plugin\migrate\destination\Book::updateEntity()
  2. 8.9.x core/modules/book/src/Plugin/migrate/destination/Book.php \Drupal\book\Plugin\migrate\destination\Book::updateEntity()
  3. 10 core/modules/book/src/Plugin/migrate/destination/Book.php \Drupal\book\Plugin\migrate\destination\Book::updateEntity()

Overrides EntityContentBase::updateEntity

File

core/modules/book/src/Plugin/migrate/destination/Book.php, line 27

Class

Book
Plugin annotation @MigrateDestination( id = "book", provider = "book" )

Namespace

Drupal\book\Plugin\migrate\destination

Code

protected function updateEntity(EntityInterface $entity, Row $row) {
    if ($entity->book) {
        $book = $row->getDestinationProperty('book');
        foreach ($book as $key => $value) {
            $entity->book[$key] = $value;
        }
    }
    else {
        $entity->book = $row->getDestinationProperty('book');
    }
    return parent::updateEntity($entity, $row);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.