refactor(plugin): rebrand as MT3SMarketingProgram, release 0.17.0

Rename the plugin's vendor/namespace from experiential/Program to mt3s/MT3SMarketingProgram (composer: mt3s/mautic-marketing-program-bundle):

- ProgramBundle -> MT3SMarketingProgramBundle; extension, integration,
  config support, permissions, events and twig extension renamed likewise
- Initiative* -> Program*: controller (InitiativeController ->
  ProgramController), model, entities, repositories, form types and views
  (new _tabs/_task_table/_tab_table_filter partials, details page)
- Settings config form theme -> _config_mt3smarketingprogramconfig_widget;
  routes and translations re-prefixed (mt3s_marketing_program_*)
- Assets: icon.svg -> mt3s-mp-icon.svg; program.js -> mt3s-mp-program.js
  (OnLoad hooks renamed mt3sMpProgram*)
- Add Command/RefreshStatsCommand; Migrations/Version_0_17_0.php renames
  the tables to mt3s_mp_program_*
This commit is contained in:
Alexandre Gain committed 2026-11-15 17:48:01 +01:00
1 parent 687d33d30c
commit ea88b7a772
131 files changed
+3238 -2836

No files matched your search

+34 -34
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
@@ -19,11 +19,11 @@ use Symfony\Component\Validator\Mapping\ClassMetadata;
/**
* One audience of the global directory (Programs > Audiences): who the plan is aimed at, and how.
* Audiences are independent of plans; a plan links to them from its Audiences tab through InitiativeAudience,
* which carries the audience's priority in that plan, and possibly a initiative-specific message.
* Audiences are independent of plans; a plan links to them from its Audiences tab through ProgramAudience,
* which carries the audience's priority in that plan, and possibly a program-specific message.
*
* Which attributes are offered on the forms is set up by the admin in Settings > Configuration >
* Initiative Settings (per-attribute toggles, so a b2b install and a b2c install define their personas
* Program Settings (per-attribute toggles, so a b2b install and a b2c install define their personas
* differently); the decision roles and the tones are lists edited there too. See AudienceAttributes.
*
* The stages are the Mautic stages (Settings > Stages) this audience maps to; an audience can have
@@ -33,26 +33,26 @@ use Symfony\Component\Validator\Mapping\ClassMetadata;
* informational: the user may assign none, one or several; the list view shows their names and
* their contact counts. Deleting a segment removes the link, not the audience.
*
* isPublished (from FormEntity) means "active": an unpublished audience is hidden from the initiative
* form's audience picker, but keeps its history on the initiatives it is already linked to.
* isPublished (from FormEntity) means "active": an unpublished audience is hidden from the program
* form's audience picker, but keeps its history on the mt3s_mp_programs it is already linked to.
*/
class Audience extends FormEntity
{
public const TABLE_NAME = 'initiative_audiences';
public const TABLE_NAME = 'mt3s_mp_program_audiences';
/**
* Keys offered for preferredChannels, in display order.
*/
public const CHANNELS = [
'email' => 'mautic.program.audience.channel.email',
'sms' => 'mautic.program.audience.channel.sms',
'web' => 'mautic.program.audience.channel.web',
'social_organic' => 'mautic.program.audience.channel.social_organic',
'paid_social' => 'mautic.program.audience.channel.paid_social',
'paid_search' => 'mautic.program.audience.channel.paid_search',
'events_webinar' => 'mautic.program.audience.channel.events_webinar',
'outbound_sales' => 'mautic.program.audience.channel.outbound_sales',
'partners' => 'mautic.program.audience.channel.partners',
'email' => 'mt3s.marketing_program.audience.channel.email',
'sms' => 'mt3s.marketing_program.audience.channel.sms',
'web' => 'mt3s.marketing_program.audience.channel.web',
'social_organic' => 'mt3s.marketing_program.audience.channel.social_organic',
'paid_social' => 'mt3s.marketing_program.audience.channel.paid_social',
'paid_search' => 'mt3s.marketing_program.audience.channel.paid_search',
'events_webinar' => 'mt3s.marketing_program.audience.channel.events_webinar',
'outbound_sales' => 'mt3s.marketing_program.audience.channel.outbound_sales',
'partners' => 'mt3s.marketing_program.audience.channel.partners',
];
private ?int $id = null;
@@ -92,13 +92,13 @@ class Audience extends FormEntity
private ?string $triggers = null;
/**
* Key of a decision role set up in Settings > Configuration > Initiative Settings
* Key of a decision role set up in Settings > Configuration > Program Settings
* (parameter program_audience_decision_roles), or null when the attribute is unused.
*/
private ?string $decisionRole = null;
/**
* Keys of tones set up in Settings > Configuration > Initiative Settings
* Keys of tones set up in Settings > Configuration > Program Settings
* (parameter program_audience_tones), or null/[] when the attribute is unused.
*
* @var list<string>|null
@@ -106,7 +106,7 @@ class Audience extends FormEntity
private ?array $preferredTones = null;
/**
* Keys of self::CHANNELS the initiative means to use for this audience.
* Keys of self::CHANNELS the program means to use for this audience.
*
* @var list<string>|null
*/
@@ -132,18 +132,18 @@ class Audience extends FormEntity
private ?int $estimatedSize = null;
/**
* The links to the initiatives this audience is assigned to. Inverse side, read-only from here: the
* links are managed from the plans (Initiative::addAudience/removeAudience).
* The links to the mt3s_mp_programs this audience is assigned to. Inverse side, read-only from here: the
* links are managed from the plans (Program::addAudience/removeAudience).
*
* @var Collection<int, InitiativeAudience>
* @var Collection<int, ProgramAudience>
*/
private Collection $initiativeLinks;
private Collection $programLinks;
public function __construct()
{
$this->stages = new ArrayCollection();
$this->segments = new ArrayCollection();
$this->initiativeLinks = new ArrayCollection();
$this->programLinks = new ArrayCollection();
}
public function __clone()
@@ -151,7 +151,7 @@ class Audience extends FormEntity
$this->id = null;
$this->stages = new ArrayCollection();
$this->segments = new ArrayCollection();
$this->initiativeLinks = new ArrayCollection();
$this->programLinks = new ArrayCollection();
parent::__clone();
}
@@ -213,13 +213,13 @@ class Audience extends FormEntity
->build();
$builder->createManyToMany('stages', Stage::class)
->setJoinTable('initiative_audiences_stages')
->setJoinTable('mt3s_mp_program_audiences_stages')
->addJoinColumn('audience_id', 'id', false, false, 'CASCADE')
->addInverseJoinColumn('stage_id', 'id', false, false, 'CASCADE')
->build();
$builder->createManyToMany('segments', LeadList::class)
->setJoinTable('initiative_audiences_segments')
->setJoinTable('mt3s_mp_program_audiences_segments')
->addJoinColumn('audience_id', 'id', false, false, 'CASCADE')
->addInverseJoinColumn('leadlist_id', 'id', false, false, 'CASCADE')
->build();
@@ -230,8 +230,8 @@ class Audience extends FormEntity
->option('unsigned', true)
->build();
// The links to the initiatives, managed from the initiatives.
$builder->createOneToMany('initiativeLinks', InitiativeAudience::class)
// The links to the mt3s_mp_programs, managed from the mt3s_mp_programs.
$builder->createOneToMany('programLinks', ProgramAudience::class)
->mappedBy('audience')
->fetchExtraLazy()
->build();
@@ -239,9 +239,9 @@ class Audience extends FormEntity
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addPropertyConstraint('name', new NotBlank(message: 'mautic.program.audience.name.required'));
$metadata->addPropertyConstraint('name', new NotBlank(message: 'mt3s.marketing_program.audience.name.required'));
$metadata->addPropertyConstraint('name', new Length(max: 191));
$metadata->addPropertyConstraint('estimatedSize', new PositiveOrZero(message: 'mautic.program.audience.estimated_size.invalid'));
$metadata->addPropertyConstraint('estimatedSize', new PositiveOrZero(message: 'mt3s.marketing_program.audience.estimated_size.invalid'));
$metadata->addPropertyConstraint('decisionRole', new Length(max: 64));
}
@@ -470,10 +470,10 @@ class Audience extends FormEntity
}
/**
* @return Collection<int, InitiativeAudience>
* @return Collection<int, ProgramAudience>
*/
public function getInitiativeLinks(): Collection
public function getProgramLinks(): Collection
{
return $this->initiativeLinks;
return $this->programLinks;
}
}
+3 -3
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
/**
* How important an initiative's audience is to the initiative. The order of the cases is the order of the dropdown.
* How important an program's audience is to the program. The order of the cases is the order of the dropdown.
*/
enum AudiencePriority: string
{
@@ -15,7 +15,7 @@ enum AudiencePriority: string
public function getLabelKey(): string
{
return 'mautic.program.audience.priority.'.$this->value;
return 'mt3s.marketing_program.audience.priority.'.$this->value;
}
public function getLabelClass(): string
+3 -3
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Doctrine\DBAL\Connection;
use Mautic\CoreBundle\Entity\CommonRepository;
@@ -40,7 +40,7 @@ class AudienceRepository extends CommonRepository
{
$rows = $this->getEntityManager()->getConnection()->fetchAllAssociative(
'SELECT s.leadlist_id, COUNT(ll.lead_id) AS cnt
FROM initiative_audiences_segments s
FROM mt3s_mp_program_audiences_segments s
JOIN lead_lists_leads ll ON ll.leadlist_id = s.leadlist_id AND ll.manually_removed = 0
WHERE s.audience_id = :audienceId
GROUP BY s.leadlist_id',
@@ -72,7 +72,7 @@ class AudienceRepository extends CommonRepository
$connection = $this->getEntityManager()->getConnection();
$rows = $connection->fetchAllAssociative(
'SELECT s.audience_id, s.leadlist_id, COUNT(ll.lead_id) AS cnt
FROM initiative_audiences_segments s
FROM mt3s_mp_program_audiences_segments s
JOIN lead_lists_leads ll ON ll.leadlist_id = s.leadlist_id AND ll.manually_removed = 0
WHERE s.audience_id IN (:audienceIds)
GROUP BY s.audience_id, s.leadlist_id',
+3 -3
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
/**
* The kind of audience an initiative's audience entry describes. The order of the cases is the order of the dropdown.
* The kind of audience an program's audience entry describes. The order of the cases is the order of the dropdown.
*/
enum AudienceType: string
{
@@ -17,7 +17,7 @@ enum AudienceType: string
public function getLabelKey(): string
{
return 'mautic.program.audience.type.'.$this->value;
return 'mt3s.marketing_program.audience.type.'.$this->value;
}
/**
+2 -2
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
/**
* For repositories of typed initiative items (description items, allocation items, objectives, tasks).
* For repositories of typed program items (description items, allocation items, objectives, tasks).
*/
trait CountsItemsByTypeTrait
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
/**
* An object with an optional start and end date. Checked by the EndDateAfterStartDate constraint.
+2 -2
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
/**
* The type of a task dependency edge. The order of the cases is the order of the dropdown.
@@ -16,6 +16,6 @@ enum DependencyType: string
public function getLabelKey(): string
{
return 'mautic.program.task.dependency_type.'.$this->value;
return 'mt3s.marketing_program.task.dependency_type.'.$this->value;
}
}
+58 -58
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
@@ -12,16 +12,16 @@ use Mautic\CategoryBundle\Entity\Category;
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
use Mautic\CoreBundle\Entity\FormEntity;
use Mautic\UserBundle\Entity\User;
use MauticPlugin\ProgramBundle\Validator\Constraints\EndDateAfterStartDate;
use MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints\EndDateAfterStartDate;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Component\Validator\Constraints\Range;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\Mapping\ClassMetadata;
class Initiative extends FormEntity implements DateRangeInterface
class Program extends FormEntity implements DateRangeInterface
{
public const TABLE_NAME = 'initiatives';
public const TABLE_NAME = 'mt3s_mp_programs';
public const VERSION_MIN = 1;
public const VERSION_MAX = 99;
@@ -29,51 +29,51 @@ class Initiative extends FormEntity implements DateRangeInterface
private ?int $id = null;
/**
* Initiative version, 1 to 99. Edited by hand; not related to Doctrine optimistic locking.
* Program version, 1 to 99. Edited by hand; not related to Doctrine optimistic locking.
*/
private ?int $version = self::VERSION_MIN;
/**
* @var Collection<int, InitiativeObjective>
* @var Collection<int, ProgramObjective>
*/
private Collection $objectives;
/**
* The content of the Description tab. Each item has a type set up by the admin in
* Settings > Configuration > Initiative.
* Settings > Configuration > Program.
*
* @var Collection<int, InitiativeDescriptionItem>
* @var Collection<int, ProgramDescriptionItem>
*/
private Collection $descriptionItems;
/**
* The cost lines of the Allocations tab. Each item has a type set up by the admin in
* Settings > Configuration > Initiative.
* Settings > Configuration > Program.
*
* @var Collection<int, InitiativeAllocationItem>
* @var Collection<int, ProgramAllocationItem>
*/
private Collection $allocationItems;
/**
* The audiences of the Audiences tab: links to the audiences of the global directory
* (Programs > Audiences), each with the audience's priority in this plan and possibly a
* initiative-specific message. See InitiativeAudience.
* program-specific message. See ProgramAudience.
*
* @var Collection<int, InitiativeAudience>
* @var Collection<int, ProgramAudience>
*/
private Collection $audiences;
/**
* The links to the stakeholders of the global directory (Programs > Stakeholders), each with the
* stakeholder's role in this plan. See InitiativeStakeholder.
* stakeholder's role in this plan. See ProgramStakeholder.
*
* @var Collection<int, InitiativeStakeholder>
* @var Collection<int, ProgramStakeholder>
*/
private Collection $stakeholders;
/**
* Tasks are managed on their own pages (TaskController).
* Read-only from the initiative: deleting an initiative
* Read-only from the program: deleting an program
* deletes its tasks through the database (ON DELETE CASCADE).
*
* @var Collection<int, Task>
@@ -82,7 +82,7 @@ class Initiative extends FormEntity implements DateRangeInterface
private ?string $name = null;
private InitiativeStatus $status = InitiativeStatus::Draft;
private ProgramStatus $status = ProgramStatus::Draft;
/**
* Required in the form. The column is nullable only so that deleting the user doesn't delete the plan (SET NULL).
@@ -160,7 +160,7 @@ class Initiative extends FormEntity implements DateRangeInterface
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable(self::TABLE_NAME)
->setCustomRepositoryClass(InitiativeRepository::class)
->setCustomRepositoryClass(ProgramRepository::class)
->addIndex(['status'], 'program_status');
// id and name; no description column (replaced by description items).
@@ -171,7 +171,7 @@ class Initiative extends FormEntity implements DateRangeInterface
'fieldName' => 'status',
'type' => Types::STRING,
'length' => 20,
'enumType' => InitiativeStatus::class,
'enumType' => ProgramStatus::class,
]);
$builder->createManyToOne('owner', User::class)
@@ -197,8 +197,8 @@ class Initiative extends FormEntity implements DateRangeInterface
->option('default', self::VERSION_MIN)
->build();
$builder->createOneToMany('objectives', InitiativeObjective::class)
->mappedBy('initiative')
$builder->createOneToMany('objectives', ProgramObjective::class)
->mappedBy('program')
->cascadePersist()
->cascadeRemove()
->orphanRemoval()
@@ -206,8 +206,8 @@ class Initiative extends FormEntity implements DateRangeInterface
->fetchExtraLazy()
->build();
$builder->createOneToMany('descriptionItems', InitiativeDescriptionItem::class)
->mappedBy('initiative')
$builder->createOneToMany('descriptionItems', ProgramDescriptionItem::class)
->mappedBy('program')
->cascadePersist()
->cascadeRemove()
->orphanRemoval()
@@ -215,8 +215,8 @@ class Initiative extends FormEntity implements DateRangeInterface
->fetchExtraLazy()
->build();
$builder->createOneToMany('allocationItems', InitiativeAllocationItem::class)
->mappedBy('initiative')
$builder->createOneToMany('allocationItems', ProgramAllocationItem::class)
->mappedBy('program')
->cascadePersist()
->cascadeRemove()
->orphanRemoval()
@@ -224,8 +224,8 @@ class Initiative extends FormEntity implements DateRangeInterface
->fetchExtraLazy()
->build();
$builder->createOneToMany('audiences', InitiativeAudience::class)
->mappedBy('initiative')
$builder->createOneToMany('audiences', ProgramAudience::class)
->mappedBy('program')
->cascadePersist()
->cascadeRemove()
->orphanRemoval()
@@ -233,8 +233,8 @@ class Initiative extends FormEntity implements DateRangeInterface
->fetchExtraLazy()
->build();
$builder->createOneToMany('stakeholders', InitiativeStakeholder::class)
->mappedBy('initiative')
$builder->createOneToMany('stakeholders', ProgramStakeholder::class)
->mappedBy('program')
->cascadePersist()
->cascadeRemove()
->orphanRemoval()
@@ -243,7 +243,7 @@ class Initiative extends FormEntity implements DateRangeInterface
->build();
$builder->createOneToMany('tasks', Task::class)
->mappedBy('initiative')
->mappedBy('program')
->setOrderBy(['name' => 'ASC'])
->fetchExtraLazy()
->build();
@@ -251,9 +251,9 @@ class Initiative extends FormEntity implements DateRangeInterface
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addPropertyConstraint('version', new NotNull(message: 'mautic.program.version.range'));
$metadata->addPropertyConstraint('version', new NotNull(message: 'mt3s.marketing_program.version.range'));
$metadata->addPropertyConstraint('version', new Range(
notInRangeMessage: 'mautic.program.version.range',
notInRangeMessage: 'mt3s.marketing_program.version.range',
min: self::VERSION_MIN,
max: self::VERSION_MAX,
));
@@ -263,7 +263,7 @@ class Initiative extends FormEntity implements DateRangeInterface
$metadata->addPropertyConstraint('audiences', new Valid());
$metadata->addPropertyConstraint('stakeholders', new Valid());
$metadata->addPropertyConstraint('name', new NotBlank(message: 'mautic.core.name.required'));
$metadata->addPropertyConstraint('owner', new NotBlank(message: 'mautic.program.owner.required'));
$metadata->addPropertyConstraint('owner', new NotBlank(message: 'mt3s.marketing_program.owner.required'));
$metadata->addConstraint(new EndDateAfterStartDate());
}
@@ -295,12 +295,12 @@ class Initiative extends FormEntity implements DateRangeInterface
* Sorted here, not only by the mapping's orderBy: after a reorder, positions change in memory while the
* loaded collection keeps its old order, and the page shown right after saving uses that collection.
*
* @return Collection<int, InitiativeObjective>
* @return Collection<int, ProgramObjective>
*/
public function getObjectives(): Collection
{
$objectives = self::sortedByPosition($this->objectives)->toArray();
usort($objectives, function (InitiativeObjective $a, InitiativeObjective $b): int {
usort($objectives, function (ProgramObjective $a, ProgramObjective $b): int {
// An objective without a priority yet sorts last; ties keep the position order.
$pa = $a->getPriority() ?? PHP_INT_MAX;
$pb = $b->getPriority() ?? PHP_INT_MAX;
@@ -322,17 +322,17 @@ class Initiative extends FormEntity implements DateRangeInterface
/**
* The audience links sorted by position, as a new collection; see getObjectives().
*
* @return Collection<int, InitiativeAudience>
* @return Collection<int, ProgramAudience>
*/
public function getAudiences(): Collection
{
return self::sortedByPosition($this->audiences);
}
public function addAudience(InitiativeAudience $audience): static
public function addAudience(ProgramAudience $audience): static
{
if (!$this->audiences->contains($audience)) {
$audience->setInitiative($this);
$audience->setProgram($this);
$this->audiences->add($audience);
}
@@ -343,7 +343,7 @@ class Initiative extends FormEntity implements DateRangeInterface
* Removing an audience link from the plan deletes it (orphanRemoval). The audience itself stays
* in the global directory.
*/
public function removeAudience(InitiativeAudience $audience): static
public function removeAudience(ProgramAudience $audience): static
{
$this->audiences->removeElement($audience);
@@ -353,17 +353,17 @@ class Initiative extends FormEntity implements DateRangeInterface
/**
* The stakeholder links sorted by position, as a new collection; see getObjectives().
*
* @return Collection<int, InitiativeStakeholder>
* @return Collection<int, ProgramStakeholder>
*/
public function getStakeholders(): Collection
{
return self::sortedByPosition($this->stakeholders);
}
public function addStakeholder(InitiativeStakeholder $stakeholder): static
public function addStakeholder(ProgramStakeholder $stakeholder): static
{
if (!$this->stakeholders->contains($stakeholder)) {
$stakeholder->setInitiative($this);
$stakeholder->setProgram($this);
$this->stakeholders->add($stakeholder);
}
@@ -374,17 +374,17 @@ class Initiative extends FormEntity implements DateRangeInterface
* Removing a stakeholder link from the plan deletes it (orphanRemoval). The stakeholder itself
* stays in the global directory.
*/
public function removeStakeholder(InitiativeStakeholder $stakeholder): static
public function removeStakeholder(ProgramStakeholder $stakeholder): static
{
$this->stakeholders->removeElement($stakeholder);
return $this;
}
public function addObjective(InitiativeObjective $objective): static
public function addObjective(ProgramObjective $objective): static
{
if (!$this->objectives->contains($objective)) {
$objective->setInitiative($this);
$objective->setProgram($this);
$this->objectives->add($objective);
}
@@ -394,7 +394,7 @@ class Initiative extends FormEntity implements DateRangeInterface
/**
* Removing an objective from the plan deletes it (orphanRemoval).
*/
public function removeObjective(InitiativeObjective $objective): static
public function removeObjective(ProgramObjective $objective): static
{
$this->objectives->removeElement($objective);
@@ -404,7 +404,7 @@ class Initiative extends FormEntity implements DateRangeInterface
/**
* The description items sorted by position, as a new collection; see getObjectives().
*
* @return Collection<int, InitiativeDescriptionItem>
* @return Collection<int, ProgramDescriptionItem>
*/
public function getDescriptionItems(): Collection
{
@@ -414,17 +414,17 @@ class Initiative extends FormEntity implements DateRangeInterface
/**
* The allocation items sorted by position, as a new collection; see getObjectives().
*
* @return Collection<int, InitiativeAllocationItem>
* @return Collection<int, ProgramAllocationItem>
*/
public function getAllocationItems(): Collection
{
return self::sortedByPosition($this->allocationItems);
}
public function addAllocationItem(InitiativeAllocationItem $allocationItem): static
public function addAllocationItem(ProgramAllocationItem $allocationItem): static
{
if (!$this->allocationItems->contains($allocationItem)) {
$allocationItem->setInitiative($this);
$allocationItem->setProgram($this);
$this->allocationItems->add($allocationItem);
}
@@ -434,7 +434,7 @@ class Initiative extends FormEntity implements DateRangeInterface
/**
* Removing an allocation item from the plan deletes it (orphanRemoval).
*/
public function removeAllocationItem(InitiativeAllocationItem $allocationItem): static
public function removeAllocationItem(ProgramAllocationItem $allocationItem): static
{
$this->allocationItems->removeElement($allocationItem);
@@ -468,7 +468,7 @@ class Initiative extends FormEntity implements DateRangeInterface
}
/**
* @template T of InitiativeObjective|InitiativeDescriptionItem|InitiativeAllocationItem|Audience|InitiativeStakeholder
* @template T of ProgramObjective|ProgramDescriptionItem|ProgramAllocationItem|Audience|ProgramStakeholder
*
* @param Collection<int, T> $collection
*
@@ -482,10 +482,10 @@ class Initiative extends FormEntity implements DateRangeInterface
return new ArrayCollection($rows);
}
public function addDescriptionItem(InitiativeDescriptionItem $descriptionItem): static
public function addDescriptionItem(ProgramDescriptionItem $descriptionItem): static
{
if (!$this->descriptionItems->contains($descriptionItem)) {
$descriptionItem->setInitiative($this);
$descriptionItem->setProgram($this);
$this->descriptionItems->add($descriptionItem);
}
@@ -495,7 +495,7 @@ class Initiative extends FormEntity implements DateRangeInterface
/**
* Removing a description item from the plan deletes it (orphanRemoval).
*/
public function removeDescriptionItem(InitiativeDescriptionItem $descriptionItem): static
public function removeDescriptionItem(ProgramDescriptionItem $descriptionItem): static
{
$this->descriptionItems->removeElement($descriptionItem);
@@ -531,7 +531,7 @@ class Initiative extends FormEntity implements DateRangeInterface
return $this;
}
public function getStatus(): InitiativeStatus
public function getStatus(): ProgramStatus
{
return $this->status;
}
@@ -540,7 +540,7 @@ class Initiative extends FormEntity implements DateRangeInterface
* Sets completedAt when the plan moves to "completed" from another status,
* and clears it when the plan leaves "completed".
*/
public function setStatus(InitiativeStatus $status): static
public function setStatus(ProgramStatus $status): static
{
if ($status === $this->status) {
return $this;
@@ -549,9 +549,9 @@ class Initiative extends FormEntity implements DateRangeInterface
// isChanged() can't log enums (they aren't stringable), so log the backing values.
$this->addChange('status', [$this->status->value, $status->value]);
if (InitiativeStatus::Completed === $status) {
if (ProgramStatus::Completed === $status) {
$this->setCompletedAt(new \DateTime());
} elseif (InitiativeStatus::Completed === $this->status) {
} elseif (ProgramStatus::Completed === $this->status) {
$this->setCompletedAt(null);
}
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata;
@@ -13,21 +13,21 @@ use Symfony\Component\Validator\Mapping\ClassMetadata;
/**
* One item of a plan's Allocations tab: a typed cost line with a planned and a real cost, both in
* the general currency (CurrencyProvider). Initiative::$allocationItems owns the lifecycle: items are saved
* the general currency (CurrencyProvider). Program::$allocationItems owns the lifecycle: items are saved
* and deleted with their plan, and are ordered by position.
*
* The type is the key of an allocation item type set up in Settings > Configuration > Initiative Settings
* The type is the key of an allocation item type set up in Settings > Configuration > Program Settings
* (parameter program_allocation_item_types); see ItemTypeProvider.
*/
class InitiativeAllocationItem
class ProgramAllocationItem
{
public const TABLE_NAME = 'initiative_allocation_items';
public const TABLE_NAME = 'mt3s_mp_program_allocation_items';
public const TYPE_MAX_LENGTH = 64;
private ?int $id = null;
private ?Initiative $initiative = null;
private ?Program $program = null;
private ?string $type = null;
@@ -50,7 +50,7 @@ class InitiativeAllocationItem
public function __clone()
{
$this->id = null;
$this->initiative = null;
$this->program = null;
}
public static function loadMetadata(OrmClassMetadata $metadata): void
@@ -58,13 +58,13 @@ class InitiativeAllocationItem
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable(self::TABLE_NAME)
->setCustomRepositoryClass(InitiativeAllocationItemRepository::class);
->setCustomRepositoryClass(ProgramAllocationItemRepository::class);
$builder->addId();
$builder->createManyToOne('initiative', Initiative::class)
$builder->createManyToOne('program', Program::class)
->inversedBy('allocationItems')
->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE')
->addJoinColumn('program_id', 'id', false, false, 'CASCADE')
->build();
$builder->createField('type', Types::STRING)
@@ -96,7 +96,7 @@ class InitiativeAllocationItem
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addPropertyConstraint('type', new NotBlank(message: 'mautic.program.allocation_item.type.required'));
$metadata->addPropertyConstraint('type', new NotBlank(message: 'mt3s.marketing_program.allocation_item.type.required'));
$metadata->addPropertyConstraint('type', new Length(max: self::TYPE_MAX_LENGTH));
$metadata->addPropertyConstraint('name', new Length(max: 255));
}
@@ -106,14 +106,14 @@ class InitiativeAllocationItem
return $this->id;
}
public function getInitiative(): ?Initiative
public function getProgram(): ?Program
{
return $this->initiative;
return $this->program;
}
public function setInitiative(?Initiative $initiative): static
public function setProgram(?Program $program): static
{
$this->initiative = $initiative;
$this->program = $program;
return $this;
}
@@ -2,14 +2,14 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<InitiativeAllocationItem>
* @extends CommonRepository<ProgramAllocationItem>
*/
class InitiativeAllocationItemRepository extends CommonRepository
class ProgramAllocationItemRepository extends CommonRepository
{
use CountsItemsByTypeTrait;
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata;
@@ -13,19 +13,19 @@ use Symfony\Component\Validator\Mapping\ClassMetadata;
/**
* The link between a plan and an audience of the global directory, with the audience's priority
* in that plan and possibly a initiative-specific message ("Key message for this plan"): the same
* in that plan and possibly a program-specific message ("Key message for this plan"): the same
* audience can be primary in one plan and secondary in another.
*
* Initiative::$audiences owns the lifecycle: links are saved and deleted with their plan. Deleting an
* Program::$audiences owns the lifecycle: links are saved and deleted with their plan. Deleting an
* audience deletes its links (ON DELETE CASCADE on both sides).
*/
class InitiativeAudience
class ProgramAudience
{
public const TABLE_NAME = 'initiative_audiences_initiative';
public const TABLE_NAME = 'mt3s_mp_program_audiences_program';
private ?int $id = null;
private ?Initiative $initiative = null;
private ?Program $program = null;
private ?Audience $audience = null;
@@ -44,7 +44,7 @@ class InitiativeAudience
public function __clone()
{
$this->id = null;
$this->initiative = null;
$this->program = null;
}
public static function loadMetadata(OrmClassMetadata $metadata): void
@@ -52,13 +52,13 @@ class InitiativeAudience
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable(self::TABLE_NAME)
->setCustomRepositoryClass(InitiativeAudienceRepository::class);
->setCustomRepositoryClass(ProgramAudienceRepository::class);
$builder->addId();
$builder->createManyToOne('initiative', Initiative::class)
$builder->createManyToOne('program', Program::class)
->inversedBy('audiences')
->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE')
->addJoinColumn('program_id', 'id', false, false, 'CASCADE')
->build();
$builder->createManyToOne('audience', Audience::class)
@@ -86,7 +86,7 @@ class InitiativeAudience
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addPropertyConstraint('audience', new NotBlank(message: 'mautic.program.audience_link.audience.required'));
$metadata->addPropertyConstraint('audience', new NotBlank(message: 'mt3s.marketing_program.audience_link.audience.required'));
$metadata->addPropertyConstraint('valueProposition', new Length(max: 1000));
}
@@ -95,14 +95,14 @@ class InitiativeAudience
return $this->id;
}
public function getInitiative(): ?Initiative
public function getProgram(): ?Program
{
return $this->initiative;
return $this->program;
}
public function setInitiative(?Initiative $initiative): static
public function setProgram(?Program $program): static
{
$this->initiative = $initiative;
$this->program = $program;
return $this;
}
@@ -2,14 +2,14 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<InitiativeAudience>
* @extends CommonRepository<ProgramAudience>
*/
class InitiativeAudienceRepository extends CommonRepository
class ProgramAudienceRepository extends CommonRepository
{
public function getTableAlias(): string
{
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata;
@@ -12,21 +12,21 @@ use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Mapping\ClassMetadata;
/**
* One item of a plan's Description tab. Initiative::$descriptionItems owns the lifecycle: items are saved and
* One item of a plan's Description tab. Program::$descriptionItems owns the lifecycle: items are saved and
* deleted with their plan, and are ordered by position.
*
* The type is the key of a type set up in Settings > Configuration > Initiative (parameter
* The type is the key of a type set up in Settings > Configuration > Program (parameter
* program_description_item_types); see ItemTypeProvider (kind "description") for its name and description.
*/
class InitiativeDescriptionItem
class ProgramDescriptionItem
{
public const TABLE_NAME = 'initiative_description_items';
public const TABLE_NAME = 'mt3s_mp_program_description_items';
public const TYPE_MAX_LENGTH = 64;
private ?int $id = null;
private ?Initiative $initiative = null;
private ?Program $program = null;
private ?string $type = null;
@@ -40,7 +40,7 @@ class InitiativeDescriptionItem
public function __clone()
{
$this->id = null;
$this->initiative = null;
$this->program = null;
}
public static function loadMetadata(OrmClassMetadata $metadata): void
@@ -48,13 +48,13 @@ class InitiativeDescriptionItem
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable(self::TABLE_NAME)
->setCustomRepositoryClass(InitiativeDescriptionItemRepository::class);
->setCustomRepositoryClass(ProgramDescriptionItemRepository::class);
$builder->addId();
$builder->createManyToOne('initiative', Initiative::class)
$builder->createManyToOne('program', Program::class)
->inversedBy('descriptionItems')
->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE')
->addJoinColumn('program_id', 'id', false, false, 'CASCADE')
->build();
$builder->createField('type', Types::STRING)
@@ -72,7 +72,7 @@ class InitiativeDescriptionItem
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addPropertyConstraint('type', new NotBlank(message: 'mautic.program.description_item.type.required'));
$metadata->addPropertyConstraint('type', new NotBlank(message: 'mt3s.marketing_program.description_item.type.required'));
$metadata->addPropertyConstraint('type', new Length(max: self::TYPE_MAX_LENGTH));
}
@@ -81,14 +81,14 @@ class InitiativeDescriptionItem
return $this->id;
}
public function getInitiative(): ?Initiative
public function getProgram(): ?Program
{
return $this->initiative;
return $this->program;
}
public function setInitiative(?Initiative $initiative): static
public function setProgram(?Program $program): static
{
$this->initiative = $initiative;
$this->program = $program;
return $this;
}
@@ -2,14 +2,14 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<InitiativeDescriptionItem>
* @extends CommonRepository<ProgramDescriptionItem>
*/
class InitiativeDescriptionItemRepository extends CommonRepository
class ProgramDescriptionItemRepository extends CommonRepository
{
use CountsItemsByTypeTrait;
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata;
@@ -14,12 +14,12 @@ use Symfony\Component\Validator\Constraints\Range;
use Symfony\Component\Validator\Mapping\ClassMetadata;
/**
* An objective of a plan. Initiative::$objectives owns the lifecycle: objectives are saved and deleted with
* An objective of a plan. Program::$objectives owns the lifecycle: objectives are saved and deleted with
* their plan, and are ordered by position.
*/
class InitiativeObjective
class ProgramObjective
{
public const TABLE_NAME = 'initiative_objectives';
public const TABLE_NAME = 'mt3s_mp_program_objectives';
public const TYPE_MAX_LENGTH = 64;
@@ -28,7 +28,7 @@ class InitiativeObjective
private ?int $id = null;
private ?Initiative $initiative = null;
private ?Program $program = null;
private ?string $type = null;
@@ -54,7 +54,7 @@ class InitiativeObjective
public function __clone()
{
$this->id = null;
$this->initiative = null;
$this->program = null;
}
public static function loadMetadata(OrmClassMetadata $metadata): void
@@ -62,13 +62,13 @@ class InitiativeObjective
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable(self::TABLE_NAME)
->setCustomRepositoryClass(InitiativeObjectiveRepository::class);
->setCustomRepositoryClass(ProgramObjectiveRepository::class);
$builder->addId();
$builder->createManyToOne('initiative', Initiative::class)
$builder->createManyToOne('program', Program::class)
->inversedBy('objectives')
->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE')
->addJoinColumn('program_id', 'id', false, false, 'CASCADE')
->build();
$builder->createField('type', Types::STRING)
@@ -100,13 +100,13 @@ class InitiativeObjective
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addPropertyConstraint('title', new NotBlank(message: 'mautic.program.objective.title.required'));
$metadata->addPropertyConstraint('title', new NotBlank(message: 'mt3s.marketing_program.objective.title.required'));
$metadata->addPropertyConstraint('title', new Length(max: 255));
$metadata->addPropertyConstraint('type', new NotBlank(message: 'mautic.program.objective.type.required'));
$metadata->addPropertyConstraint('type', new NotBlank(message: 'mt3s.marketing_program.objective.type.required'));
$metadata->addPropertyConstraint('type', new Length(max: self::TYPE_MAX_LENGTH));
$metadata->addPropertyConstraint('priority', new NotNull(message: 'mautic.program.objective.priority.range'));
$metadata->addPropertyConstraint('priority', new NotNull(message: 'mt3s.marketing_program.objective.priority.range'));
$metadata->addPropertyConstraint('priority', new Range(
notInRangeMessage: 'mautic.program.objective.priority.range',
notInRangeMessage: 'mt3s.marketing_program.objective.priority.range',
min: self::PRIORITY_MIN,
max: self::PRIORITY_MAX,
));
@@ -117,14 +117,14 @@ class InitiativeObjective
return $this->id;
}
public function getInitiative(): ?Initiative
public function getProgram(): ?Program
{
return $this->initiative;
return $this->program;
}
public function setInitiative(?Initiative $initiative): static
public function setProgram(?Program $program): static
{
$this->initiative = $initiative;
$this->program = $program;
return $this;
}
@@ -2,14 +2,14 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<InitiativeObjective>
* @extends CommonRepository<ProgramObjective>
*/
class InitiativeObjectiveRepository extends CommonRepository
class ProgramObjectiveRepository extends CommonRepository
{
use CountsItemsByTypeTrait;
@@ -2,14 +2,14 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<Initiative>
* @extends CommonRepository<Program>
*/
class InitiativeRepository extends CommonRepository
class ProgramRepository extends CommonRepository
{
public function getTableAlias(): string
{
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata;
@@ -15,23 +15,23 @@ use Symfony\Component\Validator\Mapping\ClassMetadata;
* that plan ("Approves budget", "Media buyer"): free text, because the same person can have a
* different role on each plan.
*
* Initiative::$stakeholders owns the lifecycle: links are saved and deleted with their plan. Deleting a
* Program::$stakeholders owns the lifecycle: links are saved and deleted with their plan. Deleting a
* stakeholder deletes its links (ON DELETE CASCADE on both sides).
*/
class InitiativeStakeholder
class ProgramStakeholder
{
public const TABLE_NAME = 'initiative_stakeholders_initiative';
public const TABLE_NAME = 'mt3s_mp_program_stakeholders_program';
private ?int $id = null;
private ?Initiative $initiative = null;
private ?Program $program = null;
private ?Stakeholder $stakeholder = null;
/**
* The stakeholder's role in this plan, free text.
*/
private ?string $roleInInitiative = null;
private ?string $roleInProgram = null;
/**
* Display order within the plan, from 0. Set by drag and drop in the form.
@@ -41,7 +41,7 @@ class InitiativeStakeholder
public function __clone()
{
$this->id = null;
$this->initiative = null;
$this->program = null;
}
public static function loadMetadata(OrmClassMetadata $metadata): void
@@ -49,21 +49,21 @@ class InitiativeStakeholder
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable(self::TABLE_NAME)
->setCustomRepositoryClass(InitiativeStakeholderRepository::class);
->setCustomRepositoryClass(ProgramStakeholderRepository::class);
$builder->addId();
$builder->createManyToOne('initiative', Initiative::class)
$builder->createManyToOne('program', Program::class)
->inversedBy('stakeholders')
->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE')
->addJoinColumn('program_id', 'id', false, false, 'CASCADE')
->build();
$builder->createManyToOne('stakeholder', Stakeholder::class)
->addJoinColumn('stakeholder_id', 'id', false, false, 'CASCADE')
->build();
$builder->createField('roleInInitiative', Types::STRING)
->columnName('role_in_initiative')
$builder->createField('roleInProgram', Types::STRING)
->columnName('role_in_program')
->length(191)
->nullable()
->build();
@@ -75,8 +75,8 @@ class InitiativeStakeholder
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addPropertyConstraint('stakeholder', new \Symfony\Component\Validator\Constraints\NotBlank(message: 'mautic.program.stakeholder_link.stakeholder.required'));
$metadata->addPropertyConstraint('roleInInitiative', new Length(max: 191));
$metadata->addPropertyConstraint('stakeholder', new \Symfony\Component\Validator\Constraints\NotBlank(message: 'mt3s.marketing_program.stakeholder_link.stakeholder.required'));
$metadata->addPropertyConstraint('roleInProgram', new Length(max: 191));
}
public function getId(): ?int
@@ -84,14 +84,14 @@ class InitiativeStakeholder
return $this->id;
}
public function getInitiative(): ?Initiative
public function getProgram(): ?Program
{
return $this->initiative;
return $this->program;
}
public function setInitiative(?Initiative $initiative): static
public function setProgram(?Program $program): static
{
$this->initiative = $initiative;
$this->program = $program;
return $this;
}
@@ -108,14 +108,14 @@ class InitiativeStakeholder
return $this;
}
public function getRoleInInitiative(): ?string
public function getRoleInProgram(): ?string
{
return $this->roleInInitiative;
return $this->roleInProgram;
}
public function setRoleInInitiative(?string $roleInInitiative): static
public function setRoleInProgram(?string $roleInProgram): static
{
$this->roleInInitiative = $roleInInitiative;
$this->roleInProgram = $roleInProgram;
return $this;
}
@@ -2,14 +2,14 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<InitiativeStakeholder>
* @extends CommonRepository<ProgramStakeholder>
*/
class InitiativeStakeholderRepository extends CommonRepository
class ProgramStakeholderRepository extends CommonRepository
{
public function getTableAlias(): string
{
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
enum InitiativeStatus: string
enum ProgramStatus: string
{
case Draft = 'draft';
case Planned = 'planned';
@@ -15,11 +15,11 @@ enum InitiativeStatus: string
public function getLabelKey(): string
{
return 'mautic.program.status.'.$this->value;
return 'mt3s.marketing_program.status.'.$this->value;
}
/**
* The Bootstrap class of the status label in the tables (the initiative's Status column).
* The Bootstrap class of the status label in the tables (the program's Status column).
*/
public function getLabelClass(): string
{
+2 -2
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
/**
* The RACI roles of a task assignment. The order of the cases is the order of the dropdown.
@@ -16,7 +16,7 @@ enum RaciRole: string
public function getLabelKey(): string
{
return 'mautic.program.task.raci_role.'.$this->value;
return 'mt3s.marketing_program.task.raci_role.'.$this->value;
}
public function getLabelClass(): string
+19 -19
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\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 program: a person, a company or a team involved in the initiatives ("Agency XYZ",
* A stakeholder of the program: a person, a company or a team involved in the mt3s_mp_programs ("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.
* mt3s_mp_programs; an program links to them through ProgramStakeholder, which carries the stakeholder's role in that
* program.
*
* The type is the key of a stakeholder type set up in Settings > Configuration > Initiative Settings
* The type is the key of a stakeholder type set up in Settings > Configuration > Program Settings
* (parameter program_stakeholder_types); see ItemTypeProvider (kind "stakeholder").
*
* 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.
* isPublished (from FormEntity) means "active": an unpublished stakeholder is hidden from the program
* form's stakeholder picker, but keeps its history on the mt3s_mp_programs it is already linked to.
*/
class Stakeholder extends FormEntity
{
public const TABLE_NAME = 'initiative_stakeholders';
public const TABLE_NAME = 'mt3s_mp_program_stakeholders';
public const TYPE_MAX_LENGTH = 64;
@@ -50,16 +50,16 @@ class Stakeholder extends FormEntity
private ?string $type = null;
/**
* 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).
* The links to the mt3s_mp_programs this stakeholder is assigned to. Inverse side, read-only from here: the
* links are managed from the plans (Program::addStakeholder/removeStakeholder).
*
* @var Collection<int, InitiativeStakeholder>
* @var Collection<int, ProgramStakeholder>
*/
private Collection $initiativeLinks;
private Collection $programLinks;
public function __construct()
{
$this->initiativeLinks = new ArrayCollection();
$this->programLinks = new ArrayCollection();
}
public static function loadMetadata(OrmClassMetadata $metadata): void
@@ -96,7 +96,7 @@ class Stakeholder extends FormEntity
->nullable()
->build();
$builder->createOneToMany('initiativeLinks', InitiativeStakeholder::class)
$builder->createOneToMany('programLinks', ProgramStakeholder::class)
->mappedBy('stakeholder')
->fetchExtraLazy()
->build();
@@ -108,7 +108,7 @@ class Stakeholder extends FormEntity
{
$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.program.stakeholder.email.invalid'));
$metadata->addPropertyConstraint('email', new Email(mode: Email::VALIDATION_MODE_HTML5, message: 'mt3s.marketing_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 initiatives this stakeholder is assigned to, each with its role in that initiative.
* The links to the mt3s_mp_programs this stakeholder is assigned to, each with its role in that program.
*
* @return Collection<int, InitiativeStakeholder>
* @return Collection<int, ProgramStakeholder>
*/
public function getInitiativeLinks(): Collection
public function getProgramLinks(): Collection
{
return $this->initiativeLinks;
return $this->programLinks;
}
public function setType(?string $type): static
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
+20 -20
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\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\ProgramBundle\Validator\Constraints\EndDateAfterStartDate;
use MauticPlugin\ProgramBundle\Validator\Constraints\TaskDates;
use MauticPlugin\ProgramBundle\Validator\Constraints\ValidTaskDependency;
use MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints\EndDateAfterStartDate;
use MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints\TaskDates;
use MauticPlugin\MT3SMarketingProgramBundle\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 an initiative. Every task belongs to exactly one initiative.
* A task of an program. Every task belongs to exactly one program.
*
* 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 initiative's stakeholders through TaskRaci rows (R/A/C/I), several
* RACI: a task is assigned to the program's stakeholders through TaskRaci rows (R/A/C/I), several
* stakeholders per role.
*
* Database rules: deleting the initiative deletes its tasks (ON DELETE CASCADE); deleting a task deletes
* Database rules: deleting the program 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 = 'initiative_tasks';
public const TABLE_NAME = 'mt3s_mp_program_tasks';
public const TYPE_MAX_LENGTH = 64;
@@ -48,7 +48,7 @@ class Task extends FormEntity implements DateRangeInterface
private ?int $id = null;
private ?Initiative $initiative = null;
private ?Program $program = null;
/**
* Key of a task type set up in Settings > Configuration > Program Settings (parameter program_task_types);
@@ -106,9 +106,9 @@ class Task extends FormEntity implements DateRangeInterface
$builder->addId();
$builder->createManyToOne('initiative', Initiative::class)
$builder->createManyToOne('program', Program::class)
->inversedBy('tasks')
->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE')
->addJoinColumn('program_id', 'id', false, false, 'CASCADE')
->build();
$builder->createField('type', Types::STRING)
@@ -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('initiative', new NotBlank(message: 'mautic.program.task.initiative.required'));
$metadata->addPropertyConstraint('type', new NotBlank(message: 'mautic.program.task.type.required'));
$metadata->addPropertyConstraint('program', new NotBlank(message: 'mt3s.marketing_program.task.program.required'));
$metadata->addPropertyConstraint('type', new NotBlank(message: 'mt3s.marketing_program.task.type.required'));
$metadata->addPropertyConstraint('type', new Length(max: self::TYPE_MAX_LENGTH));
$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->addPropertyConstraint('plannedWork', new PositiveOrZero(message: 'mt3s.marketing_program.task.planned_work.invalid'));
$metadata->addPropertyConstraint('plannedWork', new Range(notInRangeMessage: 'mt3s.marketing_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 getInitiative(): ?Initiative
public function getProgram(): ?Program
{
return $this->initiative;
return $this->program;
}
public function setInitiative(?Initiative $initiative): static
public function setProgram(?Program $program): static
{
$this->isChanged('initiative', $initiative);
$this->initiative = $initiative;
$this->isChanged('program', $program);
$this->program = $program;
return $this;
}
+2 -2
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata;
@@ -17,7 +17,7 @@ use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
*/
class TaskDependency
{
public const TABLE_NAME = 'initiative_task_dependencies';
public const TABLE_NAME = 'mt3s_mp_program_task_dependencies';
private ?int $id = null;
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
+2 -2
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
/**
* The kind of a task. The order of the cases is the order of the dropdown.
@@ -15,7 +15,7 @@ enum TaskKind: string
public function getLabelKey(): string
{
return 'mautic.program.task.kind.'.$this->value;
return 'mt3s.marketing_program.task.kind.'.$this->value;
}
/**
+3 -3
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\Common\Collections\ArrayCollection;
@@ -19,12 +19,12 @@ use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
*/
class TaskRaci
{
public const TABLE_NAME = 'initiative_task_raci';
public const TABLE_NAME = 'mt3s_mp_program_task_raci';
/**
* The join table carrying the stakeholders of a RACI row (TaskRaci -> Stakeholder).
*/
public const JOIN_TABLE_NAME = 'initiative_task_raci_stakeholders';
public const JOIN_TABLE_NAME = 'mt3s_mp_program_task_raci_stakeholders';
private ?int $id = null;
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
+7 -7
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
@@ -19,7 +19,7 @@ class TaskRepository extends CommonRepository
}
/**
* Loads the initiative, the dependencies (with their depends-on task) and the RACI rows (with their
* Loads the program, the dependencies (with their depends-on task) and the RACI rows (with their
* stakeholders) with the tasks, so that the list doesn't query them one by one.
*
* @param array<string, mixed> $args
@@ -30,7 +30,7 @@ class TaskRepository extends CommonRepository
$args['qb'] = $this->createQueryBuilder($alias)
->select($alias, 'init', 'dep', 'depTask', 'raci', 'raciStakeholder')
->leftJoin($alias.'.initiative', 'init')
->leftJoin($alias.'.program', 'init')
->leftJoin($alias.'.dependencies', 'dep')
->leftJoin('dep.dependsOn', 'depTask')
->leftJoin($alias.'.raci', 'raci')
@@ -40,11 +40,11 @@ class TaskRepository extends CommonRepository
}
/**
* All tasks of an initiative, ordered by name, with their dependencies and RACI rows loaded.
* All tasks of an program, ordered by name, with their dependencies and RACI rows loaded.
*
* @return Task[]
*/
public function findByInitiative(Initiative $initiative): array
public function findByProgram(Program $program): array
{
return $this->createQueryBuilder('t')
->select('t', 'dep', 'depTask', 'raci', 'raciStakeholder')
@@ -52,8 +52,8 @@ class TaskRepository extends CommonRepository
->leftJoin('dep.dependsOn', 'depTask')
->leftJoin('t.raci', 'raci')
->leftJoin('raci.stakeholders', 'raciStakeholder')
->where('t.initiative = :initiative')
->setParameter('initiative', $initiative)
->where('t.program = :program')
->setParameter('program', $program)
->orderBy('t.name', 'ASC')
->addOrderBy('t.id', 'ASC')
->getQuery()
+2 -2
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Entity;
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
/**
* Task status. The order of the cases is the order of the dropdown on the task form.
@@ -16,7 +16,7 @@ enum TaskStatus: string
public function getLabelKey(): string
{
return 'mautic.program.task.status.'.$this->value;
return 'mt3s.marketing_program.task.status.'.$this->value;
}
/**