You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/components/cache.rst
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,7 @@ All you need to do now is to clear all tagged items:
43
43
.. code-block:: php
44
44
45
45
$cache->invalidateTags(['firstTag']);
46
+
46
47
Pools clearing
47
48
==============
48
49
@@ -54,6 +55,7 @@ Cache Pools include methods to delete a cache item, some of them, or all of them
54
55
.. code-block:: php
55
56
56
57
$isDeleted = $cache->deleteItem('user_'.$userId);
58
+
57
59
Use the ``Psr\\Cache\\CacheItemPoolInterface::deleteItems`` method to delete several cache items simultaneously - it returns true only if all the items have been deleted, even when any or some of them don't exist.
Copy file name to clipboardExpand all lines: docs/design/retrieving_system_information.rst
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
Retrieving Mautic settings in Twig
2
-
=============================================
2
+
##################################
3
3
4
4
Mautic allows you to access configuration settings directly in Twig templates using the ``configGetParameter`` function. This feature is particularly useful for creating display conditions or showing existing data in your templates.
5
5
6
6
Basic usage
7
-
-----------
7
+
***********
8
8
9
9
To retrieve a setting, use the ``configGetParameter`` function with the parameter name as its argument:
10
10
@@ -13,7 +13,7 @@ To retrieve a setting, use the ``configGetParameter`` function with the paramete
13
13
{{ configGetParameter('parameter_name') }}
14
14
15
15
Display conditions
16
-
------------------
16
+
==================
17
17
18
18
Use ``configGetParameter`` in conditional statements to control the display of content based on configuration settings:
19
19
@@ -24,7 +24,7 @@ Use ``configGetParameter`` in conditional statements to control the display of c
24
24
{% endif %}
25
25
26
26
Displaying configuration values
27
-
-------------------------------
27
+
===============================
28
28
29
29
To directly display a configuration value in your template, use the following syntax:
30
30
@@ -45,12 +45,12 @@ For example, to display the API OAuth2 access token lifetime:
45
45
API OAuth2 Access Token Lifetime: {{ configGetParameter('api_oauth2_access_token_lifetime') }}
46
46
47
47
Finding available parameters
48
-
----------------------------
48
+
============================
49
49
50
50
The ``/config/local.php`` file contains available configuration parameters, once you save the global configuration form for the first time. This file contains the complete list of settings that are accessible using ``configGetParameter``.
51
51
52
52
Identifying parameter names
53
-
---------------------------
53
+
===========================
54
54
55
55
To find the correct parameter name for a specific setting:
56
56
@@ -67,7 +67,7 @@ For example, if you see:
67
67
The corresponding parameter name would be ``api_oauth2_access_token_lifetime``.
68
68
69
69
Additional information
70
-
----------------------
70
+
**********************
71
71
72
72
- Be cautious when displaying sensitive configuration data in templates.
73
73
- Always consider providing default values when using configuration parameters to handle cases where the setting aren't defined.
Copy file name to clipboardExpand all lines: docs/plugins/from-4-to-5.rst
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,17 @@
1
1
Update Plugins for Mautic 5
2
-
=======================================
2
+
###########################
3
3
4
4
Here is a list of steps that most of the Plugins may need to take to upgrade from Mautic 4 to Mautic 5. You should be able to get through each step, make a commit, move to the next one and once you are at finished you have upgraded your Plugin.
5
5
6
6
Continuous Integration
7
-
-------------------------
7
+
**********************
8
8
9
9
If you don't have CI configured, this is the time to do it. This is an optional step but it makes sense to do it at the beginning rather than later. Here's how to get it done: :doc:`/plugins/continuous-integration`.
10
10
11
11
In your PR add also support for PHP 8.1 and 8.2, and upgrade the Mautic version from 4.4 to 5.1. One more thing is that Mautic 5 have ``local.php`` in ``config/local.php`` instead of ``app/config/local.php`` so update that as well.
12
12
13
13
Autowiring
14
-
-------------
14
+
**********
15
15
16
16
Mautic 5 comes with autowiring of PHP services which means the developer experience is much improved, and the code size is reduced.
17
17
@@ -24,7 +24,7 @@ To quickly verify that the wiring of services is complete and configured correct
24
24
.. note:: Ideally, you should be able to delete the whole ``services`` section from your ``config.php`` file, but do that as a cherry on top once you are sure everything is working as the later steps in this process may yet cause you difficulties.
25
25
26
26
``config.php`` - controllers
27
-
---------------------------
27
+
****************************
28
28
29
29
``config.php`` should be much lighter now when all services are gone after autowiring is configured. There is one more thing to verify. The controllers are now defined with a different syntax. Here is an example:
30
30
@@ -36,7 +36,7 @@ To quickly verify that the wiring of services is complete and configured correct
36
36
Symfony 5 is much more explicit. That's a good thing even if it's longer. You don't have to guess what the syntax is. It's basically just standard FQCN (Fully Qualified Class Name) with the full method name behind the 2 colons. You don't even need to call the controller method `*Action` any more.
37
37
38
38
Rendering views
39
-
------------------
39
+
***************
40
40
41
41
As Symfony 5 removed the PHP templating engine, Mautic had to switch to Twig. Your Plugin must also update the any views from PHP to Twig. Here is a helpful resource on how to migrate the ``*.html.php`` files to ``*.html.twig`` files:
42
42
@@ -58,7 +58,7 @@ Running this command is faster than refreshing all the views in the browser. It
58
58
.. vale off
59
59
60
60
The Integration class
61
-
------------------------
61
+
*********************
62
62
63
63
.. vale on
64
64
@@ -72,7 +72,7 @@ If you went ahead and deleted all services from ``config.php``, you may experien
72
72
.. note:: Replace `[MY_INTEGRATION]` with your Plugin name.
73
73
74
74
Compiler passes
75
-
------------------
75
+
***************
76
76
77
77
If your Plugin uses a compiler pass, you may have to verify that it works correctly. In many cases you may have to change the service alias with FQCN like so:
78
78
@@ -82,7 +82,7 @@ If your Plugin uses a compiler pass, you may have to verify that it works correc
@@ -94,7 +94,7 @@ This one is a quick find and replace:
94
94
Notice you can also use FQCN instead of string service keys which is more convenient.
95
95
96
96
Automated refactoring
97
-
------------------------
97
+
**********************
98
98
99
99
Your Plugin should be working on Mautic 5 by now. Wouldn't it be great to shorten the code a little more? Mautic 5 uses PHP 8.0+ so can take advantage of the syntax. Rector can upgrade the code for you.
100
100
@@ -103,14 +103,14 @@ Run ``bin/rector process plugins/MyBundle`` and review the changes.
103
103
.. note:: Update MyBundle with your bundle name.
104
104
105
105
Automated code style
106
-
-----------------------
106
+
********************
107
107
108
108
Another great way how to improve your Plugin code base quality is to run the CS Fixer: ``bin/php-cs-fixer fix plugins/MyBundle``.
109
109
110
110
.. note:: Update MyBundle with your bundle name.
111
111
112
112
Static analysis
113
-
-------------------
113
+
***************
114
114
115
115
PHPSTAN is another amazing tool that detects bugs for you. It's better to run it on the whole codebase including core Mautic, so it's aware of all classes.
116
116
@@ -119,6 +119,6 @@ Run ``composer phpstan``
119
119
If your Plugin has more PHPSTAN errors than you can handle right now, consider using :xref:`PHPSTAN baseline`. It allows you to store your tech debt to a single file and it forces you to write better code from now on. And you can reduce the baseline by small chunks every month to get to 0.
120
120
121
121
Conclusion
122
-
----------
122
+
**********
123
123
124
124
This list of steps is compiled by Mautic Plugin developers for the Mautic Plugin developers. If you find that some common problem isn't addressed here, please add it.
0 commit comments