Skip to content

Commit

Permalink
Fix issues with TV's Media Sources after upgrading to MODX 3 (#16338)
Browse files Browse the repository at this point in the history
* Update legacy class references in `modMediaSourceElement::class` `object_class` column

This will fix an "PHP Fatal error: Cannot declare class modTemplateVarInputRenderText, because the name is already in use" after upgrade to MODX 3.

* Change @Property to @var in upgrade script

Co-authored-by: Jason Coward <jason@opengeek.com>
  • Loading branch information
JoshuaLuckers and opengeek authored Jan 12, 2023
1 parent 3e5fb41 commit ad6977d
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


/**
* @property modX $modx
* @var modX $modx
*/

use MODX\Revolution\modChunk;
Expand All @@ -20,6 +20,7 @@
use MODX\Revolution\modSnippet;
use MODX\Revolution\modTemplate;
use MODX\Revolution\modTemplateVar;
use MODX\Revolution\Sources\modMediaSourceElement;

/* modify legacy core class references in modElementPropertySet element_class column */

Expand All @@ -34,3 +35,13 @@
$modx->updateCollection($class, ['element_class' => modTemplateVar::class], ['element_class' => 'modTemplateVar']);
$modx->updateCollection($class, ['element_class' => modPlugin::class], ['element_class' => 'modPlugin']);
$modx->updateCollection($class, ['element_class' => modSnippet::class], ['element_class' => 'modSnippet']);

/* modify legacy core class references in modMediaSourceElement object_class column */

$class = modMediaSourceElement::class;
$table = $modx->getTableName($class);

$elementClass = $this->install->lexicon('alter_column', ['column' => 'object_class', 'table' => $table]);
$this->processResults($class, $elementClass, [$modx->manager, 'alterField'], [$class, 'object_class']);

$modx->updateCollection($class, ['object_class' => modTemplateVar::class], ['object_class' => 'modTemplateVar']);

0 comments on commit ad6977d

Please sign in to comment.