diff --git a/psalm_autoload.php b/psalm_autoload.php index 83e406972d4a..b973cc88bc7d 100644 --- a/psalm_autoload.php +++ b/psalm_autoload.php @@ -26,6 +26,7 @@ $dirs = [ 'tests/_support/Controllers', 'tests/_support/_controller', + 'tests/system/Config/fixtures', ]; foreach ($dirs as $dir) { diff --git a/user_guide_src/source/database/events.rst b/user_guide_src/source/database/events.rst index 08fe73b09081..8cefcad22dbf 100644 --- a/user_guide_src/source/database/events.rst +++ b/user_guide_src/source/database/events.rst @@ -21,6 +21,8 @@ DBQuery This event is triggered whenever a new query has been run, whether successful or not. The only parameter is a :doc:`Query ` instance of the current query. You could use this to display all queries in STDOUT, or logging to a file, or even creating tools to do automatic query analysis to help you spot -potentially missing indexes, slow queries, etc. An example usage might be: +potentially missing indexes, slow queries, etc. + +An example usage might be: .. literalinclude:: events/001.php diff --git a/user_guide_src/source/database/events/001.php b/user_guide_src/source/database/events/001.php index 4461b715af19..ed2bb1fcec43 100644 --- a/user_guide_src/source/database/events/001.php +++ b/user_guide_src/source/database/events/001.php @@ -1,4 +1,18 @@ 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..ed1550836aab 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->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 d0b1e445f01f..baef2cd97d99 100644 --- a/user_guide_src/source/database/results/013.php +++ b/user_guide_src/source/database/results/013.php @@ -1,12 +1,14 @@ query('YOUR QUERY'); -$rows = $query->getCustomResultObject('User'); +$rows = $query->getCustomResultObject(\App\Entities\User::class); 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..7cc9b7996e3b 100644 --- a/user_guide_src/source/database/results/015.php +++ b/user_guide_src/source/database/results/015.php @@ -2,9 +2,9 @@ $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 - echo $row->last_login('Y-m-d'); // access class methods + echo $row->email; // access attributes + echo $row->lastLogin('Y-m-d'); // access class methods } 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);