From 4ec5bd83351b1062106eab9d2868e7b88f05f058 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Fri, 31 Jan 2025 18:34:16 +0100 Subject: [PATCH] Adding switch from Table::getInstance to explicit class invocation --- .../54-60/removed-backward-incompatibility.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/migrations/54-60/removed-backward-incompatibility.md b/migrations/54-60/removed-backward-incompatibility.md index 2ba07dd7..51ba959b 100644 --- a/migrations/54-60/removed-backward-incompatibility.md +++ b/migrations/54-60/removed-backward-incompatibility.md @@ -116,3 +116,17 @@ $image->createThumbs('50x50'); $image = new Image($path); $image->createThumbnails('50x50'); ``` + + +### Table objects are instantiated directly instead of via Table::getInstance() + +- PR: https://github.com/joomla/joomla-cms/pull/44090 +- Description: `Table` objects in the core code have been instantiated with `Table::getInstance()` in the past. Starting with Joomla 6.0, you should use the explicit table class directly instead. After this change it is not possible to override the table class by calling `Table::addIncludePath()` anymore. At the same time it simplifies code handling a lot and especially allows IDEs to properly understand the code properly. + +```php +// Old: +$table = Table::getInstance('content'); + +// New: +$table = new \Joomla\CMS\Table\Content($db); +```