refactor(naming): normalise the Smart Links domain to the bundle's canonical names (0.18.1)
One bundle, two domains (Marketing Programs and Smart Links), one naming scheme.\nNothing in the database changed (no tables, columns, URLs or stored data);\nthe runtime was rebuilt and verified live.\n\n- Route names mautic_smartlinks_* -> mt3s_smartlinks_* (paths unchanged);\n the menu ids follow\n- Model service aliases collapsed to one canonical alias per model:\n mautic.mt3smarketingprogram.model.<entity> (core's mautic.<x>.model.<x>\n pattern), so getModel('mt3smarketingprogram.smart_link'); the dead\n mt3s.* and mautic.mt3smp.*-era aliases are gone\n- Translation keys mautic.smartlinks.* -> mt3s.smart_links.*\n (mautic.config.tab.smartlinksconfig stays: core derives it)\n- Settings parameters smartlinks_utm_config/smartlinks_config ->\n mt3s_smart_links_utm_config/mt3s_smart_links_config, with both legacy\n keys (smartlinks_* of the standalone bundle, utm_manager_* of the\n UtmManagerBundle era) still readable until the settings are saved again\n- JS loader prefixes smartlinksSmartLink/smartlinksUtmTaxonomy ->\n mt3sMpSmartLink/mt3sMpUtmTaxonomy (the mt3sMp* family of the program\n domain)\n- Integration/Support/ConfigSupport -> SmartlinksConfigSupport; integration\n display names aligned ('MT3S Marketing Program' / 'Smart Links'); the\n dead mautic.plugin.smartlinks.name catalog keys removed\n- phpunit suite renamed UtmManagerBundle -> MT3SMarketingProgramBundle;\n version 0.18.1\n\nVerified: full php -l, 90/90 unit tests (phpunit 11.5 phar), cache clear +\nwarm + assets regenerate + plugins reload (as www-data), live: both lists\nand forms (mauticContent mt3sMpSmartLink/mt3sMpUtmTaxonomy), both config\ntabs, the menu labels, the program pages (regression), the public /l/y32b\nredirect through the legacy utm_manager_* settings (302 with the taxonomy's\nUTM values, wrong host and unknown slug 404), all ini catalogs parse, zero\nnew log errors.
This commit is contained in:
1 parent
dce849610c
commit
9d81d6c815
53 files changed
+777
-751
No files matched your search
@@ -1,4 +1,4 @@
|
||||
# Mautic MT3S Marketing plugin
|
||||
# Mautic MT3S Marketing Program plugin
|
||||
|
||||
A custom Mautic 7 plugin (`MT3SMarketingProgramBundle`) by MT3 Solutions with two separate domains: **Marketing Programs** — programs with a name, status, owner, dates, budget and category, with their mt3s_mp_programs — and **Smart Links** — short links (`/l/{slug}`) that tag the click with the UTM parameters of a UTM taxonomy before redirecting. The two domains share one bundle, one permission base (`mt3smarketingprogram:*`), one Plugins page entry and one config page, but keep separate menus, tables and code.
|
||||
|
||||
@@ -80,7 +80,7 @@ The plugin uses the IntegrationsBundle conventions:
|
||||
- `Controller/SmartLinkController.php` and `Resources/views/SmartLink/`: the Smart Links list and form (**Smart Links > Smart Links**, `/s/smart-links`), built on core's `AbstractStandardFormController`.
|
||||
- `Controller/UtmTaxonomyController.php` and `Resources/views/UtmTaxonomy/`: the UTM taxonomies list and form (**Smart Links > UTM Taxonomies**, `/s/utm-taxonomies`). Replaced the placeholder page of 0.17.0 in 0.18.0. `Model/UtmTaxonomyModel.php`, `Model/SmartLinkModel.php`, `Entity/SmartLink.php`, `Entity/SmartLinkHit.php`, `Entity/UtmTaxonomy.php` (tables `smart_links`, `smart_link_hits`, `utm_taxonomies` — unchanged from the standalone plugin), `Catalog/` (redirect codes 301/302/307/308, redirect types `external`/`mautic`, the UTM parameter catalog and its modes), `Form/` (the link and taxonomy forms, the per-taxonomy UTM fields via `Form/UtmFieldsApplicator.php`, the validators) and `Controller/PublicController.php` (the public `/l/{slug}`) make up the Smart Links domain.
|
||||
- `EventListener/SmartLinksConfigSubscriber.php`: adds the **Smart Links Settings** tab to Settings > Configuration (`Form/Type/SmartLinksConfigType.php`, `Form/Type/SmartlinksSettingsType.php`, `Integration/Support/ConfigSupport.php`), next to the plugin's **Program Settings** tab; `Service/UtmConfigurationProvider.php` and `Service/UtmConfigurationNormalizer.php` read those parameters, `Service/SmartLinkShortUrlBuilder.php` builds the redirect URLs.
|
||||
- `Assets/js/mt3s-mp-smartlinks.js`: the Smart Links form script (started by `Mautic.smartlinksSmartLinkOnLoad()` when a page's `mauticContent` is `smartlinksSmartLink`).
|
||||
- `Assets/js/mt3s-mp-smartlinks.js`: the Smart Links form script (started by `Mautic.mt3sMpSmartLinkOnLoad()` when a page's `mauticContent` is `mt3sMpSmartLink`).
|
||||
- `Tests/Unit/` and `phpunit.xml.dist`: the plugin's unit test suite (mostly covering the Smart Links domain: the catalog, the entities, the form type, the fields applicator, the validators, the models and the configuration provider).
|
||||
- `Controller/ItemTypesController.php` and `Resources/views/ItemTypes/form.html.twig`: the Item types page (**Marketing Programs > Item types**). The type lists that used to be sections of **Settings > Configuration > Marketing Program Settings** (insights, allocation, objective, task, stakeholder types and the audience decision roles and tones) are edited here. `Form/Type/ItemTypesType.php` builds the lists, `Service/ItemTypeInUseGuard.php` refuses to remove a type that items still use, and the page saves through core's `Configurator` exactly like the Settings pages do: merge into `config/local.php`, write, refresh the config cache. **Settings > Configuration > Marketing Program Settings** keeps only the plugin's general settings: the currency, the stakeholder phone region and the audience attribute toggles.
|
||||
- `Assets/js/mt3s-mp-program.js`: on the form, the objectives editor (add, remove, drag-and-drop ordering), and after a failed save, marking the tabs that contain errors with an icon and opening the first one. Started by `Mautic.mt3sMpProgramOnLoad()`.
|
||||
@@ -127,9 +127,9 @@ Permission keys:
|
||||
- `Entity/Audience.php`, `AudienceType.php`, `AudiencePriority.php` and `AudienceRepository.php`: the audiences of the global directory (table `mt3s_mp_program_audiences`, `plan_targets` before 0.15.0): name, a fixed type (persona, ICP, broad audience, lifecycle cohort, partner/influencer — each with its own pictogram), a tagline, the Mautic segments that hold this audience's contacts (see below), and the persona attributes the admin switched on (**Settings > Configuration > Marketing Program Settings**, one toggle per attribute, so a b2b install and a b2c install define their personas differently): profile criteria, motivations, barriers, frustrations (formerly pain points), triggers, a decision-making role (a value of the admin-edited list `mt3s_marketing_program_audience_decision_roles`), a preferred tone (checkboxes of the admin-edited list `mt3s_marketing_program_audience_tones`), preferred channels (checkboxes: email, SMS, web, social organic, paid social, paid search, events/webinar, outbound sales, partners), any number of Mautic stages (join table `mt3s_mp_program_audiences_stages`) and an estimated size. `Service/AudienceAttributes.php` reads the toggles.
|
||||
- **Segments**: each audience can have any number of Mautic segments (LeadBundle lists), purely informational — nothing requires one, and nothing in the program depends on them. They are stored in the join table `mt3s_mp_program_audiences_segments` (audience_id, leadlist_id), picked in the audience form (published segments only), shown in the directory's Segments column (each with its count of contacts, from `lead_lists_leads` where `manually_removed = 0`) and on the detail page. `AudienceRepository::getSegmentContactCountsForAudiences()` computes the counts for the whole page in one query.
|
||||
- `Entity/ProgramAudience.php`: the link between a program and an audience (table `mt3s_mp_program_audiences_program`), with the audience's priority in that program (primary, secondary, exclusion), a program-specific value proposition and a position. Deleting the program or the audience deletes the link (ON DELETE CASCADE both sides).
|
||||
- `Model/AudienceModel.php`: the model, available as `mt3s.marketing_program.model.audience` or with `getModel('mt3smp.audience')`.
|
||||
- `Model/AudienceModel.php`: the model, available as `mautic.mt3smarketingprogram.model.audience` or with `getModel('mt3smarketingprogram.audience')`.
|
||||
- `Controller/AudienceController.php` and `Resources/views/Audience/`: the directory (**Marketing Programs > Audiences**), with the columns ID, Pictogram, Type, Name (with its tagline), Segments (each with its contact count), Estimated size, Active, and **Assigned mt3s_mp_programs** — the mt3s_mp_programs the audience is linked to, each with its priority in that program. The detail page lists the segments, the persona attributes that are filled in, and those mt3s_mp_programs.
|
||||
- `Model/ProgramModel.php`: the model, available as `mt3s.marketing_program.model.program` or with `getModel('mt3smp.program')`. A new program from `getEntity()` has the current user as owner.
|
||||
- `Model/ProgramModel.php`: the model, available as `mautic.mt3smarketingprogram.model.program` or with `getModel('mt3smarketingprogram.program')`. A new program from `getEntity()` has the current user as owner.
|
||||
- `Entity/ProgramDescriptionItem.php` and `ProgramDescriptionItemRepository.php`: a program's description items (table `mt3s_mp_program_description_items`): type, description and position. They make up the **Insights** tab and replace the former `description` field.
|
||||
- `Form/Type/ProgramType.php`, `ProgramObjectiveType.php` and `ProgramDescriptionItemType.php`: the create and edit form, with the objectives and the description items as collections
|
||||
- `Validator/Constraints/EndDateAfterStartDate.php`: the end date must be on or after the start date, when both are set. Used by mt3s_mp_programs and tasks, through `Entity/DateRangeInterface.php`.
|
||||
@@ -173,7 +173,7 @@ Behaviour to know about:
|
||||
|
||||
- `Entity/Stakeholder.php` and `StakeholderRepository.php`: a stakeholder (table `mt3s_mp_program_stakeholders`), the global directory of the people, companies and teams involved in the mt3s_mp_programs: name, email (validated, indexed for duplicate detection), phone, role, type and the active flag (`isPublished`). Independent of mt3s_mp_programs.
|
||||
- `Entity/ProgramStakeholder.php`: the link between a program and a stakeholder (table `mt3s_mp_program_stakeholders_program`), with the stakeholder's role in that program (free text, column `role_in_program`) and a position. Deleting the program or the stakeholder deletes the link (ON DELETE CASCADE both sides).
|
||||
- `Model/StakeholderModel.php`: the model, available as `mt3s.marketing_program.model.stakeholder` or with `getModel('mt3smp.stakeholder')`. On save, the phone number is normalized to E.164 using the default region from **Settings > Configuration > Marketing Program Settings** (parameter `mt3s_marketing_program_stakeholder_phone_region`, `FR` by default); a number that doesn't parse is kept exactly as typed, and the save is never blocked.
|
||||
- `Model/StakeholderModel.php`: the model, available as `mautic.mt3smarketingprogram.model.stakeholder` or with `getModel('mt3smarketingprogram.stakeholder')`. On save, the phone number is normalized to E.164 using the default region from **Settings > Configuration > Marketing Program Settings** (parameter `mt3s_marketing_program_stakeholder_phone_region`, `FR` by default); a number that doesn't parse is kept exactly as typed, and the save is never blocked.
|
||||
- `Controller/StakeholderController.php` and `Resources/views/Stakeholder/`: the directory (**Marketing Programs > Stakeholders**), with the columns ID, Pictogram, Type, Name, Role, Email (mailto link), Phone (tel link), Active, and **Assigned mt3s_mp_programs** — the mt3s_mp_programs the stakeholder is linked to, each with its role in that program. The detail page lists those mt3s_mp_programs too.
|
||||
- The stakeholder's type is the key of a stakeholder type set up in **Settings > Configuration > Marketing Program Settings** (parameter `mt3s_marketing_program_stakeholder_types`), same pattern as the other item types, pictogram included.
|
||||
- A program's **Stakeholders tab** links the directory to the program: each row picks an active stakeholder and gives its role in the program. The tab shows the harmonized table (pictogram, Type, Name, Role in the program, Role, Email, Phone, Active). Unpublished stakeholders are not offered in the picker, but keep their links.
|
||||
@@ -182,7 +182,7 @@ Behaviour to know about:
|
||||
|
||||
- `Entity/Task.php` and `TaskRepository.php`: a task (table `mt3s_mp_program_tasks`): type (with its pictogram), name, description, program, kind (task, milestone or phase), optional start and end dates (plain dates, no time), definition of done, planned work in whole hours, status (not for phases), dependencies (table `mt3s_mp_program_task_dependencies`) and RACI assignments (table `mt3s_mp_program_task_raci` with its `mt3s_mp_program_task_raci_stakeholders` join table)
|
||||
- `Entity/TaskStatus.php`: the status enum. The order of its cases is the order of the dropdown: `new` (New, the default), `todo` (To do), `in_progress` (In progress), `done` (Done). Stored as `VARCHAR(20)`, indexed.
|
||||
- `Model/TaskModel.php`: the model, available as `mt3s.marketing_program.model.task` or with `getModel('mt3smp.task')`. `getTaskTree($program)` returns a program's tasks as flat rows for the Tasks tab, ordered by name, with their dependencies and RACI rows fully loaded.
|
||||
- `Model/TaskModel.php`: the model, available as `mautic.mt3smarketingprogram.model.task` or with `getModel('mt3smarketingprogram.task')`. `getTaskTree($program)` returns a program's tasks as flat rows for the Tasks tab, ordered by name, with their dependencies and RACI rows fully loaded.
|
||||
- `Form/Type/TaskType.php`: the create and edit form
|
||||
- `Validator/Constraints/ValidTaskDependency.php`: a dependency must point at another task of the same program, and the dependency graph must not form a cycle (followed through the database, so a cycle crossing other tasks is caught too)
|
||||
|
||||
@@ -212,7 +212,7 @@ When you change the schema, add a migration in `Migrations/` and increase `versi
|
||||
|
||||
To avoid collisions with other plugins, such as UTM Manager, every identifier in this bundle is prefixed with the bundle's name (the `MT3S` in `MT3SMarketingProgramBundle`):
|
||||
|
||||
- Service IDs: `mt3s.marketing_program.*` (and the models resolve from `getModel('mt3smp.program')` etc.)
|
||||
- Service IDs: `mt3s.marketing_program.*` (and the models resolve from `getModel('mt3smarketingprogram.program')` etc.)
|
||||
- Form block prefixes: `mt3s_marketing_program_*` (`mt3s_marketing_program_task`, `mt3s_marketing_program_audience`, …)
|
||||
- Route names: `mt3s_marketing_program_*` (e.g. `mt3s_marketing_program_index`, `mt3s_marketing_program_task_action`, with `mt3s_marketing_program_utm_taxonomy_index` for the placeholder)
|
||||
- Translation keys: `mt3s.marketing_program.*`, plus `mautic.plugin.mt3smarketingprogram.name`
|
||||
@@ -231,6 +231,7 @@ The plugin was born as `PlanBundle` with a `Plan` entity (table `plans`) and men
|
||||
- 0.16.0: the full rename to `ProgramBundle` / `Program` (and a "plan" became an "initiative"). The bundle namespace, class names, the `plugins` DB row (`ProgramBundle`), all tables (`plan_*` → `initiative_*`), all columns (`plan_id` → `initiative_id`, `role_in_plan` → `role_in_initiative`), all permission keys (`plan:*` → `program:*`), the config parameters and the menu (root **Programs**, entry **Initiatives**, plus the placeholder **UTM Taxonomies**) took the new names. The data was kept: the migration renames the tables, it doesn't rebuild them.
|
||||
- 0.17.0: the rename to `MT3SMarketingProgramBundle` / "MT3S Marketing Program", and an initiative became a marketing program. The bundle namespace, class names, the `plugins` DB row (`MT3SMarketingProgramBundle`, name "MT3S Marketing Program"), all tables (`initiative_*` → `mt3s_mp_program_*`), all columns (`initiative_id` → `program_id`, `role_in_initiative` → `role_in_program`), all permission keys (`program:*` → `mt3smarketingprogram:*`), the routes, the service IDs, the config parameters, the URLs (`/s/marketing-programs`, …) and the menu (root **Marketing Programs**, entry **Marketing Programs**) took the new names, and the plugin's events (`mt3s.marketing_program.*`) and the `mt3s:marketing-program:refresh-stats` command were added. The data was kept again: `Version_0_17_0.php` renames the tables and carries over the rows the rename orphans — the plugins row, the roles' permission rows (which the 0.16.0 rename had missed), the categories (`plan`- and `initiative`-era rows) and the audit log.
|
||||
- 0.18.0: the merge of the standalone **Smartlinks** plugin (`SmartlinksBundle`, versions 0.1.0–0.6.0) into this bundle. The Smart Links and UTM Taxonomies code, tables (`smart_links`, `smart_link_hits`, `utm_taxonomies`), routes (`/s/smart-links`, `/s/utm-taxonomies`, the public `/l/{slug}`), translation keys (`mautic.smartlinks.*`) and settings keys (`smartlinks_*`, with the legacy `utm_manager_*` keys still readable) are unchanged; only the PHP namespace (`MauticPlugin\SmartlinksBundle\` → `MauticPlugin\MT3SMarketingProgramBundle\`), the service IDs, the template namespace (`@Smartlinks/` → `@MT3SMarketingProgram/`), the **Plugins page entry** (one row: "MT3S Marketing Program") and the **permission base** changed (`smartlinks:smart_links:*` → `mt3smarketingprogram:smart_links:*`, `smartlinks:taxonomies:*` → `mt3smarketingprogram:taxonomies:*` — roles must be re-granted). The incoming migrations were renamed `Version_0_X_0_SmartLinks.php` to avoid the class-name collision with this bundle's own migrations. The old placeholder page `/s/marketing-program-utm-taxonomies` is gone (the real feature is at `/s/utm-taxonomies`), and the dev environment mounts only this repository. The source repository is archived at its `post-merge-v1` tag.
|
||||
- 0.18.1: the naming normalization after the merge. The Smart Links **route names** were unified with the bundle's vendor prefix (`mautic_smartlinks_*` → `mt3s_smart_links_*`; the paths are unchanged: `/s/smart-links`, `/s/utm-taxonomies`, the public `/l/{slug}`), the **model service aliases** were collapsed to one canonical alias per model (`mautic.mt3smarketingprogram.model.<entity>`, so `getModel('mt3smarketingprogram.smart_link')`; the old `mt3s.*` and `mautic.mt3smp.*`-era aliases are gone), the **translation keys** of the domain were renamed (`mautic.smartlinks.*` → `mt3s.smart_links.*`; `mautic.config.tab.smartlinksconfig` stays, it is core's key), the **settings parameters** were renamed (`smartlinks_utm_config` → `mt3s_smart_links_utm_config`, `smartlinks_config` → `mt3s_smart_links_config`, with both legacy keys — the standalone SmartlinksBundle's `smartlinks_*` and the UtmManagerBundle's `utm_manager_*` — still readable until the settings are saved again), the **JS loader prefixes** were unified (`smartlinksSmartLink`/`smartlinksUtmTaxonomy` → `mt3sMpSmartLink`/`mt3sMpUtmTaxonomy`), `Integration/Support/ConfigSupport` was renamed `SmartlinksConfigSupport`, the integration display names were aligned ("MT3S Marketing Program" / "Smart Links") and the phpunit suite was renamed (`UtmManagerBundle` → `MT3SMarketingProgramBundle`). No tables, columns, URLs or stored data changed.
|
||||
- The old URLs (`/s/plans`, `/s/plan-tasks`, `/s/programs`, `/s/program-tasks`, …) are gone: the routes were renamed and the old names return 404.
|
||||
|
||||
A rename like this needs care:
|
||||
@@ -238,5 +239,5 @@ A rename like this needs care:
|
||||
- The historical migrations must stay literal (they describe the old schema) or be neutralized; after the entity renames, their Doctrine mappings no longer match and they can only run with literal SQL.
|
||||
- The `plugins` DB row must be updated to the new bundle name (and its version kept), or Mautic's installer treats the plugin as new and its `SchemaTool` pass creates empty tables from the current mappings. If that happens, drop the empty tables and turn the install into an update before reloading.
|
||||
- The permission keys of each role are stored in the `permissions` table per (bundle, name); a role that had `plan:plans:*` grants doesn't automatically get `mt3smarketingprogram:programs:*`, and cached permission sets in the sessions need a re-login.
|
||||
- `getModel()` resolves `mt3smp.program` to the service `mt3s.marketing_program.model.program`, unlike core bundles' `mautic.<x>.model.<x>`: only the service IDs decide.
|
||||
- `getModel('mt3smarketingprogram.<entity>')` resolves to the service `mautic.mt3smarketingprogram.model.<entity>`, like core bundles' `mautic.<x>.model.<x>`: only the service IDs decide.
|
||||
- The `config/local.php` parameter keys are not renamed by the migration either (they are not in the database): `plan_currency` → `mt3s_marketing_program_currency`, the `plan_*_types` lists → `mt3s_marketing_program_*_types`, and the pre-0.15 audience keys `plan_target_attribute_*`, `plan_target_decision_roles` and `plan_target_tones` → `mt3s_marketing_program_audience_attribute_*`, `mt3s_marketing_program_audience_decision_roles` and `mt3s_marketing_program_audience_tones`. Rename them by hand after upgrading, or the type lists on the settings page and every type dropdown read empty (the stored items keep their type keys, they only show "Unknown type").
|
||||
Reference in new issue
Block a user