# give/4.16.9/src/FormMigration/Actions/TransferFormUrl.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.16.9. 31 lines.

- Page: https://pluginprobe.com/plugins/give/4.16.9/code/src/FormMigration/Actions/TransferFormUrl.php
- Raw: https://pluginprobe.com/plugins/give/4.16.9/raw/src/FormMigration/Actions/TransferFormUrl.php
- Modified: 2023-10-16T17:55:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.16.9/code/src/FormMigration/Actions/TransferFormUrl.php#L10-L20`.

```php
<?php

namespace Give\FormMigration\Actions;

class TransferFormUrl
{
    protected $sourceId;

    public function __construct($sourceId)
    {
        $this->sourceId = $sourceId;
    }

    public static function from($sourceId): self
    {
        return new TransferFormUrl($sourceId);
    }

    public function to($destinationId): void
    {
        $this->__invoke($destinationId);
    }

    public function __invoke($destinationId)
    {
        $postName = get_post($this->sourceId)->post_name;
        wp_update_post(['ID' => $this->sourceId, 'post_name' => $postName . '-v2']);
        wp_update_post(['ID' => $destinationId, 'post_name' => $postName]);
    }
}

```
