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:
Alexandre Gain committed 2026-11-13 22:01:32 +01:00
1 parent 8268fad886
commit 71ff11390b
121 files changed
+5011 -2874

No files matched your search

+22 -22
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\PlanBundle\Entity;
namespace MauticPlugin\ProgramBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
@@ -10,9 +10,9 @@ use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata;
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
use Mautic\CoreBundle\Entity\FormEntity;
use MauticPlugin\PlanBundle\Validator\Constraints\EndDateAfterStartDate;
use MauticPlugin\PlanBundle\Validator\Constraints\TaskDates;
use MauticPlugin\PlanBundle\Validator\Constraints\ValidTaskDependency;
use MauticPlugin\ProgramBundle\Validator\Constraints\EndDateAfterStartDate;
use MauticPlugin\ProgramBundle\Validator\Constraints\TaskDates;
use MauticPlugin\ProgramBundle\Validator\Constraints\ValidTaskDependency;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\PositiveOrZero;
@@ -20,7 +20,7 @@ use Symfony\Component\Validator\Constraints\Range;
use Symfony\Component\Validator\Mapping\ClassMetadata;
/**
* A task of a plan. Every task belongs to exactly one plan.
* A task of an initiative. Every task belongs to exactly one initiative.
*
* Kinds (taskKind): a regular task; a milestone, whose end date is enslaved to its start date; or a
* phase, which has no status of its own — it is a collection of tasks.
@@ -29,15 +29,15 @@ use Symfony\Component\Validator\Mapping\ClassMetadata;
* End2End, Start2Start or Start2End. The former parent/child tree is replaced by this dependency
* graph.
*
* RACI: a task is assigned to the plan's stakeholders through TaskRaci rows (R/A/C/I), several
* RACI: a task is assigned to the initiative's stakeholders through TaskRaci rows (R/A/C/I), several
* stakeholders per role.
*
* Database rules: deleting the plan deletes its tasks (ON DELETE CASCADE); deleting a task deletes
* Database rules: deleting the initiative deletes its tasks (ON DELETE CASCADE); deleting a task deletes
* its dependencies and RACI rows (ON DELETE CASCADE).
*/
class Task extends FormEntity implements DateRangeInterface
{
public const TABLE_NAME = 'plan_tasks';
public const TABLE_NAME = 'initiative_tasks';
public const TYPE_MAX_LENGTH = 64;
@@ -48,10 +48,10 @@ class Task extends FormEntity implements DateRangeInterface
private ?int $id = null;
private ?Plan $plan = null;
private ?Initiative $initiative = null;
/**
* Key of a task type set up in Settings > Configuration > Plan Settings (parameter plan_task_types);
* Key of a task type set up in Settings > Configuration > Program Settings (parameter program_task_types);
* see ItemTypeProvider (kind "task") for its name, description and pictogram.
*/
private ?string $type = null;
@@ -106,9 +106,9 @@ class Task extends FormEntity implements DateRangeInterface
$builder->addId();
$builder->createManyToOne('plan', Plan::class)
$builder->createManyToOne('initiative', Initiative::class)
->inversedBy('tasks')
->addJoinColumn('plan_id', 'id', false, false, 'CASCADE')
->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE')
->build();
$builder->createField('type', Types::STRING)
@@ -132,7 +132,7 @@ class Task extends FormEntity implements DateRangeInterface
'enumType' => TaskStatus::class,
'options' => ['default' => TaskStatus::New->value],
]);
$builder->addIndex(['status'], 'plan_task_status');
$builder->addIndex(['status'], 'program_task_status');
$metadata->mapField([
'fieldName' => 'taskKind',
@@ -191,11 +191,11 @@ class Task extends FormEntity implements DateRangeInterface
{
$metadata->addPropertyConstraint('name', new NotBlank(message: 'mautic.core.name.required'));
$metadata->addPropertyConstraint('name', new Length(max: 255));
$metadata->addPropertyConstraint('plan', new NotBlank(message: 'mautic.plan.task.plan.required'));
$metadata->addPropertyConstraint('type', new NotBlank(message: 'mautic.plan.task.type.required'));
$metadata->addPropertyConstraint('initiative', new NotBlank(message: 'mautic.program.task.initiative.required'));
$metadata->addPropertyConstraint('type', new NotBlank(message: 'mautic.program.task.type.required'));
$metadata->addPropertyConstraint('type', new Length(max: self::TYPE_MAX_LENGTH));
$metadata->addPropertyConstraint('plannedWork', new PositiveOrZero(message: 'mautic.plan.task.planned_work.invalid'));
$metadata->addPropertyConstraint('plannedWork', new Range(notInRangeMessage: 'mautic.plan.task.planned_work.range', min: 0, max: self::PLANNED_WORK_MAX));
$metadata->addPropertyConstraint('plannedWork', new PositiveOrZero(message: 'mautic.program.task.planned_work.invalid'));
$metadata->addPropertyConstraint('plannedWork', new Range(notInRangeMessage: 'mautic.program.task.planned_work.range', min: 0, max: self::PLANNED_WORK_MAX));
$metadata->addConstraint(new EndDateAfterStartDate());
$metadata->addConstraint(new TaskDates());
$metadata->addConstraint(new ValidTaskDependency());
@@ -206,15 +206,15 @@ class Task extends FormEntity implements DateRangeInterface
return $this->id;
}
public function getPlan(): ?Plan
public function getInitiative(): ?Initiative
{
return $this->plan;
return $this->initiative;
}
public function setPlan(?Plan $plan): static
public function setInitiative(?Initiative $initiative): static
{
$this->isChanged('plan', $plan);
$this->plan = $plan;
$this->isChanged('initiative', $initiative);
$this->initiative = $initiative;
return $this;
}