Giter Club home page Giter Club logo

Comments (13)

andrewtch avatar andrewtch commented on June 4, 2024

Hi,

can you give your example entity? Thanks!

from entityauditbundle.

arlin2050 avatar arlin2050 commented on June 4, 2024

Here is the mapping :

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"
        xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping" >
    <entity name="Oru\Bundle\CustomBundle\Entity\Demande" table="oru_custom_demande" repository-class="Oru\Bundle\CustomBundle\Entity\DemandeRepository" >
        <id name="id" type="integer" column="id">
            <generator strategy="AUTO"/>
        </id>
        <field name="statut" type="string" length="20" nullable="true" />
        <field name="deletedAt" column="deleted_at" type="datetime" nullable="true" />
        <gedmo:soft-deleteable field-name="deletedAt" />
    </entity>
</doctrine-mapping>

And the EntityAudit configuration :

simple_things_entity_audit:
    audited_entities:
        - Oru\Bundle\CustomBundle\Entity\Demande

The php class for this entity is auto-generated via doctrine :

namespace Oru\Bundle\CustomBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

class Custom {

    /**
     * @var integer
     */
    private $id;

     /**
     * @var string
     */
    protected $statut;

    /**
     * @var \DateTime
     */
    private $deletedAt;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param string $statut
     */
    public function setStatut($statut)
    {
        $this->statut = $statut;
    }

    /**
     * @return string
     */
    public function getStatut()
    {
        return $this->statut;
    }

    /**
     * Set deletedAt
     *
     * @param \DateTime $deletedAt
     * @return Demande
     */
    public function setDeletedAt($deletedAt)
    {
        $this->deletedAt = $deletedAt;

        return $this;
    }

    /**
     * Get deletedAt
     *
     * @return \DateTime 
     */
    public function getDeletedAt()
    {
        return $this->deletedAt;
    }
}

Thanks !

from entityauditbundle.

andrewtch avatar andrewtch commented on June 4, 2024

@arlin2050 , as you can see in #113, everything works fine (however your use case allowed to find at least one bug).

It seems I can not repeat your issue. Can you update doctrine / EA to latest versions and check again? Can you provide a test that 100% repeats the issue?

Thanks!

from entityauditbundle.

arlin2050 avatar arlin2050 commented on June 4, 2024

Thanks for the reply. I'll try to update doctrine and check again.

from entityauditbundle.

andrewtch avatar andrewtch commented on June 4, 2024

@arlin2050 , what's the status on this? )

from entityauditbundle.

arlin2050 avatar arlin2050 commented on June 4, 2024

Hi,

My doctrine/orm version is v2.3.6. It's the latest possible version of doctrine for my installation which depends on Symfony 2.3 LTS.
EntityAudit version is up to date with dev-master.

Lauching unit tests, I've got two errors :

  1. SimpleThings\EntityAudit\Tests\IssueTest::testIssue111
    ReflectionException: Method prepareUpdateData does not exist

vendor/simplethings/entity-audit-bundle/src/SimpleThings/EntityAudit/EventListener/LogRevisionsListener.php:114
vendor/doctrine/common/lib/Doctrine/Common/EventManager.php:59
vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:364
vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:355
vendor/simplethings/entity-audit-bundle/tests/SimpleThings/Tests/EntityAudit/IssueTest.php:75

  1. SimpleThings\EntityAudit\Tests\IssueTest::testIssue9
    ReflectionException: Method prepareUpdateData does not exist

vendor/simplethings/entity-audit-bundle/src/SimpleThings/EntityAudit/EventListener/LogRevisionsListener.php:114
vendor/doctrine/common/lib/Doctrine/Common/EventManager.php:59
vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:364
vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:355
vendor/simplethings/entity-audit-bundle/tests/SimpleThings/Tests/EntityAudit/IssueTest.php:146

Thanks

from entityauditbundle.

andrewtch avatar andrewtch commented on June 4, 2024

Ok, please see #115, this should fix the issue.

from entityauditbundle.

arlin2050 avatar arlin2050 commented on June 4, 2024

Applying the three commits available in #115, I've got this error :

FatalErrorException: Error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]]) in vendor/simplethings/entity-audit-bundle/src/SimpleThings/EntityAudit/EventListener/LogRevisionsListener.php line 160

Real exception is :

Could not resolve database type for column "deleted_at" during extra updates

I've got this error because I use the property name on a column, and my column deletedAt in database is not camel case but 'deleted_at'. Maybe another issue ?
Thanks

from entityauditbundle.

andrewtch avatar andrewtch commented on June 4, 2024

Still the same entity yet with @Column(type="datetime", name="deleted_at") ?

from entityauditbundle.

andrewtch avatar andrewtch commented on June 4, 2024

...anyway, please check #116 )

from entityauditbundle.

arlin2050 avatar arlin2050 commented on June 4, 2024

Still the same entity yet with @column(type="datetime", name="deleted_at") ?

Yes

from entityauditbundle.

arlin2050 avatar arlin2050 commented on June 4, 2024

...anyway, please check #116 )

It works, thanks.
When will this be available on master ?

from entityauditbundle.

andrewtch avatar andrewtch commented on June 4, 2024

it's already merged into master.

from entityauditbundle.

Related Issues (20)

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.