Skip to content

Commit 852a790

Browse files
authored
Merge pull request #1008 from ExpressionEngine/7.dev
pushing live docs on AR and models and layout Set clarification
2 parents e1f85e2 + 3ff739a commit 852a790

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

docs/development/database-access.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
-->
99

1010
# Accessing the Database
11-
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).
12-
13-
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.
11+
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.
1412

13+
Each approach has its own strengths, and you can use either depending on the specific needs of your code.
1514

1615
Let's use a real example to show how you might access data using both methods:
1716

@@ -46,7 +45,7 @@ class Memberlist extends AbstractRoute
4645
}
4746
```
4847

49-
Here is the class syntax using the legacy Database Drive:
48+
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:
5049

5150
```
5251
namespace ExpressionengineDeveloper\AmazingAddOn\Module\Tags;
@@ -88,4 +87,6 @@ Douglas
8887
Richmond
8988
```
9089

90+
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.
91+
9192
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.

docs/templates/layouts.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ You can set variables in your templates that can later be used in your layouts.
8989

9090
#### {layout:set}
9191

92+
NOTE: **Note:** {layout:set} cannot be used with {layout:set:append} and {layout:set:prepend}
93+
9294
**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:
9395

9496
{layout:set name='title'}My Page Title{/layout:set}

0 commit comments

Comments
 (0)