Add daily email
This commit is contained in:
parent
37863c6c24
commit
8d3f6f694e
3 changed files with 131 additions and 0 deletions
|
@ -6507,5 +6507,12 @@
|
|||
],
|
||||
"path_alias.e5e3676f-bd60-4370-ac4a-ea325d3ce126": [
|
||||
"node.0fa5e5dc-4e15-4075-9abf-6bf6c59a1e2f"
|
||||
],
|
||||
"node.15089c84-d265-4024-981e-e3c1ca354659": [
|
||||
"user.b8966985-d4b2-42a7-a319-2e94ccfbb849",
|
||||
"node.3074e1e9-c691-4f73-a71c-cfe5920f884e"
|
||||
],
|
||||
"path_alias.dc2b1737-eeff-4834-b48e-03e8d9279074": [
|
||||
"node.15089c84-d265-4024-981e-e3c1ca354659"
|
||||
]
|
||||
}
|
97
content/node.15089c84-d265-4024-981e-e3c1ca354659.json
Normal file
97
content/node.15089c84-d265-4024-981e-e3c1ca354659.json
Normal file
|
@ -0,0 +1,97 @@
|
|||
{
|
||||
"uuid": [
|
||||
{
|
||||
"value": "15089c84-d265-4024-981e-e3c1ca354659"
|
||||
}
|
||||
],
|
||||
"langcode": [
|
||||
{
|
||||
"value": "en"
|
||||
}
|
||||
],
|
||||
"type": [
|
||||
{
|
||||
"target_id": "daily_email",
|
||||
"target_type": "node_type",
|
||||
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
|
||||
}
|
||||
],
|
||||
"revision_timestamp": [
|
||||
{
|
||||
"value": "2025-06-23T21:19:48+00:00"
|
||||
}
|
||||
],
|
||||
"revision_uid": [
|
||||
{
|
||||
"target_type": "user",
|
||||
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
|
||||
}
|
||||
],
|
||||
"revision_log": [],
|
||||
"status": [
|
||||
{
|
||||
"value": true
|
||||
}
|
||||
],
|
||||
"uid": [
|
||||
{
|
||||
"target_type": "user",
|
||||
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
|
||||
}
|
||||
],
|
||||
"title": [
|
||||
{
|
||||
"value": "My thoughts on the Action pattern"
|
||||
}
|
||||
],
|
||||
"created": [
|
||||
{
|
||||
"value": "2025-06-20T20:26:30+00:00"
|
||||
}
|
||||
],
|
||||
"changed": [
|
||||
{
|
||||
"value": "2025-06-23T21:19:48+00:00"
|
||||
}
|
||||
],
|
||||
"promote": [
|
||||
{
|
||||
"value": false
|
||||
}
|
||||
],
|
||||
"sticky": [
|
||||
{
|
||||
"value": false
|
||||
}
|
||||
],
|
||||
"default_langcode": [
|
||||
{
|
||||
"value": true
|
||||
}
|
||||
],
|
||||
"revision_translation_affected": [
|
||||
{
|
||||
"value": true
|
||||
}
|
||||
],
|
||||
"path": [
|
||||
{
|
||||
"alias": "\/daily\/2025\/06\/20\/my-thoughts-action-pattern",
|
||||
"langcode": "en"
|
||||
}
|
||||
],
|
||||
"body": [
|
||||
{
|
||||
"value": "The Action pattern is a relatively new design pattern that's become popular in the PHP community, particularly with Laravel Developers.\r\n\r\nThe pattern is a simplified version of the Command pattern, with no separate Handler class. The Action class is responsible for the handling and execution logic.\r\n\r\nIn most cases, an Action class only has a single public method called `execute()` or `handle()`, or uses PHP's `__invoke()` magic method.\r\n\r\nThis is a different approach from a Service class that has multiple methods to perform different tasks.\r\n\r\nHere's a simplified version of the code of an Action from my website:\r\n\r\n```php\r\n<?php\r\n\r\nreadonly final class AddRandomCtaToDailyEmail {\r\n\r\n public function __construct(private EntityTypeManagerInterface $entityTypeManager) {\r\n }\r\n\r\n public function __invoke(DailyEmail $email): void {\r\n \/\/ Checks a call to action isn't already added.\r\n \/\/ If not, a random one is selected and added.\r\n }\r\n\r\n}\r\n```\r\n\r\nNote the `DailyEmail` class is [a bundle class][0] I've created that extends the regular `Node` class.\r\n\r\nDifferent to a service, the class name describes the action being performed - usually starting with a verb followed by a noun to describe the action being taken and the object it's being taken on.\r\n\r\nIt's a simple pattern that doesn't require additional packages or libraries, and it's easy to implement in different frameworks and other languages.\r\n\r\nWhether you call this an Action, Command or something else, I like that it encourages writing more structured code that's easy to read and test.\r\n\r\n[0]: \/daily\/2025\/06\/17\/drupal-bundle-classes",
|
||||
"format": "markdown",
|
||||
"processed": "<p>The Action pattern is a relatively new design pattern that's become popular in the PHP community, particularly with Laravel Developers.<\/p>\n<p>The pattern is a simplified version of the Command pattern, with no separate Handler class. The Action class is responsible for the handling and execution logic.<\/p>\n<p>In most cases, an Action class only has a single public method called <code>execute()<\/code> or <code>handle()<\/code>, or uses PHP's <code>__invoke()<\/code> magic method.<\/p>\n<p>This is a different approach from a Service class that has multiple methods to perform different tasks.<\/p>\n<p>Here's a simplified version of the code of an Action from my website:<\/p>\n<pre><code><?php\n\nreadonly final class AddRandomCtaToDailyEmail {\n\n public function __construct(private EntityTypeManagerInterface $entityTypeManager) {\n }\n\n public function __invoke(DailyEmail $email): void {\n \/\/ Checks a call to action isn't already added.\n \/\/ If not, a random one is selected and added.\n }\n\n}\n<\/code><\/pre><p>Note the <code>DailyEmail<\/code> class is <a href=\"http:\/\/localhost:8888\/daily\/2025\/06\/17\/drupal-bundle-classes\">a bundle class<\/a> I've created that extends the regular <code>Node<\/code> class.<\/p>\n<p>Different to a service, the class name describes the action being performed - usually starting with a verb followed by a noun to describe the action being taken and the object it's being taken on.<\/p>\n<p>It's a simple pattern that doesn't require additional packages or libraries, and it's easy to implement in different frameworks and other languages.<\/p>\n<p>Whether you call this an Action, Command or something else, I like that it encourages writing more structured code that's easy to read and test.<\/p>\n",
|
||||
"summary": ""
|
||||
}
|
||||
],
|
||||
"field_daily_email_cta": [
|
||||
{
|
||||
"target_type": "node",
|
||||
"target_uuid": "3074e1e9-c691-4f73-a71c-cfe5920f884e"
|
||||
}
|
||||
]
|
||||
}
|
27
content/path_alias.dc2b1737-eeff-4834-b48e-03e8d9279074.json
Normal file
27
content/path_alias.dc2b1737-eeff-4834-b48e-03e8d9279074.json
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"uuid": [
|
||||
{
|
||||
"value": "dc2b1737-eeff-4834-b48e-03e8d9279074"
|
||||
}
|
||||
],
|
||||
"langcode": [
|
||||
{
|
||||
"value": "en"
|
||||
}
|
||||
],
|
||||
"path": [
|
||||
{
|
||||
"value": "\/node\/15089c84-d265-4024-981e-e3c1ca354659"
|
||||
}
|
||||
],
|
||||
"alias": [
|
||||
{
|
||||
"value": "\/daily\/2025\/06\/20\/my-thoughts-action-pattern"
|
||||
}
|
||||
],
|
||||
"status": [
|
||||
{
|
||||
"value": true
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue