{"action":"closed","number":1908,"pull_request":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls/1908","id":105244633,"html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1908","diff_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1908.diff","patch_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1908.patch","issue_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1908","number":1908,"state":"closed","locked":false,"title":"EZP-26885: As a Developer I want to future proof my Field Types by using Doctrine [in external storage]","user":{"login":"alongosz","id":7099219,"avatar_url":"https://avatars2.githubusercontent.com/u/7099219?v=3","gravatar_id":"","url":"https://api.github.com/users/alongosz","html_url":"https://github.com/alongosz","followers_url":"https://api.github.com/users/alongosz/followers","following_url":"https://api.github.com/users/alongosz/following{/other_user}","gists_url":"https://api.github.com/users/alongosz/gists{/gist_id}","starred_url":"https://api.github.com/users/alongosz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alongosz/subscriptions","organizations_url":"https://api.github.com/users/alongosz/orgs","repos_url":"https://api.github.com/users/alongosz/repos","events_url":"https://api.github.com/users/alongosz/events{/privacy}","received_events_url":"https://api.github.com/users/alongosz/received_events","type":"User","site_admin":false},"body":"> Implements [EZP-26885](https://jira.ez.no/browse/EZP-26885)\r\n> Status: **Ready for a review**\r\n\r\nWe want to be able to use `\\Doctrine\\DBAL\\Connection` for FieldTypes external storage directly.\r\n\r\nTo achieve this, FieldType external storage needs to be injected with `DoctrineStorage` gateway which uses Doctrine instead of Legacy Connection Handler.\r\nPR also consists of TMP commits presenting sample implementations, for `Url` and `RichText` FieldTypes.\r\n\r\nThe main architecture issue related to this implementation is the fact that `\\eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\FieldHandler` uses, common for all FieldTypes, Legacy StorageHandler. This means that it's not enough to just register Doctrine gateway for a given FieldType but also `FieldHandler` must use proper `StorageHandler`.\r\n\r\nTo workaround this issue Doctrine `StorageHandler` is [injected directly into `DoctrineStorage` (`GatewayBasedStorage`) implementation for a specific field](https://github.com/alongosz/ezpublish-kernel/blob/75dbd4f1157c88ee6f1c16e80ed0fa54e9caa1ef/eZ/Publish/Core/settings/fieldtype_external_storages.yml#L55). If `GatewayBasedStorage` got explicitly injected with `StorageHandler`, then this one is used instead of the one passed by `FieldHandler` to get a proper gateway.\r\n\r\nHowever, sometimes [gateway is injected directly](https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Publish/Core/FieldType/RichText/RichTextStorage/Gateway/LegacyStorage.php#L40) setting incorrect Connection. \r\nTo avoid this, `DoctrineStorage` Gateway for a FieldType gets [injected directly with proper Connection](https://github.com/alongosz/ezpublish-kernel/blob/75dbd4f1157c88ee6f1c16e80ed0fa54e9caa1ef/eZ/Publish/Core/settings/storage_engines/doctrine/external_storage_gateways.yml#L16) and `setConnection` is ignored.\r\n\r\nThis solution is far from perfect (hence the \"workaround\" keyword appears), so let's discuss improvements.\r\n\r\n**TODO**:\r\n- [x] Create Doctrine StorageHandler for FieldTypes.\r\n- [x] Refactor `\\eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\StorageRegistry` to `\\eZ\\Publish\\Core\\Persistence\\Content\\StorageRegistry` to reflect this is common for storage engines.\r\n- [x] Refactor `\\eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\StorageHandler` to `\\eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\StorageHandler` to extract common part for all storage engines.\r\n- [x] Override `\\Doctrine\\DBAL\\Connection` with custom wrapper extending it.\r\n- [ ] Discuss solution.\r\n- [ ] Move TMP commit to other PR if/when this one is accepted.","created_at":"2017-02-08T15:50:47Z","updated_at":"2017-04-07T12:56:10Z","closed_at":"2017-04-07T12:56:10Z","merged_at":null,"merge_commit_sha":"99afe21022bfb600af55f162f4064bc772752161","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls/1908/commits","review_comments_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls/1908/comments","review_comment_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1908/comments","statuses_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/statuses/1b4f0da17899bfd9266db31cf7d01ff3845b3066","head":{"label":"alongosz:ezp-26885-ft-doctrine-ext-storage","ref":"ezp-26885-ft-doctrine-ext-storage","sha":"1b4f0da17899bfd9266db31cf7d01ff3845b3066","user":{"login":"alongosz","id":7099219,"avatar_url":"https://avatars2.githubusercontent.com/u/7099219?v=3","gravatar_id":"","url":"https://api.github.com/users/alongosz","html_url":"https://github.com/alongosz","followers_url":"https://api.github.com/users/alongosz/followers","following_url":"https://api.github.com/users/alongosz/following{/other_user}","gists_url":"https://api.github.com/users/alongosz/gists{/gist_id}","starred_url":"https://api.github.com/users/alongosz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alongosz/subscriptions","organizations_url":"https://api.github.com/users/alongosz/orgs","repos_url":"https://api.github.com/users/alongosz/repos","events_url":"https://api.github.com/users/alongosz/events{/privacy}","received_events_url":"https://api.github.com/users/alongosz/received_events","type":"User","site_admin":false},"repo":{"id":58625909,"name":"ezpublish-kernel","full_name":"alongosz/ezpublish-kernel","owner":{"login":"alongosz","id":7099219,"avatar_url":"https://avatars2.githubusercontent.com/u/7099219?v=3","gravatar_id":"","url":"https://api.github.com/users/alongosz","html_url":"https://github.com/alongosz","followers_url":"https://api.github.com/users/alongosz/followers","following_url":"https://api.github.com/users/alongosz/following{/other_user}","gists_url":"https://api.github.com/users/alongosz/gists{/gist_id}","starred_url":"https://api.github.com/users/alongosz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alongosz/subscriptions","organizations_url":"https://api.github.com/users/alongosz/orgs","repos_url":"https://api.github.com/users/alongosz/repos","events_url":"https://api.github.com/users/alongosz/events{/privacy}","received_events_url":"https://api.github.com/users/alongosz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alongosz/ezpublish-kernel","description":"eZ Platform (aka eZ Publish 6.x) kernel","fork":true,"url":"https://api.github.com/repos/alongosz/ezpublish-kernel","forks_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/forks","keys_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/teams","hooks_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/hooks","issue_events_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/issues/events{/number}","events_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/events","assignees_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/assignees{/user}","branches_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/branches{/branch}","tags_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/tags","blobs_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/git/refs{/sha}","trees_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/statuses/{sha}","languages_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/languages","stargazers_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/stargazers","contributors_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/contributors","subscribers_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/subscribers","subscription_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/subscription","commits_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/commits{/sha}","git_commits_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/git/commits{/sha}","comments_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/comments{/number}","issue_comment_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/issues/comments{/number}","contents_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/contents/{+path}","compare_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/merges","archive_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/downloads","issues_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/issues{/number}","pulls_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/pulls{/number}","milestones_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/milestones{/number}","notifications_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/labels{/name}","releases_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/releases{/id}","deployments_url":"https://api.github.com/repos/alongosz/ezpublish-kernel/deployments","created_at":"2016-05-12T09:06:18Z","updated_at":"2016-05-12T09:06:28Z","pushed_at":"2017-04-05T12:23:01Z","git_url":"git://github.com/alongosz/ezpublish-kernel.git","ssh_url":"git@github.com:alongosz/ezpublish-kernel.git","clone_url":"https://github.com/alongosz/ezpublish-kernel.git","svn_url":"https://github.com/alongosz/ezpublish-kernel","homepage":"http://ezplatform.com/","size":48220,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ezsystems:master","ref":"master","sha":"1bdad65810d562c8a07be128f1eeb79ec1a5cfa3","user":{"login":"ezsystems","id":295311,"avatar_url":"https://avatars2.githubusercontent.com/u/295311?v=3","gravatar_id":"","url":"https://api.github.com/users/ezsystems","html_url":"https://github.com/ezsystems","followers_url":"https://api.github.com/users/ezsystems/followers","following_url":"https://api.github.com/users/ezsystems/following{/other_user}","gists_url":"https://api.github.com/users/ezsystems/gists{/gist_id}","starred_url":"https://api.github.com/users/ezsystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezsystems/subscriptions","organizations_url":"https://api.github.com/users/ezsystems/orgs","repos_url":"https://api.github.com/users/ezsystems/repos","events_url":"https://api.github.com/users/ezsystems/events{/privacy}","received_events_url":"https://api.github.com/users/ezsystems/received_events","type":"Organization","site_admin":false},"repo":{"id":1663890,"name":"ezpublish-kernel","full_name":"ezsystems/ezpublish-kernel","owner":{"login":"ezsystems","id":295311,"avatar_url":"https://avatars2.githubusercontent.com/u/295311?v=3","gravatar_id":"","url":"https://api.github.com/users/ezsystems","html_url":"https://github.com/ezsystems","followers_url":"https://api.github.com/users/ezsystems/followers","following_url":"https://api.github.com/users/ezsystems/following{/other_user}","gists_url":"https://api.github.com/users/ezsystems/gists{/gist_id}","starred_url":"https://api.github.com/users/ezsystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezsystems/subscriptions","organizations_url":"https://api.github.com/users/ezsystems/orgs","repos_url":"https://api.github.com/users/ezsystems/repos","events_url":"https://api.github.com/users/ezsystems/events{/privacy}","received_events_url":"https://api.github.com/users/ezsystems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ezsystems/ezpublish-kernel","description":"Kernel (Repository, MVC layer, REST) for eZ Platform","fork":false,"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel","forks_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/forks","keys_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/teams","hooks_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/hooks","issue_events_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/events{/number}","events_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/events","assignees_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/assignees{/user}","branches_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/branches{/branch}","tags_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/tags","blobs_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/git/refs{/sha}","trees_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/statuses/{sha}","languages_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/languages","stargazers_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/stargazers","contributors_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/contributors","subscribers_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/subscribers","subscription_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/subscription","commits_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/commits{/sha}","git_commits_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/git/commits{/sha}","comments_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/comments{/number}","issue_comment_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/comments{/number}","contents_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/contents/{+path}","compare_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/merges","archive_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/downloads","issues_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues{/number}","pulls_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls{/number}","milestones_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/milestones{/number}","notifications_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/labels{/name}","releases_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/releases{/id}","deployments_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/deployments","created_at":"2011-04-26T08:54:24Z","updated_at":"2017-02-06T20:26:17Z","pushed_at":"2017-04-07T08:23:08Z","git_url":"git://github.com/ezsystems/ezpublish-kernel.git","ssh_url":"git@github.com:ezsystems/ezpublish-kernel.git","clone_url":"https://github.com/ezsystems/ezpublish-kernel.git","svn_url":"https://github.com/ezsystems/ezpublish-kernel","homepage":"http://ezplatform.com/","size":48491,"stargazers_count":121,"watchers_count":121,"language":"PHP","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":171,"mirror_url":null,"open_issues_count":66,"forks":171,"open_issues":66,"watchers":121,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls/1908"},"html":{"href":"https://github.com/ezsystems/ezpublish-kernel/pull/1908"},"issue":{"href":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1908"},"comments":{"href":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1908/comments"},"review_comments":{"href":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls/1908/comments"},"review_comment":{"href":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls/1908/commits"},"statuses":{"href":"https://api.github.com/repos/ezsystems/ezpublish-kernel/statuses/1b4f0da17899bfd9266db31cf7d01ff3845b3066"}},"merged":false,"mergeable":false,"mergeable_state":"dirty","merged_by":null,"comments":7,"review_comments":2,"maintainer_can_modify":false,"commits":11,"additions":600,"deletions":150,"changed_files":20}}
{"actor":{"display_login":"alongosz"}}