Skip to content

Commit

Permalink
Migration Task Step 2: Pass ignoredClasses to query so they are nev…
Browse files Browse the repository at this point in the history
…er retrieved
  • Loading branch information
lbradley-mm committed Sep 27, 2024
1 parent 3cb2a1e commit 95a2954
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Tasks/MigrationTaskStep2.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ class MigrationTaskStep2 extends BuildTask
;
SQL;

/**
* List of Classes to ignore
*
* @config
* @var array
*/
private static $ignored_classes = [];

private $requestCount = 0;
Expand All @@ -165,15 +171,18 @@ public function run($request)
$dataObjectClasses = ClassInfo::subclassesFor(DataObject::class, false);
$schema = DataObject::getSchema();

$ignoredClasses = static::config()->get('ignored_classes');
/**
*
*/
foreach($dataObjectClasses As $className) {
if (in_array($className, static::config()->get('ignored_classes'))) {
if (in_array($className, $ignoredClasses)) {
continue;
}

DataObject::get($className)->each(function (DataObject $do) use ($schema) {
DataObject::get($className)->filter([
'ClassName:not' => $ignoredClasses,
])->each(function (DataObject $do) use ($schema) {
$stages = [
Versioned::DRAFT => '',
];
Expand Down

0 comments on commit 95a2954

Please sign in to comment.