Conversation
libraries/fof/model/model.php
Outdated
| @@ -716,7 +716,7 @@ public function __construct($config = array()) | |||
|
|
|||
| if (method_exists($app, 'getCfg')) | |||
There was a problem hiding this comment.
Should we change this, too? Or shall we leave it as it is since that method still exists, it's just deprecated?
There was a problem hiding this comment.
But I'm not sure if an if (method_exists($app, 'get')) really makes sense.
There was a problem hiding this comment.
If all possible kinds of applications ($app) have a get method, we can replace the complete if then else here with this one line:
$default_limit = $app->get('list_limit', 20);
If not and we have to keep the method_exists, we should change that to method_exists($app, 'get'), and also in this case we should use a default of 20 for the get call.
There was a problem hiding this comment.
@Fedik What do you think? Do we need an if (method_exists($app, 'get'))?
There was a problem hiding this comment.
does not need, because every joomla application extends Joomla\Application\AbstractApplication that have get()/set() method
There was a problem hiding this comment.
Seems I'm wrong with my suggestion to use $app->get('list_limit', 20), see reaction on my suggestion below. So forget that.
There was a problem hiding this comment.
The suggestion is good, but it need to replace whole if/else section, not just 1 line 😉
There was a problem hiding this comment.
Yes that’s what I had in mind, so I tried to describe it here. Because there was already this code review comment, GitHub did not allow me to add another suggestion here. I‘d have to close this one here before, and then the discussion would be hidden, that’s why I asked first.
There was a problem hiding this comment.
Hmm, I still can't make a code suggestion to replace that if then else, because the end of the else is too far away from code changed by this PR, so I can't mark the code for suggestion so far down.
I think the complete
$app = JFactory::getApplication();
if (method_exists($app, 'getCfg'))
{
$default_limit = $app->get('list_limit');
}
else
{
$default_limit = 20;
}
can be replaced by
$default_limit = JFactory::getApplication()->get('list_limit', 20);
|
I have tested this item ✅ successfully on 67c09b2 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32356. |
…se-mod-1 Simplify code since every Joomla app has a get method
|
I have tested this item ✅ successfully on 9b6eabc This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32356. |
|
I have tested this item ✅ successfully on 9b6eabc This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32356. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32356. |
Summary of Changes
Remove deprecated isAdmin and getCfg calls in core
Testing Instructions
actions logs should work as before