Skip to content

Fix unnecessary revision creation when only a column from the globalIgnoreColumns list is updated - #675

Merged
VincentLanglet merged 1 commit into
sonata-project:1.xfrom
valkars:hotfix/ignore-columns
Mar 24, 2026
Merged

Fix unnecessary revision creation when only a column from the globalIgnoreColumns list is updated#675
VincentLanglet merged 1 commit into
sonata-project:1.xfrom
valkars:hotfix/ignore-columns

Conversation

@valkars

@valkars valkars commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Subject

When only a column from the globalIgnoreColumns list is updated, a new revision is incorrectly created, and an update is attempted on a non-existent record in the audit table.

Example: last_login and updated_at are in globalIgnoreColumns, and the following SQL is executed:

UPDATE user SET last_login = ?, updated_at = ? WHERE id = ? (parameters: array{"1":"2026-03-24 14:14:40","2":"2026-03-24 14:14:40","3":4}, types: array{"1":0,"2":0,"3":0})
INSERT INTO revision (timestamp, username) VALUES (?, ?) (parameters: array{"1":"2026-03-24 14:14:40","2":""}, types: array{"1":0,"2":0}) 
UPDATE user_audit SET last_login = ?, updated_at = ? WHERE rev = ? AND id = ? (parameters: array{"1":"2026-03-24 14:14:40","2":"2026-03-24 14:14:40","3":"368","4":4}, types: array{"1":0,"2":0,"3":0,"4":0})

I added a check for globalIgnoreColumns, and now no new revision is created and no update is executed.

I am targeting this branch, because this fix is backwards compatible.

Changelog

### Fixed
Fix unnecessary revision creation when only a column from the globalIgnoreColumns list is updated

@valkars

valkars commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

@VincentLanglet When you have some time, could you please take a look?

VincentLanglet
VincentLanglet previously approved these changes Mar 24, 2026
@VincentLanglet

Copy link
Copy Markdown
Member

(Triggering the CI)

@valkars
valkars force-pushed the hotfix/ignore-columns branch 2 times, most recently from 902b4e9 to 04b6cc5 Compare March 24, 2026 15:16
@valkars
valkars force-pushed the hotfix/ignore-columns branch from 04b6cc5 to 0b9349f Compare March 24, 2026 15:19
@valkars

valkars commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

I have fixed all issues except false error by rector

final class IssueGlobalIgnoreColumns extends BaseTestCase
 {
+    public function __construct()
+    {
+        parent::__construct(self::class);
+    }
     protected $schemaEntities = [
         IssueGlobalIgnoreColumnsEntity::class,
     ];
    ----------- end diff -----------

Applied rules:
 * ParentTestClassConstructorRector
 * StaticToSelfOnFinalClassRector

Don't know how to deal with it

@VincentLanglet
VincentLanglet merged commit d7090b8 into sonata-project:1.x Mar 24, 2026
21 of 22 checks passed
@VincentLanglet

Copy link
Copy Markdown
Member

Thanks

@valkars
valkars deleted the hotfix/ignore-columns branch March 24, 2026 15:28
@VincentLanglet

Copy link
Copy Markdown
Member

@valkars the issue was #676

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants