Home > Backend Development > PHP Tutorial > Preparing extensions for Joomla CMSObject -> stdClass.

Preparing extensions for Joomla CMSObject -> stdClass.

Barbara Streisand
Release: 2024-12-26 01:15:15
Original
739 people have browsed it

Preparing extensions for Joomla CMSObject -> stdClass. 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');
Copy after login

How it will be in Joomla 6

$article = $app->bootComponent('content')->getMVCFactory()->createModel('Article', 'Administrator')->getItem(1);
echo $article->title;
Copy after login

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

PR on Joomla GitHub

Joomla Community resources

  • https://joomla.org/
  • Joomla Community chat in Mattermost
  • WebTolk Joomla extensions

The above is the detailed content of Preparing extensions for Joomla CMSObject -> stdClass.. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template