Skip to content

docs: Port "Model factory" service page to 7.2#585

Open
promptless-for-oss wants to merge 1 commit into
mautic:7.2from
Promptless:promptless/docs-issue-363-model-factory-7.2
Open

docs: Port "Model factory" service page to 7.2#585
promptless-for-oss wants to merge 1 commit into
mautic:7.2from
Promptless:promptless/docs-issue-363-model-factory-7.2

Conversation

@promptless-for-oss

Copy link
Copy Markdown
Contributor

Open this suggestion in Promptless to view citations and reasoning process

Ports the legacy Model factory guide into docs/plugin_services/model_factory.rst, converting the Markdown source to RST and modernizing the example to constructor injection of ModelFactory. Documents the hasModel()/getModel() runtime model-resolution API. Resolves docs issue #363; targets the 7.2 base branch per the porting batch.

Trigger Events


Tip: Use labels in the Promptless dashboard to categorize suggestions by release or team 🏷️

Injects the legacy Model factory guide into docs/plugin_services/model_factory.rst,
converting the Markdown source to RST and modernizing the example to use
constructor injection of ModelFactory. Resolves docs issue mautic#363 (targeting 7.2).
.. vale on No newline at end of file
.. vale on

Use ``Mautic\CoreBundle\Factory\ModelFactory`` when you don't know which model a service needs until runtime - for example, when the Channel and Channel ID live in the database and your code has to look up the Channel entity. Inject the factory into your service:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ported the legacy _plugin_services_model_factory.md guide — the ModelFactory use case (runtime model resolution by Channel/Channel ID), the hasModel()/getModel() methods, and the emailMautic\EmailBundle\Model\EmailModel example all come from this source, modernized to constructor injection.

Source: https://github.com/mautic/developer-documentation/blob/main/source/includes/_plugin_services_model_factory.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant