GithubHelp home page GithubHelp logo

somnambulist-tech / laravel-doctrine-entity-audit Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 0.0 118 KB

License: GNU Lesser General Public License v2.1

PHP 100.00%
auditing entity-auditing laravel laravel-doctrine simplethings simplethings-entityaudit

laravel-doctrine-entity-audit's Introduction

somnambulist-tech

Organization repository for discussions

laravel-doctrine-entity-audit's People

Contributors

dave-redfern avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-doctrine-entity-audit's Issues

Migrations:diff doesn't create any audit tables

Hi!

I was hoping you could help me with what I'm doing wrong. I followed the steps in the readme;

  • composer require somnambulist/laravel-doctrine-entity-audit
  • Added serviceprovider for laravel-doctrine-entity-audit after the one for Laravel Doctrine
  • ran php artisan vendor:publish
  • Added entities I wanted to track under entity_audit.entity_managers.default.entities
  • php artisan doctrine:migrations:diff

But here's where it goes wrong; The migration that has been generated contains no audit tables at all. Is there anything that I'm missing?

postFlush in LogRevisionsListener does not account for reserved SQL terms

Hi! It's me again. I have another thing I ran into. We have a Product table that has a nullable field called Default. Aaaand default happens to be a keyword in SQL too, so I believe it is failing on this.

An exception occurred while executing 'UPDATE revision_audit_Product SET default = ? WHERE rev = ? AND id = ?' with params [null, "26", redacted]:SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'default = NULL WHERE rev = '26' AND id = redacted' at line 1

This only happens with this specific tables. All revisions on all other tables are logged correctly.

Multiple issues with revision generation

Hi! Sorry to bother you with more questions/requests. We have run into 2 issues that are blocking us from making progress.

Custom timestamp class
We use a custom DateTime type and Entity, where the entity is an extension of the default DateTime class. When LDEA tries to execute the convertToDatabaseValue on the DateTime Type, it fails because the $value passed to the function is also a Type class, not a Doctrine Entity class and our Type class tries to run a method that is only available on the Entity class.

My question is; is it possible to pass the timestamp through the entity manager's config? For example;

[
    'entity_managers' => [
        'default' => [
            'entities' => [
                // Some/Entity/Classname::class,
                // Default sales entities
            ],
           //
           'timestamp' => new \Our\Custom\Entity\DateTime,
        ],
    ],
]

and to then have the LogRevisionsListener pick this up if it's set?

UserResolver user interfaces
In order to get the user's identifier, we need to implement one of four interfaces defined by the package;

  • UniversallyIdentifiable
  • Authenticatable
  • Identifiable
  • Nameable

Authenticatable is one of Laravel's default Contracts, but it asks me to implement additional method stubs that we will never be using.

UniversallyIdentifiable, Identifiable and Nameable come from the somnambulist/laravel-doctrine-behaviours package. This package is however outdated, and if my research is correct it is replaced by the somnambulist/domain package. Domain however is a package that would require us to upgrade to a later version of Laravel even at its earlier versions (We're stuck to ramsey/uuid 3.4 right now). Since we cannot upgrade until Laravel 9 LTS comes out, we're in a bit of a pickle. Is it possible for the config to allow us to either specify what identification method/function to use, OR what interface it needs to check for?

Doctrine types not always(?) passed correctly

Hi! Sorry to bug you again @dave-redfern.

We noticed that at some point, some types fall off and aren't sent correctly. My coworker noticed that when the following like is added under LogRevisionsListener.php:153

$types[] = $targetTable->getTypeOfColumn($definition['referencedColumnName']);

it's fixed. I don't have a direct example of this happening, but the $types array has only 2 variables where it should have been 3 on one of our entities, the third entity is null. This could possibly be the wrong solution, but I think it was worth noting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.