Replies: 6 comments
-
The solution seems (to me) to be
I found this by tracing to the getDbo() method of the Factory and seeing, after the deprecation method, what it does. |
Beta Was this translation helpful? Give feedback.
-
hi, |
Beta Was this translation helpful? Give feedback.
-
Hello, It seems there are removing static call, since Joomla! 4.2 you can use in some place : |
Beta Was this translation helpful? Give feedback.
-
hi, |
Beta Was this translation helpful? Give feedback.
-
hi, Joomla V4 is now out for quite a while and still there is are no infos about usage (e.g. of methods like "getDatabase()" or "getContainer()->get('DatabaseDriver');"). It is a bit frustrating that even samples of tutorials for joomla V4 still show and suggest the deprecated "getDbo()" method. Would be nice to read at least here what's going on... |
Beta Was this translation helpful? Give feedback.
-
The deprecation notice says "Load the database service from the dependency injection container" and looking at Joomla 4.2.3 code the standard way seems to be:
However, a number of the Joomla classes use the
If you're developing a component using the standard Joomla MVC approach then you can use this approach within your model because in
However if you're developing module or plugin code then it doesn't set this up for you so have to use the first approach. All that said, I totally agree with the sentiments regarding the lack of explanatory documentation :-(. |
Beta Was this translation helpful? Give feedback.
-
A well documented and widely used method (my systems shows more than 400 hits of it) to create a joomla database object is Factory::getDbo() .
With joomla 4 and (3.10?) this method is indicated as deprecated. I tried to find a well documented replacement but did not find any hints for it in the current joomla docs nor could i see any reasonable cause - besides not(?) to use statically functions to create db objects. Can anybody comment on this problem?
Beta Was this translation helpful? Give feedback.
All reactions