{"action":"created","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/7583","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/7583/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/7583/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/7583/events","html_url":"https://github.com/joomla/joomla-cms/pull/7583","id":98111806,"number":7583,"title":"Multilanguage: deleting an associated item does not delete it in the _associations table","user":{"login":"infograf768","id":869724,"avatar_url":"https://avatars.githubusercontent.com/u/869724?v=3","gravatar_id":"","url":"https://api.github.com/users/infograf768","html_url":"https://github.com/infograf768","followers_url":"https://api.github.com/users/infograf768/followers","following_url":"https://api.github.com/users/infograf768/following{/other_user}","gists_url":"https://api.github.com/users/infograf768/gists{/gist_id}","starred_url":"https://api.github.com/users/infograf768/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infograf768/subscriptions","organizations_url":"https://api.github.com/users/infograf768/orgs","repos_url":"https://api.github.com/users/infograf768/repos","events_url":"https://api.github.com/users/infograf768/events{/privacy}","received_events_url":"https://api.github.com/users/infograf768/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joomla/joomla-cms/labels/PR-staging","name":"PR-staging","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/joomla/joomla-cms/milestones/10","html_url":"https://github.com/joomla/joomla-cms/milestones/Joomla!%203.4.4","labels_url":"https://api.github.com/repos/joomla/joomla-cms/milestones/10/labels","id":1190334,"number":10,"title":"Joomla! 3.4.4","description":"","creator":{"login":"zero-24","id":2596554,"avatar_url":"https://avatars.githubusercontent.com/u/2596554?v=3","gravatar_id":"","url":"https://api.github.com/users/zero-24","html_url":"https://github.com/zero-24","followers_url":"https://api.github.com/users/zero-24/followers","following_url":"https://api.github.com/users/zero-24/following{/other_user}","gists_url":"https://api.github.com/users/zero-24/gists{/gist_id}","starred_url":"https://api.github.com/users/zero-24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zero-24/subscriptions","organizations_url":"https://api.github.com/users/zero-24/orgs","repos_url":"https://api.github.com/users/zero-24/repos","events_url":"https://api.github.com/users/zero-24/events{/privacy}","received_events_url":"https://api.github.com/users/zero-24/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":160,"state":"open","created_at":"2015-07-02T09:44:31Z","updated_at":"2015-07-30T12:11:18Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-07-30T08:28:17Z","updated_at":"2015-07-30T13:10:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/7583","html_url":"https://github.com/joomla/joomla-cms/pull/7583","diff_url":"https://github.com/joomla/joomla-cms/pull/7583.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/7583.patch"},"body":"See https://github.com/joomla/joomla-cms/issues/7127\r\n\r\nAs title says.\r\nThe _associations row should be deleted for the item as well as for the associated item if we have only 2 associated items.\r\n\r\nTo test:\r\nCreate a multilingual site and set associations to Yes in the Languagefilter plugin.\r\n\r\nCreate an article for each language (first with 2 languages) and associate them.\r\nNote their id.\r\nSend to trash. Don't empty trash yet.\r\n\r\nWith phpMyadmin look at the _associations table for rows with the id and the context \"com_content.item\"\r\n\r\nEmpty trash.\r\nReload the phpmyAdmin page: the 2 items are still there.\r\n\r\nRecreate 2 articles and Patch.\r\nre-test. Both rows are now deleted from the _associations table.\r\n\r\nThen test with 3 languages, associating 3 articles.\r\nNow, only the article deleted will be deleted from the associations table, letting the 2 others associated as should.\r\n\r\nThis is also working for menu items, categories, contacts, newsfeeds."},"comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/126318050","html_url":"https://github.com/joomla/joomla-cms/pull/7583#issuecomment-126318050","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/7583","id":126318050,"user":{"login":"infograf768","id":869724,"avatar_url":"https://avatars.githubusercontent.com/u/869724?v=3","gravatar_id":"","url":"https://api.github.com/users/infograf768","html_url":"https://github.com/infograf768","followers_url":"https://api.github.com/users/infograf768/followers","following_url":"https://api.github.com/users/infograf768/following{/other_user}","gists_url":"https://api.github.com/users/infograf768/gists{/gist_id}","starred_url":"https://api.github.com/users/infograf768/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infograf768/subscriptions","organizations_url":"https://api.github.com/users/infograf768/orgs","repos_url":"https://api.github.com/users/infograf768/repos","events_url":"https://api.github.com/users/infograf768/events{/privacy}","received_events_url":"https://api.github.com/users/infograf768/received_events","type":"User","site_admin":false},"created_at":"2015-07-30T13:10:36Z","updated_at":"2015-07-30T13:10:36Z","body":"In fact the context is created in each component when code exist for associations. It is not fetched from any existing code. It is arbitrary defined.\r\nExample for article:\r\n\r\n```\r\n$query->clear()\r\n\t\t\t\t\t\t->insert('#__associations');\r\n\r\n\t\t\t\t\tforeach ($associations as $id)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$query->values($id . ',' . $db->quote('com_content.item') . ',' . $db->quote($key));\r\n\t\t\t\t\t}\r\n```"}}