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;
@@ -16,20 +16,20 @@ use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Mapping\ClassMetadata;
/**
* A stakeholder of the planning: a person, a company or a team involved in the plans ("Agency XYZ",
* "Exec committee"). Stakeholders are a global directory (Planning > Stakeholders), independent of
* plans; a plan links to them through PlanStakeholder, which carries the stakeholder's role in that
* plan.
* A stakeholder of the program: a person, a company or a team involved in the initiatives ("Agency XYZ",
* "Exec committee"). Stakeholders are a global directory (Programs > Stakeholders), independent of
* initiatives; an initiative links to them through InitiativeStakeholder, which carries the stakeholder's role in that
* initiative.
*
* The type is the key of a stakeholder type set up in Settings > Configuration > Plan Settings
* (parameter plan_stakeholder_types); see ItemTypeProvider (kind "stakeholder").
* The type is the key of a stakeholder type set up in Settings > Configuration > Initiative Settings
* (parameter program_stakeholder_types); see ItemTypeProvider (kind "stakeholder").
*
* isPublished (from FormEntity) means "active": an unpublished stakeholder is hidden from the plan
* form's stakeholder picker, but keeps its history on the plans it is already linked to.
* isPublished (from FormEntity) means "active": an unpublished stakeholder is hidden from the initiative
* form's stakeholder picker, but keeps its history on the initiatives it is already linked to.
*/
class Stakeholder extends FormEntity
{
public const TABLE_NAME = 'plan_stakeholders';
public const TABLE_NAME = 'initiative_stakeholders';
public const TYPE_MAX_LENGTH = 64;
@@ -50,16 +50,16 @@ class Stakeholder extends FormEntity
private ?string $type = null;
/**
* The links to the plans this stakeholder is assigned to. Inverse side, read-only from here: the
* links are managed from the plans (Plan::addStakeholder/removeStakeholder).
* The links to the initiatives this stakeholder is assigned to. Inverse side, read-only from here: the
* links are managed from the plans (Initiative::addStakeholder/removeStakeholder).
*
* @var Collection<int, PlanStakeholder>
* @var Collection<int, InitiativeStakeholder>
*/
private Collection $planLinks;
private Collection $initiativeLinks;
public function __construct()
{
$this->planLinks = new ArrayCollection();
$this->initiativeLinks = new ArrayCollection();
}
public static function loadMetadata(OrmClassMetadata $metadata): void
@@ -96,19 +96,19 @@ class Stakeholder extends FormEntity
->nullable()
->build();
$builder->createOneToMany('planLinks', PlanStakeholder::class)
$builder->createOneToMany('initiativeLinks', InitiativeStakeholder::class)
->mappedBy('stakeholder')
->fetchExtraLazy()
->build();
$builder->addIndex(['email'], 'plan_stakeholder_email');
$builder->addIndex(['email'], 'program_stakeholder_email');
}
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addPropertyConstraint('name', new NotBlank(message: 'mautic.core.name.required'));
$metadata->addPropertyConstraint('name', new Length(max: 191));
$metadata->addPropertyConstraint('email', new Email(mode: Email::VALIDATION_MODE_HTML5, message: 'mautic.plan.stakeholder.email.invalid'));
$metadata->addPropertyConstraint('email', new Email(mode: Email::VALIDATION_MODE_HTML5, message: 'mautic.program.stakeholder.email.invalid'));
$metadata->addPropertyConstraint('email', new Length(max: 191));
$metadata->addPropertyConstraint('phone', new Length(max: 50));
$metadata->addPropertyConstraint('role', new Length(max: 191));
@@ -178,13 +178,13 @@ class Stakeholder extends FormEntity
}
/**
* The links to the plans this stakeholder is assigned to, each with its role in that plan.
* The links to the initiatives this stakeholder is assigned to, each with its role in that initiative.
*
* @return Collection<int, PlanStakeholder>
* @return Collection<int, InitiativeStakeholder>
*/
public function getPlanLinks(): Collection
public function getInitiativeLinks(): Collection
{
return $this->planLinks;
return $this->initiativeLinks;
}
public function setType(?string $type): static