简体   繁体   English

EntityAudit-Doctrine2:可能在OneToMany和OneToOne中使用同一实体

[英]EntityAudit - Doctrine2: Using the same entity in both OneToMany and OneToOne possible

is it possible do audit entities with the simplethings / EntityAudit - https://github.com/simplethings/EntityAudit 是否可以使用simplethings / EntityAudit审计实体-https: //github.com/simplethings/EntityAudit

using the same entity in both OneToMany and OneToOne relation? 在OneToMany和OneToOne关系中使用相同的实体?

class Address
    {
        /**
         * @ORM\Column 
         */
        protected $address_text;

        /**
         * @ORM\ManyToOne(targetEntity="Customer", inversedBy="addresses") 
         */
        protected $customer;
    }



    class Customer 
    {
        /**
        * @ORM\OneToMany(targetEntity="Address", mappedBy="customer")
        */
        protected $addresses;

        /**
        * @ORM\OneToOne(targetEntity="Address")
        */
        protected $primary_address;
    }

without auditing it works perfectly, but with it - the script ends on UnitOfWork::getEntityIdentifier with the "Unidentified index" notice 无需审核即可完美运行,但是有了它-脚本以“ Unidentified index”通知在UnitOfWork::getEntityIdentifier上结束

  1. I've pulled in the changes from https://github.com/merk/EntityAudit/commit/0c1c7df1e53d50629c141b418a18ccee83a3b9b4 , there is also a PR, maybe it's getting fixed in official repo soon ( merk/onetomany branch ). 我已经从https://github.com/merk/EntityAudit/commit/0c1c7df1e53d50629c141b418a18ccee83a3b9b4中获取了更改,还有一个PR,也许它很快就会在正式的repo中修复(merk / onetomany分支)。

  2. Make also sure your Entity name is written right (Upper/Lowecase) in config.yml, there seems to be no error if its wrong 还要确保您的实体名称在config.yml中写的正确(大写/小写),如果错误,似乎没有错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM