'onDumpPre', ]; } protected static function setParents(TermInterface $term, $tid, TermStorageInterface $storage) { $parents = $storage->loadParents($term->id()); if (!empty($parents)) { $term->set('parent', array_keys($parents)); } } public static function onDumpPre(DumperEvent $event) { $storage = $event->storage; if ($storage->getEntityTypeId() !== 'taxonomy_term') { return; } array_walk($event->entities, [__CLASS__, 'setParents'], $storage); } }