Skip to content

Commit 339b9da

Browse files
committed
docs updated
1 parent 58d6e12 commit 339b9da

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

HelpEN.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,27 @@ foreach ($selectCustomCols as $rows)
113113

114114
### Select Join
115115

116-
select data from tables *article*, *authors*, *tags*
116+
select data from tables *articles*, *authors*, *tags*
117117
```php
118-
$db->selectJoin([
119-
'article' => [
120-
'id AS artid', 'title AS atrtitle', 'content', 'image', 'author_id', 'tag_id', 'published'
118+
$articles = $db->selectJoin([
119+
'articles' => [
120+
'id AS artid', 'title AS atrtitle', 'content', 'image', 'author_id', 'published'
121121
],
122122
'authors' => [
123123
'id AS autid', 'name'
124124
],
125125
'tags' => [
126126
'id AS tgid', 'title AS tgtitle'
127127
]
128-
], [
129-
'author_id', 'tag_id'
128+
], ['authors' => [
129+
'articles.author_id', 'authors.id'
130+
],
131+
'tags' => [
132+
'tags.article_id', 'tags.id'
133+
]
130134
]);
135+
// check the result
136+
var_dump($articles);die;
131137
```
132138
to avoid conflicts for columns *id* and *title* give aliases
133139

HelpRU.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,27 @@ foreach ($selectCustomCols as $rows)
113113

114114
### Select Join
115115

116-
выбираем данные из таблиц *article*, *authors*, *tags*
116+
выбираем данные из таблиц *articles*, *authors*, *tags*
117117
```php
118-
$db->selectJoin([
119-
'article' => [
120-
'id AS artid', 'title AS atrtitle', 'content', 'image', 'author_id', 'tag_id', 'published'
118+
$articles = $db->selectJoin([
119+
'articles' => [
120+
'id AS artid', 'title AS atrtitle', 'content', 'image', 'author_id', 'published'
121121
],
122122
'authors' => [
123123
'id AS autid', 'name'
124124
],
125125
'tags' => [
126126
'id AS tgid', 'title AS tgtitle'
127127
]
128-
], [
129-
'author_id', 'tag_id'
128+
], ['authors' => [
129+
'articles.author_id', 'authors.id'
130+
],
131+
'tags' => [
132+
'tags.article_id', 'tags.id'
133+
]
130134
]);
135+
// проверяем что получили
136+
var_dump($articles);die;
131137
```
132138
во избежание конфликтов для колонок *id* и *title* задаем псевдонимы
133139

0 commit comments

Comments
 (0)