From 1bc63f4ec813b03fd99e3b7d0d182b67f36758f0 Mon Sep 17 00:00:00 2001 From: robinsowell Date: Wed, 11 Jun 2025 16:30:36 -0400 Subject: [PATCH 1/2] Beef up discussion of DB driver benefits --- docs/development/database-access.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/development/database-access.md b/docs/development/database-access.md index 6cf63fc15..438850340 100644 --- a/docs/development/database-access.md +++ b/docs/development/database-access.md @@ -8,10 +8,9 @@ --> # Accessing the Database -You may often want to query or update your database from within your add-on. This can be done using the [Model Service](development/services/model.md) or you can also execute SQL statements by using the legacy [Database Driver](development/legacy/database/index.md). - -TIP: The Model Service is much cleaner than the legacy Database Driver. However, it also has limitations on what it can do compared to the Database Driver. +You may often want to query or update your database from within your add-on. This can be done using the [Model Service](development/services/model.md) or you can execute SQL statements by using the [Database Driver](development/legacy/database/index.md) and its [Active Record](https://docs.expressionengine.com/latest/development/legacy/database/active-record.html) class. +Each approach has its own strengths, and you can use either depending on the specific needs of your code. Let's use a real example to show how you might access data using both methods: @@ -46,7 +45,7 @@ class Memberlist extends AbstractRoute } ``` -Here is the class syntax using the legacy Database Drive: +Here is the class syntax using the Database Driver's Active Record class, which provides more portability, cleaner code, and default secuirity enhancementsa versus raw queries: ``` namespace ExpressionengineDeveloper\AmazingAddOn\Module\Tags; @@ -88,4 +87,6 @@ Douglas Richmond ``` +The Database driver shines when pulling back raw data from specific sources quickly or making targeted inserts and updates. Models provide consistency and easy access to complex data. Use both as needed for fast, clean, secure interaction with the database. + This is only the beginning of how you can interact with the database through your add-on. Explore the [Model Service](development/services/model.md) and the legacy [Database Driver](development/legacy/database/index.md) to learn how to add more power to your add-on. \ No newline at end of file From e09722c1a9635f0f28ef4de1519a934cb277a2c8 Mon Sep 17 00:00:00 2001 From: Tom Jaeger Date: Wed, 11 Jun 2025 18:18:01 -0400 Subject: [PATCH 2/2] added some clarification --- docs/templates/layouts.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/templates/layouts.md b/docs/templates/layouts.md index 1c1706394..c2eb49de7 100755 --- a/docs/templates/layouts.md +++ b/docs/templates/layouts.md @@ -89,6 +89,8 @@ You can set variables in your templates that can later be used in your layouts. #### {layout:set} +NOTE: **Note:** {layout:set} cannot be used with {layout:set:append} and {layout:set:prepend} + **Setting** a variable works similarly to setting a string variable in a programming language, like JavaScript. The contents are set to the variable name you provide. In your template: {layout:set name='title'}My Page Title{/layout:set}