From ccb9874f63ff88a4d3a4f0b6f019ef3118aecdcb Mon Sep 17 00:00:00 2001 From: Alex <46262688+AlexRasch@users.noreply.github.com> Date: Sat, 21 Mar 2026 17:19:17 +0100 Subject: [PATCH 1/3] Fix: Update withAuthorInfo() to use plural table names The `BookModel::withAuthorInfo()` method in the Controller guide uses singular table names (book, author) instead of the plural names (books, authors) created in the Database Setup migration. Fixes #10057 --- user_guide_src/source/guides/api/code/013.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/guides/api/code/013.php b/user_guide_src/source/guides/api/code/013.php index d342cf4bfae9..9e8274d8a723 100644 --- a/user_guide_src/source/guides/api/code/013.php +++ b/user_guide_src/source/guides/api/code/013.php @@ -15,8 +15,8 @@ class BookModel extends Model */ public function withAuthorInfo() { - return $this - ->select('book.*, author.id as author_id, author.name as author_name') - ->join('author', 'book.author_id = author.id'); + return $this + ->select('books.*, authors.name as author_name') + ->join('authors', 'books.author_id = authors.id'); } } From 4a06ebd2a781e35720e0105b01a5b3dfee310408 Mon Sep 17 00:00:00 2001 From: John Paul E Balandan Date: Sun, 22 Mar 2026 20:28:26 +0800 Subject: [PATCH 2/3] Update user_guide_src/source/guides/api/code/013.php --- user_guide_src/source/guides/api/code/013.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/guides/api/code/013.php b/user_guide_src/source/guides/api/code/013.php index 9e8274d8a723..27788c397982 100644 --- a/user_guide_src/source/guides/api/code/013.php +++ b/user_guide_src/source/guides/api/code/013.php @@ -15,7 +15,7 @@ class BookModel extends Model */ public function withAuthorInfo() { - return $this + return $this ->select('books.*, authors.name as author_name') ->join('authors', 'books.author_id = authors.id'); } From 33ce874f0d0dc3f863b82b60f2ea48eb3c060498 Mon Sep 17 00:00:00 2001 From: John Paul E Balandan Date: Sun, 22 Mar 2026 20:30:28 +0800 Subject: [PATCH 3/3] Fix syntax error in withAuthorInfo method --- user_guide_src/source/guides/api/code/013.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/guides/api/code/013.php b/user_guide_src/source/guides/api/code/013.php index 27788c397982..4ae1102385ba 100644 --- a/user_guide_src/source/guides/api/code/013.php +++ b/user_guide_src/source/guides/api/code/013.php @@ -15,7 +15,7 @@ class BookModel extends Model */ public function withAuthorInfo() { - return $this + return $this ->select('books.*, authors.name as author_name') ->join('authors', 'books.author_id = authors.id'); }