Reference CorePermissions by FQCN instead of the removed mautic.security service id - #625
Conversation
…ity service id Mautic 8 (mautic/mautic PR #17121) replaces the PermissionsPass compiler pass with an AutowireIterator on CorePermissions and removes the mautic.security container service id and its alias. The FQCN Mautic\CoreBundle\Security\Permissions\CorePermissions is now the only container identifier for the security service, so update the plugin developer examples that still reference the removed mautic.security id.
| <?php | ||
|
|
||
| $security = $this->get('mautic.security'); | ||
| $security = $this->get(\Mautic\CoreBundle\Security\Permissions\CorePermissions::class); |
There was a problem hiding this comment.
mautic/mautic PR #17121 removes the 'mautic.security' service id and its alias to CorePermissions::class in app/bundles/CoreBundle/Config/services.php, registering CorePermissions under its FQCN id instead ($services->set(Mautic\CoreBundle\Security\Permissions\CorePermissions::class)). Confirms $this->get(CorePermissions::class) is the correct replacement for $this->get('mautic.security').
|
|
||
| /** @var \Mautic\CoreBundle\Security\Permissions\CorePermissions */ | ||
| $security = $this->get('mautic.security'); | ||
| $security = $this->get(\Mautic\CoreBundle\Security\Permissions\CorePermissions::class); |
There was a problem hiding this comment.
mautic/mautic PR #17121 removes the 'mautic.security' service id/alias and registers CorePermissions under its FQCN id in app/bundles/CoreBundle/Config/services.php. Confirms $this->get(CorePermissions::class) replaces $this->get('mautic.security').
|
|
||
| /** @var \Mautic\CoreBundle\Security\Permissions\CorePermissions */ | ||
| $security = $this->get('mautic.security'); | ||
| $security = $this->get(\Mautic\CoreBundle\Security\Permissions\CorePermissions::class); |
There was a problem hiding this comment.
Mautic's core services.php sets $services->defaults()->autowire()->autoconfigure()->public(), so services are public by default unless explicitly marked private. CorePermissions (registered by FQCN id with no ->public(false) override) remains a publicly gettable container service after PR #17121, so $this->get(CorePermissions::class) works the same way $this->get('mautic.security') did before.
| - no | ||
| - array[] | ||
| - Define methods to call after the service is instantiated. Use an array of arrays with keys as the method name and values the arguments to pass into the given method. For example, ``['methodCalls' => ['setSecurity' => ['mautic.security'],],],``. | ||
| - Define methods to call after the service is instantiated. Use an array of arrays with keys as the method name and values the arguments to pass into the given method. For example, ``['methodCalls' => ['setSecurity' => [\Mautic\CoreBundle\Security\Permissions\CorePermissions::class],],],``. |
There was a problem hiding this comment.
mautic/mautic PR #17121 removes the 'mautic.security' service id/alias, registering CorePermissions under its FQCN id. The methodCalls example argument must reference the new FQCN id.
| 'class' => \MauticPlugin\HelloWorldBundle\Controller\ApiController::class, | ||
| 'arguments' => [ | ||
| 'mautic.security', | ||
| \Mautic\CoreBundle\Security\Permissions\CorePermissions::class, |
There was a problem hiding this comment.
mautic/mautic PR #17121 removes the 'mautic.security' service id/alias, registering CorePermissions under its FQCN id. Per docs/plugins/config.rst's own documentation of the 'arguments' key ("Any other string is assumed to be the name of a defined service"), the controller's constructor argument must reference the new FQCN service id.
Open in Promptless
Mautic 8 (mautic/mautic PR #17121) replaces the
PermissionsPasscompiler pass with anAutowireIteratoronCorePermissionsand removes themautic.securitycontainer service id along with its alias. The FQCNMautic\CoreBundle\Security\Permissions\CorePermissionsis now the only container identifier for the security service.The plugin developer docs still reference the removed
mautic.securityid when showing how to obtain the security service, so those examples break on Mautic 8. This updates the four affected places to use theCorePermissionsFQCN instead:docs/plugins/permissions.rst— the "Using permissions"$this->get()example and the prose that names the service.docs/plugin_services/security.rst— the same$this->get()example and prose; the prose no longer claims amautic.securityalias exists.docs/plugins/config.rst— themethodCallsexample that passedmautic.securityas a service reference.docs/plugin_extensions/api.rst— the controllerargumentsexample that passedmautic.security.The
mautic.permissionsservice tag and theservices.permissionsregistration group — how plugin developers register their own permission classes — are unchanged by the PR and are left untouched. This is a behavior-preserving reference swap consistent with the established pattern for other removed string service aliases.Trigger Events