upgrade-checklist/Moving from J to Namespace.md

29 lines
982 B
Markdown
Raw Normal View History

2024-01-30 11:58:51 +00:00
## Class map in J3:
2024-01-30 11:47:03 +00:00
[https://github.com/joomla/joomla-cms/blob/3.10.12/libraries/classmap.php]
2024-01-30 11:58:51 +00:00
## Class map in J5:
2024-01-30 11:47:03 +00:00
[https://github.com/joomla/joomla-cms/blob/5.0-dev/plugins/behaviour/compat/src/classmap/classmap.php]
2024-01-30 11:58:51 +00:00
## How to handle Classes that have no new counterparts like:
2024-01-30 11:47:03 +00:00
2024-01-30 11:58:51 +00:00
### JError
- JError::raiseError() should be replaced with native exceptions.
- JError::raiseWarning() and JError::raiseNotice should be replaced with calls to application's enqueueMessage() method to display warnings/notices.
2024-01-30 11:47:03 +00:00
2024-01-30 11:58:51 +00:00
This would mean you wrap your code in a try catch block and return the error. Someting like this:
```
try {
// Your code here;
} catch (\RuntimeException $e) {
throw new \Exception($e->getMessage(), 500, $e);
}
```
Or you would manually report an error back like this:
```
throw new \Exception(Text::_('Your error message here'), 500);
```
## More info on backwards compatible issues:
2024-01-30 11:47:03 +00:00
[https://docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_4]