Skip to content

Allow migration of custom link types #111

Answered by engram-design
pixelmachine asked this question in Q&A
Discussion options

You must be logged in to vote

So yep, there's no handling for custom link types as you'd need to provide a source and destination class to convert them to. But you can of course use an event to register your own handling of these custom types. See docs

This will modify the typeMap property to translate what the old link type was to the new one. Yours would look something like:

use verbb\hyper\events\ModifyMigrationLinkEvent;
use verbb\hyper\migrations\MigrateTypedLinkField;
use verbb\hyper\migrations\MigrateTypedLinkContent;
use yii\base\Event;

Event::on(MigrateTypedLinkField::class, MigrateTypedLinkField::EVENT_MODIFY_LINK_TYPE, function(ModifyMigrationLinkEvent $event) {
    if ($event->oldClass === 'book') {
        

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@engram-design
Comment options

Answer selected by pixelmachine
@pixelmachine
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants