{"action":"created","comment":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/comments/178091094","pull_request_review_id":108091575,"id":178091094,"diff_hunk":"@@ -0,0 +1,91 @@\n+<?php\n+\n+trait CRM_HRCore_Upgrader_Steps_1012 {\n+\n+  /**\n+   * Disables relationship types that are not necessary for CiviHR and\n+   * removes existing relationships belonging to these types.\n+   */\n+  public function upgrade_1012() {\n+    $relationshipTypesToBeDisabled = $this->up1012_getRelationshipTypesToBeDisabled();\n+\n+    $this->up1012_disableRelationshipTypes($relationshipTypesToBeDisabled);\n+    $this->up1012_removeRelationshipsForTypes($relationshipTypesToBeDisabled);\n+\n+    return TRUE;\n+  }\n+\n+  /**\n+   * Returns the Ids of the the relationship types to be disabled.\n+   *\n+   * @return Array[int]","path":"uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1012.php","position":21,"original_position":21,"commit_id":"e7c57966eb8957a2eb409ce5fcd2893ace90c8f2","original_commit_id":"e7c57966eb8957a2eb409ce5fcd2893ace90c8f2","user":{"login":"mickadoo","id":6374064,"avatar_url":"https://avatars1.githubusercontent.com/u/6374064?v=4","gravatar_id":"","url":"https://api.github.com/users/mickadoo","html_url":"https://github.com/mickadoo","followers_url":"https://api.github.com/users/mickadoo/followers","following_url":"https://api.github.com/users/mickadoo/following{/other_user}","gists_url":"https://api.github.com/users/mickadoo/gists{/gist_id}","starred_url":"https://api.github.com/users/mickadoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mickadoo/subscriptions","organizations_url":"https://api.github.com/users/mickadoo/orgs","repos_url":"https://api.github.com/users/mickadoo/repos","events_url":"https://api.github.com/users/mickadoo/events{/privacy}","received_events_url":"https://api.github.com/users/mickadoo/received_events","type":"User","site_admin":false},"body":"Does the IDE not complain about this? I thought the standard way was to use `int[]`","created_at":"2018-03-29T15:19:41Z","updated_at":"2018-03-29T15:24:25Z","html_url":"https://github.com/civicrm/civihr/pull/2554#discussion_r178091094","pull_request_url":"https://api.github.com/repos/civicrm/civihr/pulls/2554","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments/178091094"},"html":{"href":"https://github.com/civicrm/civihr/pull/2554#discussion_r178091094"},"pull_request":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/2554"}}},"pull_request":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/2554","id":178204017,"html_url":"https://github.com/civicrm/civihr/pull/2554","diff_url":"https://github.com/civicrm/civihr/pull/2554.diff","patch_url":"https://github.com/civicrm/civihr/pull/2554.patch","issue_url":"https://api.github.com/repos/civicrm/civihr/issues/2554","number":2554,"state":"open","locked":false,"title":"PCHR-3411: Remove unnecesary relationship types","user":{"login":"reneolivo","id":1642119,"avatar_url":"https://avatars1.githubusercontent.com/u/1642119?v=4","gravatar_id":"","url":"https://api.github.com/users/reneolivo","html_url":"https://github.com/reneolivo","followers_url":"https://api.github.com/users/reneolivo/followers","following_url":"https://api.github.com/users/reneolivo/following{/other_user}","gists_url":"https://api.github.com/users/reneolivo/gists{/gist_id}","starred_url":"https://api.github.com/users/reneolivo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reneolivo/subscriptions","organizations_url":"https://api.github.com/users/reneolivo/orgs","repos_url":"https://api.github.com/users/reneolivo/repos","events_url":"https://api.github.com/users/reneolivo/events{/privacy}","received_events_url":"https://api.github.com/users/reneolivo/received_events","type":"User","site_admin":false},"body":"## Overview\r\nThis PR removes relationships type that are not needed by CiviHR. The relationships types are:\r\n* Case Coordinator is\r\n* Employee of\r\n* Head of Household for\r\n* Household member of\r\n\r\n## Before\r\n```json\r\n{\r\n\r\n    \"is_error\": 0,\r\n    \"version\": 3,\r\n    \"count\": 4,\r\n    \"values\": [\r\n        {\r\n            \"id\": \"9\",\r\n            \"name_a_b\": \"Case Coordinator is\"\r\n        },\r\n        {\r\n            \"id\": \"5\",\r\n            \"name_a_b\": \"Employee of\"\r\n        },\r\n        {\r\n            \"id\": \"7\",\r\n            \"name_a_b\": \"Head of Household for\"\r\n        },\r\n        {\r\n            \"id\": \"8\",\r\n            \"name_a_b\": \"Household Member of\"\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\n## After\r\n```json\r\n{\r\n    \"is_error\": 0,\r\n    \"version\": 3,\r\n    \"count\": 0,\r\n    \"values\": []\r\n}\r\n```\r\n\r\n## Technical Details\r\n\r\nA new upgrader was implemented for HRCore since this is a change that affects all extensions:\r\n\r\n```php\r\n<?php\r\n\r\ntrait CRM_HRCore_Upgrader_Steps_1012 {\r\n\r\n  /**\r\n   * Removes relationship types that are not necessary for CiviHR.\r\n   */\r\n  public function upgrade_1012() {\r\n    $relationshipsToBeDeleted = [\r\n      'Case Coordinator is',\r\n      'Employee of',\r\n      'Head of Household for',\r\n      'Household member of'\r\n    ];\r\n\r\n    // finds the relationships by name\r\n    $result = civicrm_api3('RelationshipType', 'get', [\r\n      'name_a_b' => [ 'IN' => $relationshipsToBeDeleted ]\r\n    ]);\r\n\r\n    foreach($result['values'] as $relationship) {\r\n      // deletes them one by one\r\n      civicrm_api3('RelationshipType', 'delete', [\r\n        'id' => $relationship['id']\r\n      ]);\r\n    }\r\n\r\n    return TRUE;\r\n  }\r\n}\r\n```\r\n\r\n","created_at":"2018-03-29T01:12:08Z","updated_at":"2018-03-29T15:24:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b57ff0f28e71712b896ddd969d2aa60410b4d46a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/civicrm/civihr/pulls/2554/commits","review_comments_url":"https://api.github.com/repos/civicrm/civihr/pulls/2554/comments","review_comment_url":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civicrm/civihr/issues/2554/comments","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/e7c57966eb8957a2eb409ce5fcd2893ace90c8f2","head":{"label":"civicrm:PCHR-3411-delete-unnecesary-relationship-types","ref":"PCHR-3411-delete-unnecesary-relationship-types","sha":"e7c57966eb8957a2eb409ce5fcd2893ace90c8f2","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"repo":{"id":10086903,"name":"civihr","full_name":"civicrm/civihr","owner":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civicrm/civihr","description":"CiviHR","fork":false,"url":"https://api.github.com/repos/civicrm/civihr","forks_url":"https://api.github.com/repos/civicrm/civihr/forks","keys_url":"https://api.github.com/repos/civicrm/civihr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civicrm/civihr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civicrm/civihr/teams","hooks_url":"https://api.github.com/repos/civicrm/civihr/hooks","issue_events_url":"https://api.github.com/repos/civicrm/civihr/issues/events{/number}","events_url":"https://api.github.com/repos/civicrm/civihr/events","assignees_url":"https://api.github.com/repos/civicrm/civihr/assignees{/user}","branches_url":"https://api.github.com/repos/civicrm/civihr/branches{/branch}","tags_url":"https://api.github.com/repos/civicrm/civihr/tags","blobs_url":"https://api.github.com/repos/civicrm/civihr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civicrm/civihr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civicrm/civihr/git/refs{/sha}","trees_url":"https://api.github.com/repos/civicrm/civihr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/{sha}","languages_url":"https://api.github.com/repos/civicrm/civihr/languages","stargazers_url":"https://api.github.com/repos/civicrm/civihr/stargazers","contributors_url":"https://api.github.com/repos/civicrm/civihr/contributors","subscribers_url":"https://api.github.com/repos/civicrm/civihr/subscribers","subscription_url":"https://api.github.com/repos/civicrm/civihr/subscription","commits_url":"https://api.github.com/repos/civicrm/civihr/commits{/sha}","git_commits_url":"https://api.github.com/repos/civicrm/civihr/git/commits{/sha}","comments_url":"https://api.github.com/repos/civicrm/civihr/comments{/number}","issue_comment_url":"https://api.github.com/repos/civicrm/civihr/issues/comments{/number}","contents_url":"https://api.github.com/repos/civicrm/civihr/contents/{+path}","compare_url":"https://api.github.com/repos/civicrm/civihr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civicrm/civihr/merges","archive_url":"https://api.github.com/repos/civicrm/civihr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civicrm/civihr/downloads","issues_url":"https://api.github.com/repos/civicrm/civihr/issues{/number}","pulls_url":"https://api.github.com/repos/civicrm/civihr/pulls{/number}","milestones_url":"https://api.github.com/repos/civicrm/civihr/milestones{/number}","notifications_url":"https://api.github.com/repos/civicrm/civihr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civicrm/civihr/labels{/name}","releases_url":"https://api.github.com/repos/civicrm/civihr/releases{/id}","deployments_url":"https://api.github.com/repos/civicrm/civihr/deployments","created_at":"2013-05-15T20:06:06Z","updated_at":"2018-03-26T14:30:38Z","pushed_at":"2018-03-29T15:14:49Z","git_url":"git://github.com/civicrm/civihr.git","ssh_url":"git@github.com:civicrm/civihr.git","clone_url":"https://github.com/civicrm/civihr.git","svn_url":"https://github.com/civicrm/civihr","homepage":null,"size":62695,"stargazers_count":26,"watchers_count":26,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"archived":false,"open_issues_count":16,"license":null,"forks":38,"open_issues":16,"watchers":26,"default_branch":"staging"}},"base":{"label":"civicrm:PCHR-3369-tasks-and-workflows-ux-improvements","ref":"PCHR-3369-tasks-and-workflows-ux-improvements","sha":"2072ec3121d04f5a550c59702b8820ec2fd7a912","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"repo":{"id":10086903,"name":"civihr","full_name":"civicrm/civihr","owner":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civicrm/civihr","description":"CiviHR","fork":false,"url":"https://api.github.com/repos/civicrm/civihr","forks_url":"https://api.github.com/repos/civicrm/civihr/forks","keys_url":"https://api.github.com/repos/civicrm/civihr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civicrm/civihr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civicrm/civihr/teams","hooks_url":"https://api.github.com/repos/civicrm/civihr/hooks","issue_events_url":"https://api.github.com/repos/civicrm/civihr/issues/events{/number}","events_url":"https://api.github.com/repos/civicrm/civihr/events","assignees_url":"https://api.github.com/repos/civicrm/civihr/assignees{/user}","branches_url":"https://api.github.com/repos/civicrm/civihr/branches{/branch}","tags_url":"https://api.github.com/repos/civicrm/civihr/tags","blobs_url":"https://api.github.com/repos/civicrm/civihr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civicrm/civihr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civicrm/civihr/git/refs{/sha}","trees_url":"https://api.github.com/repos/civicrm/civihr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/{sha}","languages_url":"https://api.github.com/repos/civicrm/civihr/languages","stargazers_url":"https://api.github.com/repos/civicrm/civihr/stargazers","contributors_url":"https://api.github.com/repos/civicrm/civihr/contributors","subscribers_url":"https://api.github.com/repos/civicrm/civihr/subscribers","subscription_url":"https://api.github.com/repos/civicrm/civihr/subscription","commits_url":"https://api.github.com/repos/civicrm/civihr/commits{/sha}","git_commits_url":"https://api.github.com/repos/civicrm/civihr/git/commits{/sha}","comments_url":"https://api.github.com/repos/civicrm/civihr/comments{/number}","issue_comment_url":"https://api.github.com/repos/civicrm/civihr/issues/comments{/number}","contents_url":"https://api.github.com/repos/civicrm/civihr/contents/{+path}","compare_url":"https://api.github.com/repos/civicrm/civihr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civicrm/civihr/merges","archive_url":"https://api.github.com/repos/civicrm/civihr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civicrm/civihr/downloads","issues_url":"https://api.github.com/repos/civicrm/civihr/issues{/number}","pulls_url":"https://api.github.com/repos/civicrm/civihr/pulls{/number}","milestones_url":"https://api.github.com/repos/civicrm/civihr/milestones{/number}","notifications_url":"https://api.github.com/repos/civicrm/civihr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civicrm/civihr/labels{/name}","releases_url":"https://api.github.com/repos/civicrm/civihr/releases{/id}","deployments_url":"https://api.github.com/repos/civicrm/civihr/deployments","created_at":"2013-05-15T20:06:06Z","updated_at":"2018-03-26T14:30:38Z","pushed_at":"2018-03-29T15:14:49Z","git_url":"git://github.com/civicrm/civihr.git","ssh_url":"git@github.com:civicrm/civihr.git","clone_url":"https://github.com/civicrm/civihr.git","svn_url":"https://github.com/civicrm/civihr","homepage":null,"size":62695,"stargazers_count":26,"watchers_count":26,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"archived":false,"open_issues_count":16,"license":null,"forks":38,"open_issues":16,"watchers":26,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/2554"},"html":{"href":"https://github.com/civicrm/civihr/pull/2554"},"issue":{"href":"https://api.github.com/repos/civicrm/civihr/issues/2554"},"comments":{"href":"https://api.github.com/repos/civicrm/civihr/issues/2554/comments"},"review_comments":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/2554/comments"},"review_comment":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/2554/commits"},"statuses":{"href":"https://api.github.com/repos/civicrm/civihr/statuses/e7c57966eb8957a2eb409ce5fcd2893ace90c8f2"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"mickadoo"}}