Skip to content

Commit e5b633e

Browse files
authored
[5.2] Remove get()/set() calls to table classes (joomla#43508)
* Remove get()/set() calls to table classes * Codestyle * Fixing issue
1 parent 89f1292 commit e5b633e

File tree

25 files changed

+207
-204
lines changed

25 files changed

+207
-204
lines changed

administrator/components/com_categories/src/Model/CategoryModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ protected function batchCopy($value, $pks, $contexts)
10261026
}
10271027

10281028
// Get the new item ID
1029-
$newId = $this->table->get('id');
1029+
$newId = $this->table->id;
10301030

10311031
// Add the new ID to the array
10321032
$newIds[$pk] = $newId;

administrator/components/com_fields/src/Model/FieldModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ protected function batchCopy($value, $pks, $contexts)
11921192
}
11931193

11941194
// Get the new item ID
1195-
$newId = $table->get('id');
1195+
$newId = $table->id;
11961196

11971197
// Add the new ID to the array
11981198
$newIds[$pk] = $newId;

administrator/components/com_installer/src/Model/DatabaseModel.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -579,15 +579,15 @@ public function fixUpdateVersion($extensionId)
579579
$cache = new Registry($table->manifest_cache);
580580
$updateVersion = $cache->get('version');
581581

582-
if ($table->get('type') === 'file' && $table->get('element') === 'joomla') {
582+
if ($table->type === 'file' && $table->element === 'joomla') {
583583
$extensionVersion = new Version();
584584
$extensionVersion = $extensionVersion->getShortVersion();
585585
} else {
586586
$installationXML = InstallerHelper::getInstallationXML(
587-
$table->get('element'),
588-
$table->get('type'),
589-
$table->get('client_id'),
590-
$table->get('type') === 'plugin' ? $table->get('folder') : null
587+
$table->element,
588+
$table->type,
589+
$table->client_id,
590+
$table->type === 'plugin' ? $table->folder : null
591591
);
592592
$extensionVersion = (string) $installationXML->version;
593593
}
@@ -597,7 +597,7 @@ public function fixUpdateVersion($extensionId)
597597
}
598598

599599
$cache->set('version', $extensionVersion);
600-
$table->set('manifest_cache', $cache->toString());
600+
$table->manifest_cache = $cache->toString();
601601

602602
if ($table->store()) {
603603
return $extensionVersion;

administrator/components/com_joomlaupdate/src/Model/UpdateModel.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ public function finaliseUpgrade()
745745
$row->load($id);
746746

747747
// Update name.
748-
$row->set('name', 'files_joomla');
748+
$row->name = 'files_joomla';
749749

750750
// Update manifest.
751751
$row->manifest_cache = $installer->generateManifestCache();
@@ -761,18 +761,18 @@ public function finaliseUpgrade()
761761
}
762762
} else {
763763
// Add an entry to the extension table with a whole heap of defaults.
764-
$row->set('name', 'files_joomla');
765-
$row->set('type', 'file');
766-
$row->set('element', 'joomla');
764+
$row->name = 'files_joomla';
765+
$row->type = 'file';
766+
$row->element = 'joomla';
767767

768768
// There is no folder for files so leave it blank.
769-
$row->set('folder', '');
770-
$row->set('enabled', 1);
771-
$row->set('protected', 0);
772-
$row->set('access', 0);
773-
$row->set('client_id', 0);
774-
$row->set('params', '');
775-
$row->set('manifest_cache', $installer->generateManifestCache());
769+
$row->folder = '';
770+
$row->enabled = 1;
771+
$row->protected = 0;
772+
$row->access = 0;
773+
$row->client_id = 0;
774+
$row->params = '';
775+
$row->manifest_cache = $installer->generateManifestCache();
776776

777777
if (!$row->store()) {
778778
$this->collectError('Write the manifest_cache', new \Exception('Writing the manifest_cache finished with "false" result.'));
@@ -783,7 +783,7 @@ public function finaliseUpgrade()
783783
}
784784

785785
// Set the insert id.
786-
$row->set('extension_id', $db->insertid());
786+
$row->extension_id = $db->insertid();
787787

788788
// Since we have created a module item, we add it to the installation step stack
789789
// so that if we have to rollback the changes we can undo it.

administrator/components/com_menus/src/Helper/MenusHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ protected static function installPresetItems($node, $menutype)
550550
throw new \Exception($table->getError());
551551
}
552552

553-
$item->id = $table->get('id');
553+
$item->id = $table->id;
554554

555555
if ($item->hasChildren()) {
556556
static::installPresetItems($item, $menutype);

administrator/components/com_menus/src/Model/ItemModel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ protected function batchCopy($value, $pks, $contexts)
297297
}
298298

299299
// Get the new item ID
300-
$newId = $table->get('id');
300+
$newId = $table->id;
301301

302302
// Add the new ID to the array
303303
$newIds[$pk] = $newId;
@@ -974,7 +974,7 @@ protected function populateState()
974974
if ($pk) {
975975
$table = $this->getTable();
976976
$table->load($pk);
977-
$forcedClientId = $table->get('client_id', $forcedClientId);
977+
$forcedClientId = isset($table->client_id) ? $table->client_id : $forcedClientId;
978978
}
979979

980980
if (isset($forcedClientId) && $forcedClientId != $clientId) {
@@ -1454,7 +1454,7 @@ public function save($data)
14541454
$this->setState('item.menutype', $table->menutype);
14551455

14561456
// Load associated menu items, for now not supported for admin menu… may be later
1457-
if ($table->get('client_id') == 0 && Associations::isEnabled()) {
1457+
if ($table->client_id == 0 && Associations::isEnabled()) {
14581458
// Adding self to the association
14591459
$associations = $data['associations'] ?? [];
14601460

administrator/components/com_modules/src/Model/ModuleModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ protected function batchCopy($value, $pks, $contexts)
191191
}
192192

193193
// Get the new item ID
194-
$newId = $table->get('id');
194+
$newId = $table->id;
195195

196196
// Add the new ID to the array
197197
$newIds[$pk] = $newId;

administrator/components/com_scheduler/src/Model/TaskModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ public function unlock(array &$pks): bool
699699
// Prune items that are already at the given state.
700700
$lockedColumnName = $table->getColumnAlias('locked');
701701

702-
if (property_exists($table, $lockedColumnName) && \is_null($table->get($lockedColumnName))) {
702+
if (property_exists($table, $lockedColumnName) && \is_null($table->$lockedColumnName)) {
703703
unset($pks[$i]);
704704
}
705705
}

administrator/components/com_workflow/src/Model/WorkflowModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ public function setDefault($pk, $value = 1)
292292
$table->load(
293293
[
294294
'default' => '1',
295-
'extension' => $table->get('extension'),
295+
'extension' => $table->extension,
296296
]
297297
)
298298
) {

administrator/modules/mod_menu/src/Menu/CssMenu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ protected function check($node, Registry $params)
236236

237237
$table->load(['menutype' => $menutype]);
238238

239-
$menutype = $table->get('title', $menutype);
239+
$menutype = isset($table->title) ? $table->title : $menutype;
240240
$message = Text::sprintf('MOD_MENU_IMPORTANT_ITEMS_INACCESSIBLE_LIST_WARNING', $menutype, implode(', ', $missing), $uri);
241241

242242
$this->application->enqueueMessage($message, 'warning');

0 commit comments

Comments
 (0)