From 8ba965314b577ac62a48999f5999c05ba024e31c Mon Sep 17 00:00:00 2001 From: flowers Date: Mon, 22 Apr 2024 09:04:02 -0500 Subject: [PATCH 1/4] ACP2E-3031: Update the documentation on OM in templates --- src/pages/coding-standards/technical-guidelines.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/coding-standards/technical-guidelines.md b/src/pages/coding-standards/technical-guidelines.md index 236c1a841..a2f6fe823 100644 --- a/src/pages/coding-standards/technical-guidelines.md +++ b/src/pages/coding-standards/technical-guidelines.md @@ -522,6 +522,8 @@ You need to read configuration from different sources (like database or filesyst 6.2.5 Blocks MUST NOT assume that a specific, or any, controller has been invoked for current request. +6.2.6 Templates MUST NOT instantiate objects. All objects MUST be passed from the block. + ### 6.3. Data Access (Persistence) layer 6.3.1. Entities MAY have fields scoped differently (in product, EAV --- per store, options --- per website). From 92a35290816a19877a69c2a27683ea8f07f12eee Mon Sep 17 00:00:00 2001 From: flowers Date: Mon, 22 Apr 2024 09:58:13 -0500 Subject: [PATCH 2/4] ACP2E-3031: Update the documentation on OM in templates --- src/pages/coding-standards/technical-guidelines.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/coding-standards/technical-guidelines.md b/src/pages/coding-standards/technical-guidelines.md index a2f6fe823..f70208854 100644 --- a/src/pages/coding-standards/technical-guidelines.md +++ b/src/pages/coding-standards/technical-guidelines.md @@ -522,7 +522,10 @@ You need to read configuration from different sources (like database or filesyst 6.2.5 Blocks MUST NOT assume that a specific, or any, controller has been invoked for current request. -6.2.6 Templates MUST NOT instantiate objects. All objects MUST be passed from the block. +6.2.6 Templates MUST NOT instantiate objects. All objects MUST be passed from the Block object. +This way, the template remains stateless and its sole responsibility is to display the data it receives from the Block object. +This approach promotes a clear separation of concerns, improves testability, and makes the code more modular and easier to maintain. +It also ensures that the template does not have unexpected side effects, as it is not responsible for creating objects or managing their lifecycle. ### 6.3. Data Access (Persistence) layer From 2ae7ac38ae564ea34e21d7bd7538bcca803da637 Mon Sep 17 00:00:00 2001 From: flowers Date: Mon, 22 Apr 2024 12:05:33 -0500 Subject: [PATCH 3/4] ACP2E-3031: Update the documentation on OM in templates --- src/pages/coding-standards/technical-guidelines.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/pages/coding-standards/technical-guidelines.md b/src/pages/coding-standards/technical-guidelines.md index f70208854..2fe0b3bea 100644 --- a/src/pages/coding-standards/technical-guidelines.md +++ b/src/pages/coding-standards/technical-guidelines.md @@ -523,9 +523,6 @@ You need to read configuration from different sources (like database or filesyst 6.2.5 Blocks MUST NOT assume that a specific, or any, controller has been invoked for current request. 6.2.6 Templates MUST NOT instantiate objects. All objects MUST be passed from the Block object. -This way, the template remains stateless and its sole responsibility is to display the data it receives from the Block object. -This approach promotes a clear separation of concerns, improves testability, and makes the code more modular and easier to maintain. -It also ensures that the template does not have unexpected side effects, as it is not responsible for creating objects or managing their lifecycle. ### 6.3. Data Access (Persistence) layer From fbc4f28439bfacc47256453086fc100f9e2a2c09 Mon Sep 17 00:00:00 2001 From: flowers Date: Mon, 22 Apr 2024 13:27:28 -0500 Subject: [PATCH 4/4] ACP2E-3031: Update the documentation on OM in templates --- src/pages/coding-standards/technical-guidelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/coding-standards/technical-guidelines.md b/src/pages/coding-standards/technical-guidelines.md index 2fe0b3bea..91c01cb4e 100644 --- a/src/pages/coding-standards/technical-guidelines.md +++ b/src/pages/coding-standards/technical-guidelines.md @@ -522,7 +522,7 @@ You need to read configuration from different sources (like database or filesyst 6.2.5 Blocks MUST NOT assume that a specific, or any, controller has been invoked for current request. -6.2.6 Templates MUST NOT instantiate objects. All objects MUST be passed from the Block object. +6.2.6 Templates MUST NOT instantiate objects. All objects MUST be passed from the Block objects. ### 6.3. Data Access (Persistence) layer