Clean up Tag::resetIdAsset
This commit is contained in:
parent
aa3a54f237
commit
1b7e745f11
@ -313,8 +313,7 @@ class Tag
|
||||
public function resetIdAsset()
|
||||
{
|
||||
$db = Registry::get('db');
|
||||
|
||||
$row = $db->query('
|
||||
$new_id = $db->queryValue('
|
||||
SELECT MAX(id_asset) as new_id
|
||||
FROM assets_tags
|
||||
WHERE id_tag = {int:id_tag}',
|
||||
@ -322,18 +321,12 @@ class Tag
|
||||
'id_tag' => $this->id_tag,
|
||||
]);
|
||||
|
||||
$new_id = 0;
|
||||
if(!empty($row))
|
||||
{
|
||||
$new_id = $row->fetch_assoc()['new_id'];
|
||||
}
|
||||
|
||||
return $db->query('
|
||||
UPDATE tags
|
||||
SET id_asset_thumb = {int:new_id}
|
||||
WHERE id_tag = {int:id_tag}',
|
||||
[
|
||||
'new_id' => $new_id,
|
||||
'new_id' => $new_id ?? 0,
|
||||
'id_tag' => $this->id_tag,
|
||||
]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user