From c6aa4426a8b6bcf651d4f6c544ccb2794fab7dfe Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Nov 2023 07:05:37 +0900 Subject: [PATCH 1/3] docs: fix incorrect code --- user_guide_src/source/database/results/013.php | 2 +- user_guide_src/source/database/results/014.php | 2 +- user_guide_src/source/database/results/015.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/database/results/013.php b/user_guide_src/source/database/results/013.php index d0b1e445f01f..bb476f84eb80 100644 --- a/user_guide_src/source/database/results/013.php +++ b/user_guide_src/source/database/results/013.php @@ -6,7 +6,7 @@ class User public $email; public $username; - protected $last_login; + protected $lastLogin; public function lastLogin($format) { diff --git a/user_guide_src/source/database/results/014.php b/user_guide_src/source/database/results/014.php index f0845bf55ac3..fe88c6f0529e 100644 --- a/user_guide_src/source/database/results/014.php +++ b/user_guide_src/source/database/results/014.php @@ -7,5 +7,5 @@ foreach ($rows as $row) { echo $row->id; echo $row->email; - echo $row->last_login('Y-m-d'); + echo $row->lastLogin('Y-m-d'); } diff --git a/user_guide_src/source/database/results/015.php b/user_guide_src/source/database/results/015.php index 247d5d8b5313..31bc816a8472 100644 --- a/user_guide_src/source/database/results/015.php +++ b/user_guide_src/source/database/results/015.php @@ -6,5 +6,5 @@ if (isset($row)) { echo $row->email; // access attributes - echo $row->last_login('Y-m-d'); // access class methods + echo $row->lastLogin('Y-m-d'); // access class methods } From 745381c8393a3e41bcd3e97da2a75d533dfa8d2e Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Nov 2023 07:06:33 +0900 Subject: [PATCH 2/3] docs: add namespace to User class --- user_guide_src/source/database/results/003.php | 4 ++-- user_guide_src/source/database/results/007.php | 2 +- user_guide_src/source/database/results/013.php | 2 ++ user_guide_src/source/database/results/014.php | 2 +- user_guide_src/source/database/results/015.php | 2 +- user_guide_src/source/database/results/016.php | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/user_guide_src/source/database/results/003.php b/user_guide_src/source/database/results/003.php index da55c19717c1..d3fc78cc8d77 100644 --- a/user_guide_src/source/database/results/003.php +++ b/user_guide_src/source/database/results/003.php @@ -2,7 +2,7 @@ $query = $db->query('SELECT * FROM users;'); -foreach ($query->getResult('User') as $user) { - echo $user->name; // access attributes +foreach ($query->getResult(\App\Entities\User::class) as $user) { + echo $user->name; // access attributes echo $user->reverseName(); // or methods defined on the 'User' class } diff --git a/user_guide_src/source/database/results/007.php b/user_guide_src/source/database/results/007.php index 6a6c309efb4f..460857242adb 100644 --- a/user_guide_src/source/database/results/007.php +++ b/user_guide_src/source/database/results/007.php @@ -1,7 +1,7 @@ query('SELECT * FROM users LIMIT 1;'); -$row = $query->getRow(0, 'User'); +$row = $query->getRow(0, \App\Entities\User::class); echo $row->name; // access attributes echo $row->reverse_name(); // or methods defined on the 'User' class diff --git a/user_guide_src/source/database/results/013.php b/user_guide_src/source/database/results/013.php index bb476f84eb80..baef2cd97d99 100644 --- a/user_guide_src/source/database/results/013.php +++ b/user_guide_src/source/database/results/013.php @@ -1,5 +1,7 @@ query('YOUR QUERY'); -$rows = $query->getCustomResultObject('User'); +$rows = $query->getCustomResultObject(\App\Entities\User::class); foreach ($rows as $row) { echo $row->id; diff --git a/user_guide_src/source/database/results/015.php b/user_guide_src/source/database/results/015.php index 31bc816a8472..7fff4e037bf4 100644 --- a/user_guide_src/source/database/results/015.php +++ b/user_guide_src/source/database/results/015.php @@ -2,7 +2,7 @@ $query = $db->query('YOUR QUERY'); -$row = $query->getCustomRowObject(0, 'User'); +$row = $query->getCustomRowObject(0, \App\Entities\User::class); if (isset($row)) { echo $row->email; // access attributes diff --git a/user_guide_src/source/database/results/016.php b/user_guide_src/source/database/results/016.php index ed5ac68c4b1a..f6d0e2325ce6 100644 --- a/user_guide_src/source/database/results/016.php +++ b/user_guide_src/source/database/results/016.php @@ -1,3 +1,3 @@ getCustomRowObject(0, 'User'); +$row = $query->getCustomRowObject(0, \App\Entities\User::class); From 63fc2c04c9cfea49d13aa7b3de8fd95f5c4e204c Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 18 Nov 2023 07:06:54 +0900 Subject: [PATCH 3/3] docs: align comments --- user_guide_src/source/database/results/007.php | 2 +- user_guide_src/source/database/results/015.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/database/results/007.php b/user_guide_src/source/database/results/007.php index 460857242adb..ed1550836aab 100644 --- a/user_guide_src/source/database/results/007.php +++ b/user_guide_src/source/database/results/007.php @@ -3,5 +3,5 @@ $query = $db->query('SELECT * FROM users LIMIT 1;'); $row = $query->getRow(0, \App\Entities\User::class); -echo $row->name; // access attributes +echo $row->name; // access attributes echo $row->reverse_name(); // or methods defined on the 'User' class diff --git a/user_guide_src/source/database/results/015.php b/user_guide_src/source/database/results/015.php index 7fff4e037bf4..7cc9b7996e3b 100644 --- a/user_guide_src/source/database/results/015.php +++ b/user_guide_src/source/database/results/015.php @@ -5,6 +5,6 @@ $row = $query->getCustomRowObject(0, \App\Entities\User::class); if (isset($row)) { - echo $row->email; // access attributes + echo $row->email; // access attributes echo $row->lastLogin('Y-m-d'); // access class methods }