{"action":"created","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/7758","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/7758/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/7758/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/7758/events","html_url":"https://github.com/cakephp/cakephp/issues/7758","id":119384841,"number":7758,"title":"run application rules from associated table before saving","user":{"login":"chipco","id":2259671,"avatar_url":"https://avatars.githubusercontent.com/u/2259671?v=3","gravatar_id":"","url":"https://api.github.com/users/chipco","html_url":"https://github.com/chipco","followers_url":"https://api.github.com/users/chipco/followers","following_url":"https://api.github.com/users/chipco/following{/other_user}","gists_url":"https://api.github.com/users/chipco/gists{/gist_id}","starred_url":"https://api.github.com/users/chipco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chipco/subscriptions","organizations_url":"https://api.github.com/users/chipco/orgs","repos_url":"https://api.github.com/users/chipco/repos","events_url":"https://api.github.com/users/chipco/events{/privacy}","received_events_url":"https://api.github.com/users/chipco/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cakephp/cakephp/labels/Question","name":"Question","color":"207de5"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-29T20:23:56Z","updated_at":"2015-11-29T20:47:02Z","closed_at":"2015-11-29T20:47:02Z","body":"I've been searching [the book] (http://book.cakephp.org/3.0/en/orm/validation.html#applying-application-rules) for a way to avoid getting in a situation where the main entity is saved and it's association is not due to failing an application rule.\r\n\r\nIs there a way to tell the main `Table` to run the rules in the `buildRules` function of the associated `Table` before saving?"},"comment":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/160470168","html_url":"https://github.com/cakephp/cakephp/issues/7758#issuecomment-160470168","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/7758","id":160470168,"user":{"login":"lorenzo","id":37621,"avatar_url":"https://avatars.githubusercontent.com/u/37621?v=3","gravatar_id":"","url":"https://api.github.com/users/lorenzo","html_url":"https://github.com/lorenzo","followers_url":"https://api.github.com/users/lorenzo/followers","following_url":"https://api.github.com/users/lorenzo/following{/other_user}","gists_url":"https://api.github.com/users/lorenzo/gists{/gist_id}","starred_url":"https://api.github.com/users/lorenzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lorenzo/subscriptions","organizations_url":"https://api.github.com/users/lorenzo/orgs","repos_url":"https://api.github.com/users/lorenzo/repos","events_url":"https://api.github.com/users/lorenzo/events{/privacy}","received_events_url":"https://api.github.com/users/lorenzo/received_events","type":"User","site_admin":false},"created_at":"2015-11-29T20:47:02Z","updated_at":"2015-11-29T20:47:02Z","body":"I does that automatically if you are saving associations. Since the save is run inside a transaction, if any of the rules fail, in an association or a main table, none of the changes will be applied"}}