# Material Type Migrators
If you need to update/remove Material content data, or Material properties when migrating/copying Material from one Material Type to another, you can use Material Type Migrator for this.
In this example material type migrator is used not to remove disclaimer content when migrating/copying template Material Type to fragment Material Type:
<?php
// CLIENT_CONFIG/config/material_type_migrator.php
use Config\MaterialTypeMigrator;
MaterialTypeMigrator::create()
->from('ae.template.flex')
->to('ae.fragment.flex')
->with(function (array &$contentData, array &$properties) {
$fieldsNotToCopy = [
'disclaimer'
];
foreach ($fieldsNotToCopy as $key) {
if (isset($contentData[$key])) {
unset($contentData[$key]);
}
}
});
In this example Material Type migrator is used to remove property product when migrating/copying any Material Type to any Material Type:
<?php
// CLIENT_CONFIG/config/material_type_migrator.php
use Config\MaterialTypeMigrator;
use App\Services\FieldSetupService;
MaterialTypeMigrator::create()
->from('*')
->to('*')
->with(function (array &$contentData, array &$properties) {
$fieldsNotToCopy = [
'product'
];
foreach ($fieldsNotToCopy as $key) {
if (isset($properties[$key])) {
unset($properties[$key]);
}
}
$properties = \App::get(FieldSetupService::class)->setDefaultValues($properties);
});
# Material type migrator options
| Parameter | Description |
|---|---|
from | From Material Type (FQN) |
to | To Material Type (FQN) |
with | Callable used to alter content data or properties |