{"action":"created","issue":{"url":"https://api.github.com/repos/xiidea/EasyAuditBundle/issues/21","repository_url":"https://api.github.com/repos/xiidea/EasyAuditBundle","labels_url":"https://api.github.com/repos/xiidea/EasyAuditBundle/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/xiidea/EasyAuditBundle/issues/21/comments","events_url":"https://api.github.com/repos/xiidea/EasyAuditBundle/issues/21/events","html_url":"https://github.com/xiidea/EasyAuditBundle/issues/21","id":307220669,"node_id":"MDU6SXNzdWUzMDcyMjA2Njk=","number":21,"title":"Log should not be registered when action fails","user":{"login":"pribeirojtm","id":18724236,"node_id":"MDQ6VXNlcjE4NzI0MjM2","avatar_url":"https://avatars0.githubusercontent.com/u/18724236?v=4","gravatar_id":"","url":"https://api.github.com/users/pribeirojtm","html_url":"https://github.com/pribeirojtm","followers_url":"https://api.github.com/users/pribeirojtm/followers","following_url":"https://api.github.com/users/pribeirojtm/following{/other_user}","gists_url":"https://api.github.com/users/pribeirojtm/gists{/gist_id}","starred_url":"https://api.github.com/users/pribeirojtm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pribeirojtm/subscriptions","organizations_url":"https://api.github.com/users/pribeirojtm/orgs","repos_url":"https://api.github.com/users/pribeirojtm/repos","events_url":"https://api.github.com/users/pribeirojtm/events{/privacy}","received_events_url":"https://api.github.com/users/pribeirojtm/received_events","type":"User","site_admin":false},"labels":[{"id":66043945,"node_id":"MDU6TGFiZWw2NjA0Mzk0NQ==","url":"https://api.github.com/repos/xiidea/EasyAuditBundle/labels/bug","name":"bug","color":"d93f0b","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-03-21T12:15:09Z","updated_at":"2018-06-25T11:11:36Z","closed_at":"2018-06-25T11:11:36Z","author_association":"NONE","body":"Hi\r\n\r\nI'm having incoherences in AudiLog, in cases when an action <del>Update/Create/</del>_**Delete**_ to an entity fails for any reason: **log is still registered while action actual failed**.\r\n\r\nImagine you have 2 Entities: **Product** and **Category** . And assuming a Product can't \"live\" without a Category.\r\n\r\nProduct.php: \r\n```\r\nnamespace AppBundle\\Entity;\r\nuse Doctrine\\ORM\\Mapping as ORM;\r\n\r\n/**\r\n* @ORM\\Table(name=\"product\")\r\n* @ORM\\Entity\r\n*/\r\nclass Product {\r\n\r\n/**\r\n* @ORM\\Id\r\n* @ORM\\GeneratedValue(strategy=\"IDENTITY\")\r\n*/\r\nprivate $id;\r\n\r\n/**\r\n*  @ORM\\Column(type=\"string\")\r\n*/\r\nprivate $name;\r\n\r\n/**\r\nOr OneToOne\r\n* @var Category\r\n* @ORM\\ManyToOne(targetEntity=\"Category\") \r\n* @ORM\\JoinColumns({\r\n*     @ORM\\JoinColumn(name=\"id_category\", referencedColumnName=\"id\")\r\n* })\r\n*/\r\nprivate $category;\r\n}\r\n\r\n```\r\nCastegory.php:\r\n```\r\nnamespace AppBundle\\Entity;\r\nuse Doctrine\\ORM\\Mapping as ORM;\r\n\r\n/**\r\n* @ORM\\Table(name=\"category\")\r\n* @ORM\\Entity\r\n*/\r\nclass Category {\r\n\r\n/**\r\n* @ORM\\Id\r\n* @ORM\\GeneratedValue(strategy=\"IDENTITY\")\r\n*/\r\nprivate $id;\r\n\r\n/**\r\n*  @ORM\\Column(type=\"string\")\r\n*/\r\nprivate $name;\r\n}\r\n```\r\n\r\nRecords in each table:\r\n\r\nProduct:\r\n```\r\n| id | name | id_category |\r\n| 1  | a    | 1           |\r\n```\r\nCategory:\r\n```\r\n| id | name | \r\n| 1  | A    |\r\n ```\r\nExample of deleting Category with id 1:\r\n\r\nBecause category has its PK present as FK in Product entity and it has the default \"onDelete Restrict\", it fails to delete the parent entity record, in this case the Category. If I wanted really to delete the category, I had to first delete the reference in the Product, but I don't want that in this case.\r\nIn these cases of failure, the log is still registered. \r\n\r\n```\r\nCategory has been deleted with id = \"1\".\r\n```\r\n\r\nDo you recommend a way to tackle this issue?"},"comment":{"url":"https://api.github.com/repos/xiidea/EasyAuditBundle/issues/comments/399916024","html_url":"https://github.com/xiidea/EasyAuditBundle/issues/21#issuecomment-399916024","issue_url":"https://api.github.com/repos/xiidea/EasyAuditBundle/issues/21","id":399916024,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTkxNjAyNA==","user":{"login":"pribeirojtm","id":18724236,"node_id":"MDQ6VXNlcjE4NzI0MjM2","avatar_url":"https://avatars0.githubusercontent.com/u/18724236?v=4","gravatar_id":"","url":"https://api.github.com/users/pribeirojtm","html_url":"https://github.com/pribeirojtm","followers_url":"https://api.github.com/users/pribeirojtm/followers","following_url":"https://api.github.com/users/pribeirojtm/following{/other_user}","gists_url":"https://api.github.com/users/pribeirojtm/gists{/gist_id}","starred_url":"https://api.github.com/users/pribeirojtm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pribeirojtm/subscriptions","organizations_url":"https://api.github.com/users/pribeirojtm/orgs","repos_url":"https://api.github.com/users/pribeirojtm/repos","events_url":"https://api.github.com/users/pribeirojtm/events{/privacy}","received_events_url":"https://api.github.com/users/pribeirojtm/received_events","type":"User","site_admin":false},"created_at":"2018-06-25T11:11:36Z","updated_at":"2018-06-25T11:11:36Z","author_association":"NONE","body":"Hi @ronisaha ,\r\n\r\nIs this already in a new tag? or still in master?"}}
{"actor":{"display_login":"pribeirojtm"}}