sonata-project / EntityAuditBundle

Audit for Doctrine Entities
https://sonata-project.org
MIT License
633 stars 261 forks source link

Ignore fields option not working #516

Closed byhaskell closed 1 year ago

byhaskell commented 2 years ago

Environment

Sonata packages

show

``` Color legend: - patch or minor release available - update recommended - major release available - update possible - up to date version sonata-project/admin-bundle 4.18.0 4.18.0 The missing Symfony Admin Generator sonata-project/block-bundle 4.17.0 4.17.0 Symfony SonataBlockBundle sonata-project/cache 2.2.0 2.2.0 Cache library Package sonata-project/cache is abandoned, you should avoid using it. No replacement was suggested. sonata-project/doctrine-extensions 2.0.1 2.0.1 Doctrine2 behavioral extensions sonata-project/doctrine-orm-admin-bundle 4.7.0 4.7.0 Integrate Doctrine ORM into the SonataAdminBundle sonata-project/entity-audit-bundle 1.8.0 1.8.0 Audit for Doctrine Entities sonata-project/exporter 3.0.0 3.0.0 Lightweight Exporter library sonata-project/form-extensions 1.18.0 1.18.0 Symfony form extensions sonata-project/intl-bundle 2.14.0 3.0.0 Symfony SonataIntlBundle sonata-project/media-bundle 4.5.1 4.5.1 Symfony SonataMediaBundle sonata-project/translation-bundle 3.1.0 3.1.0 SonataTranslationBundle sonata-project/twig-extensions 2.0.0 2.0.0 Sonata twig extensions ```

Symfony packages

show

``` Color legend: - patch or minor release available - update recommended - major release available - update possible - up to date version symfony/amqp-messenger v5.4.11 v6.1.3 Symfony AMQP extension Messenger Bridge symfony/asset v5.4.7 v6.1.0 Manages URL generation and versioning of web assets ... symfony/browser-kit v5.4.11 v6.1.3 Simulates the behavior of a web browser, allowing yo... symfony/cache v5.4.11 v6.1.3 Provides an extended PSR-6, PSR-16 (and tags) implem... symfony/cache-contracts v2.5.2 v3.1.1 Generic abstractions related to caching symfony/config v5.4.11 v6.1.3 Helps you find, load, combine, autofill and validate... symfony/console v5.4.12 v6.1.4 Eases the creation of beautiful and testable command... symfony/css-selector v5.4.11 v6.1.3 Converts CSS selectors to XPath expressions symfony/debug-bundle v5.4.11 v6.1.3 Provides a tight integration of the Symfony VarDumpe... symfony/dependency-injection v5.4.11 v6.1.3 Allows you to standardize and centralize the way obj... symfony/deprecation-contracts v3.1.1 v3.1.1 A generic function and convention to trigger depreca... symfony/doctrine-bridge v5.4.11 v6.1.3 Provides integration for Doctrine with various Symfo... symfony/doctrine-messenger v5.4.12 v6.1.4 Symfony Doctrine Messenger Bridge symfony/dom-crawler v5.4.12 v6.1.4 Eases DOM navigation for HTML and XML documents symfony/dotenv v5.4.5 v6.1.0 Registers environment variables from a .env file symfony/error-handler v5.4.11 v6.1.3 Provides tools to manage errors and ease debugging P... symfony/event-dispatcher v5.4.9 v6.1.0 Provides tools that allow your application component... symfony/event-dispatcher-contracts v3.1.1 v3.1.1 Generic abstractions related to dispatching event symfony/expression-language v5.4.11 v6.1.3 Provides an engine that can compile and evaluate exp... symfony/filesystem v5.4.12 v6.1.4 Provides basic utilities for the filesystem symfony/finder v5.4.11 v6.1.3 Finds files and directories via an intuitive fluent ... symfony/flex v2.2.3 v2.2.3 Composer plugin for Symfony symfony/form v5.4.12 v6.1.4 Allows to easily create, process and reuse HTML forms symfony/framework-bundle v5.4.12 v6.1.4 Provides a tight integration between Symfony compone... symfony/http-client v5.4.12 v6.1.4 Provides powerful methods to fetch HTTP resources sy... symfony/http-client-contracts v2.5.2 v3.1.1 Generic abstractions related to HTTP clients symfony/http-foundation v5.4.12 v6.1.4 Defines an object-oriented layer for the HTTP specif... symfony/http-kernel v5.4.12 v6.1.4 Provides a structured process for converting a Reque... symfony/intl v5.4.11 v6.1.0 Provides a PHP replacement layer for the C intl exte... symfony/lock v5.4.10 v6.1.3 Creates and manages locks, a mechanism to provide ex... symfony/mailer v5.4.12 v6.1.4 Helps sending emails symfony/maker-bundle v1.45.0 v1.46.0 Symfony Maker helps you create empty commands, contr... symfony/messenger v5.4.11 v6.1.3 Helps applications send and receive messages to/from... symfony/mime v5.4.12 v6.1.4 Allows manipulating MIME messages symfony/monolog-bridge v5.4.10 v6.1.2 Provides integration for Monolog with various Symfon... symfony/monolog-bundle v3.8.0 v3.8.0 Symfony MonologBundle symfony/notifier v5.4.8 v6.1.0 Sends notifications via one or more channels (email,... symfony/options-resolver v5.4.11 v6.1.0 Provides an improved replacement for the array_repla... symfony/password-hasher v5.4.11 v6.1.3 Provides password hashing utilities symfony/phpunit-bridge v6.1.3 v6.1.3 Provides utilities for PHPUnit, especially user depr... symfony/polyfill-intl-grapheme v1.26.0 v1.26.0 Symfony polyfill for intl's grapheme_* functions symfony/polyfill-intl-icu v1.26.0 v1.26.0 Symfony polyfill for intl's ICU-related data and cla... symfony/polyfill-intl-idn v1.26.0 v1.26.0 Symfony polyfill for intl's idn_to_ascii and idn_to_... symfony/polyfill-intl-normalizer v1.26.0 v1.26.0 Symfony polyfill for intl's Normalizer class and rel... symfony/polyfill-mbstring v1.26.0 v1.26.0 Symfony polyfill for the Mbstring extension symfony/polyfill-php73 v1.26.0 v1.26.0 Symfony polyfill backporting some PHP 7.3+ features ... symfony/polyfill-php80 v1.26.0 v1.26.0 Symfony polyfill backporting some PHP 8.0+ features ... symfony/polyfill-php81 v1.26.0 v1.26.0 Symfony polyfill backporting some PHP 8.1+ features ... symfony/process v5.4.11 v6.1.3 Executes commands in sub-processes symfony/property-access v5.4.11 v6.1.3 Provides functions to read and write from/to an obje... symfony/property-info v5.4.11 v6.1.3 Extracts information about PHP class' properties usi... symfony/proxy-manager-bridge v5.4.6 v6.1.0 Provides integration for ProxyManager with various S... symfony/rate-limiter v5.4.11 v6.1.3 Provides a Token Bucket implementation to rate limit... symfony/redis-messenger v5.4.6 v6.1.3 Symfony Redis extension Messenger Bridge symfony/routing v5.4.11 v6.1.3 Maps an HTTP request to a set of configuration varia... symfony/runtime v5.4.11 v6.1.3 Enables decoupling PHP applications from global state symfony/security-acl v3.3.2 v3.3.2 Symfony Security Component - ACL (Access Control List) symfony/security-bundle v5.4.11 v6.1.3 Provides a tight integration of the Security compone... symfony/security-core v5.4.11 v6.1.4 Symfony Security Component - Core Library symfony/security-csrf v5.4.11 v6.1.0 Symfony Security Component - CSRF Library symfony/security-guard v5.4.9 v5.4.9 Symfony Security Component - Guard symfony/security-http v5.4.12 v6.1.4 Symfony Security Component - HTTP Integration symfony/serializer v5.4.12 v6.1.4 Handles serializing and deserializing data structure... symfony/service-contracts v2.5.2 v3.1.1 Generic abstractions related to writing services symfony/stopwatch v5.4.5 v6.1.0 Provides a way to profile code symfony/string v5.4.12 v6.1.4 Provides an object-oriented API to strings and deals... symfony/translation v5.4.12 v6.1.4 Provides tools to internationalize your application symfony/translation-contracts v2.5.2 v3.1.1 Generic abstractions related to translation symfony/twig-bridge v5.4.12 v6.1.4 Provides integration for Twig with various Symfony c... symfony/twig-bundle v5.4.8 v6.1.1 Provides a tight integration of Twig into the Symfon... symfony/validator v5.4.12 v6.1.4 Provides tools to validate values symfony/var-dumper v5.4.11 v6.1.3 Provides mechanisms for walking through any arbitrar... symfony/var-exporter v5.4.10 v6.1.3 Allows exporting any serializable PHP data structure... symfony/web-link v5.4.3 v6.1.0 Manages links between resources symfony/web-profiler-bundle v5.4.10 v6.1.2 Provides a development tool that gives detailed info... symfony/yaml v5.4.12 v6.1.4 Loads and dumps YAML files ```

PHP version

PHP 8.1.5 (cli) (built: Apr 12 2022 17:38:57) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.5, Copyright (c) Zend Technologies

Subject

Ignore fields option not working

Steps to reproduce

It is enough to create a regular entity with created_at and updated_at fields and ignore using options:

    global_ignore_columns:
        - created_at
        - updated_at

Expected results

The data is saved anyway, while the table was generated earlier without exceptions. Migrations also show no changes (deleting fields from the audit table).

Actual results

It is necessary that the setting to ignore fields would work. At what you try the name of the field and the name of the field in the database - nothing works

MartinCigarsky commented 2 years ago

Can I work on this?

byhaskell commented 2 years ago

@MartinCigarsky yes, the issue is still there.

MartinCigarsky commented 2 years ago

Sorry for late response, but I wasn't able to encounter this bug. More stated in PR.

byhaskell commented 2 years ago

@MartinCigarsky Thanks, perhaps the problem is that the audit of the entire table initially started, then set up ignoring and then the fields do not disappear for the audit? I'll try to revise the settings and update the package, maybe it will help, in any case, thanks for the responsiveness and help.

kowalk commented 1 year ago

@MartinCigarsky how to ignore a single column in a specified entity?

idmarinas commented 1 year ago

Hi:

I have tried reproducing this, and realised that you should use the name of the field in the entity and not the name of the field in the database. I have tested and by putting the field name as it is in the createdAt entity and not created_at as it is in the database, it works correctly.

Maybe this will help.

byhaskell commented 1 year ago

@idmarinas Greetings. Tried of course. Now I was setting up this package for a new project and there is the same problem. Initially, I forgot to ignore the field, the audit table was updated ... after that I ignore the field, check the migration - the field is not deleted, but in fact it should.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.