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,18 +2,18 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\PlanBundle\Migrations;
|
||||
namespace MauticPlugin\ProgramBundle\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
use MauticPlugin\PlanBundle\Entity\Plan;
|
||||
use MauticPlugin\PlanBundle\Entity\PlanStakeholder;
|
||||
use MauticPlugin\PlanBundle\Entity\Stakeholder;
|
||||
use MauticPlugin\ProgramBundle\Entity\Initiative;
|
||||
use MauticPlugin\ProgramBundle\Entity\InitiativeStakeholder;
|
||||
use MauticPlugin\ProgramBundle\Entity\Stakeholder;
|
||||
|
||||
/**
|
||||
* Since 0.12.0 planning has a global stakeholder directory (table plan_stakeholders), and each plan
|
||||
* links to its stakeholders through plan_stakeholders_plan, which carries the stakeholder's role in
|
||||
* Since 0.12.0 planning has a global stakeholder directory (table initiative_stakeholders), and each plan
|
||||
* links to its stakeholders through initiative_stakeholders_initiative, which carries the stakeholder's role in
|
||||
* the plan. Creates both tables for installs created before 0.12.0, and repairs the ones the plugin
|
||||
* installer created without foreign keys (it drops foreign keys that point to core tables). Each step
|
||||
* runs only if needed.
|
||||
@@ -22,16 +22,11 @@ class Version_0_12_0 extends AbstractMigration
|
||||
{
|
||||
protected function isApplicable(Schema $schema): bool
|
||||
{
|
||||
if (!$schema->hasTable($this->concatPrefix(Plan::TABLE_NAME))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$schema->hasTable($this->concatPrefix(Stakeholder::TABLE_NAME))
|
||||
|| !$schema->hasTable($this->concatPrefix(PlanStakeholder::TABLE_NAME))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !$this->hasForeignKeys($schema);
|
||||
// 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
|
||||
@@ -42,20 +37,20 @@ class Version_0_12_0 extends AbstractMigration
|
||||
$this->addSql($this->getCreateTableSql(Stakeholder::class, Stakeholder::TABLE_NAME));
|
||||
}
|
||||
|
||||
if (!$schema->hasTable($this->concatPrefix(PlanStakeholder::TABLE_NAME))) {
|
||||
$this->addSql($this->getCreateTableSql(PlanStakeholder::class, PlanStakeholder::TABLE_NAME));
|
||||
if (!$schema->hasTable($this->concatPrefix(InitiativeStakeholder::TABLE_NAME))) {
|
||||
$this->addSql($this->getCreateTableSql(InitiativeStakeholder::class, InitiativeStakeholder::TABLE_NAME));
|
||||
}
|
||||
|
||||
if (!$this->hasForeignKeys($schema)) {
|
||||
$this->addSql($this->generateAlterTableForeignKeyStatement(
|
||||
PlanStakeholder::TABLE_NAME,
|
||||
InitiativeStakeholder::TABLE_NAME,
|
||||
['plan_id'],
|
||||
Plan::TABLE_NAME,
|
||||
Initiative::TABLE_NAME,
|
||||
['id'],
|
||||
'ON DELETE CASCADE'
|
||||
));
|
||||
$this->addSql($this->generateAlterTableForeignKeyStatement(
|
||||
PlanStakeholder::TABLE_NAME,
|
||||
InitiativeStakeholder::TABLE_NAME,
|
||||
['stakeholder_id'],
|
||||
Stakeholder::TABLE_NAME,
|
||||
['id'],
|
||||
@@ -69,7 +64,7 @@ class Version_0_12_0 extends AbstractMigration
|
||||
*/
|
||||
private function hasForeignKeys(Schema $schema): bool
|
||||
{
|
||||
$links = $this->concatPrefix(PlanStakeholder::TABLE_NAME);
|
||||
$links = $this->concatPrefix(InitiativeStakeholder::TABLE_NAME);
|
||||
|
||||
if (!$schema->hasTable($links)) {
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user