DEV Community

Cover image for Preparing extensions for Joomla 6. CMSObject -> stdClass.
Sergey Tolkachyov
Sergey Tolkachyov

Posted on • Edited on

Preparing extensions for Joomla 6. CMSObject -> stdClass.

In Joomla 6, the getItem() method in Adminmodel will return \stdClass instead of CMSObject. This means that all deprecated functions of this class will be unavailable. Developers in Joomla 6 should work directly with the properties of the item object and not use the outdated set() and get() methods.

Old Joomla way

$article = $app->bootComponent('content')->getMVCFactory()->createModel('Article', 'Administrator')->getItem(1);
echo $article->get('title');
Enter fullscreen mode Exit fullscreen mode

How it will be in Joomla 6

$article = $app->bootComponent('content')->getMVCFactory()->createModel('Article', 'Administrator')->getItem(1);
echo $article->title;
Enter fullscreen mode Exit fullscreen mode

The corresponding Pull Request has already been accepted into the Joomla 6 branch.

PR on Joomla GitHub

Joomla Community resources

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay