refactor(plugin): rename Plan to Program and add audience/UTM routes
Rename the Plan bundle to Program across config, routes, menus, and controllers (Plan -> Initiative), bump version to 0.16.0, and introduce new audience and UTM taxonomy routes and permissions to support the expanded Programs feature set.
This commit is contained in:
1 parent
8268fad886
commit
71ff11390b
121 files changed
+5011
-2874
No files matched your search
@@ -2,23 +2,23 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\PlanBundle\Migrations;
|
||||
namespace MauticPlugin\ProgramBundle\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\DBAL\Schema\Table;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
use MauticPlugin\PlanBundle\Entity\Plan;
|
||||
use MauticPlugin\PlanBundle\Entity\Task;
|
||||
use MauticPlugin\ProgramBundle\Entity\Initiative;
|
||||
use MauticPlugin\ProgramBundle\Entity\Task;
|
||||
|
||||
/**
|
||||
* Adds the plan_tasks table and its foreign keys to installs created before 0.4.0.
|
||||
* Adds the initiative_tasks table and its foreign keys to installs created before 0.4.0.
|
||||
*
|
||||
* The CREATE TABLE comes from the Task mapping, so it can't drift from the entity. Only that statement
|
||||
* is kept: SchemaTool's output also contains statements for other tables (for example Symfony
|
||||
* Messenger's messenger_messages), which would fail on an existing install.
|
||||
*
|
||||
* The foreign keys are added one by one when missing, so the migration also repairs a plan_tasks table
|
||||
* The foreign keys are added one by one when missing, so the migration also repairs a initiative_tasks table
|
||||
* that exists without them. Fresh installs get everything from the entity mapping, so this migration
|
||||
* then finds nothing to do.
|
||||
*/
|
||||
@@ -31,20 +31,16 @@ class Version_0_4_0 extends AbstractMigration
|
||||
* so only plan_id is repaired here.
|
||||
*/
|
||||
private const FOREIGN_KEYS = [
|
||||
'plan_id' => [Plan::TABLE_NAME, 'CASCADE'],
|
||||
'plan_id' => [Initiative::TABLE_NAME, 'CASCADE'],
|
||||
];
|
||||
|
||||
protected function isApplicable(Schema $schema): bool
|
||||
{
|
||||
if (!$schema->hasTable($this->concatPrefix(Plan::TABLE_NAME))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tasks = $this->concatPrefix(Task::TABLE_NAME);
|
||||
|
||||
$table = $schema->hasTable($tasks) ? $schema->getTable($tasks) : null;
|
||||
|
||||
return null === $table || [] !== $this->getMissingForeignKeys($table);
|
||||
// Historical migration: its changes were applied on every install that ran
|
||||
// it before 0.16.0 (this plugin renamed Plan→Program/Initiative in 0.16.0), and
|
||||
// a fresh install creates the current tables from the entity mapping. Never
|
||||
// applicable anymore.
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function up(): void
|
||||
|
||||
Reference in new issue
Block a user