{"action":"created","comment":{"url":"https://api.github.com/repos/alexei-vinn/d8/pulls/comments/184633389","pull_request_review_id":115869912,"id":184633389,"diff_hunk":"@@ -0,0 +1,79 @@\n+<?php\n+\n+namespace Drupal\\block_api_task\\Plugin\\Block;\n+\n+use Drupal\\Core\\Block\\BlockBase;\n+use Drupal\\Core\\Messenger\\MessengerInterface;\n+use Drupal\\Core\\Entity\\EntityStorageInterface;\n+use Drupal\\Core\\Plugin\\ContainerFactoryPluginInterface;\n+use Symfony\\Component\\DependencyInjection\\ContainerInterface;\n+\n+/**\n+ * Provides a 'DefaultBlock' block.\n+ *\n+ * @Block(\n+ *  id = \"default_block\",\n+ *  admin_label = @Translation(\"Default block\"),\n+ * )\n+ */\n+class DefaultBlock extends BlockBase implements ContainerFactoryPluginInterface\n+{\n+\n+    protected $messenger;\n+    protected $MyEntityStorage;\n+    protected $NodeStorage;\n+\n+    public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $entity_storage, EntityStorageInterface $node_storage, MessengerInterface $messenger)\n+    {\n+        parent::__construct($configuration, $plugin_id, $plugin_definition);\n+        $this->messenger = $messenger;\n+        $this->MyEntityStorage = $entity_storage;\n+        $this->NodeStorage = $node_storage;\n+    }\n+\n+    public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)\n+    {\n+        $storage = $container->get('entity.manager');\n+        return new static(\n+            $configuration, $plugin_id, $plugin_definition,\n+            $storage->getStorage('my_entity'),\n+            $storage->getStorage('node'),\n+            $container->get('messenger')\n+        );\n+    }\n+\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function build()\n+    {\n+        $ids = $this->MyEntityStorage->getQuery()\n+            ->condition('status', 1)\n+            ->execute();\n+\n+        $entities = $this->MyEntityStorage->loadMultiple($ids);\n+        $colors = array();\n+        foreach ($entities as $entity) {\n+            /** @var \\Drupal\\customentity\\Entity\\MyEntityInterface $entity */\n+\n+            $colors[] = $entity->get('article')->referencedEntities()[0]->get('field_color')->getValue()[0]['value'];","path":"web/modules/custom/mymodule/block_api_task/src/Plugin/Block/DefaultBlock.php","position":59,"original_position":59,"commit_id":"0c64e4766a675a4d77d09ff5c30ff07acd3747c5","original_commit_id":"0c64e4766a675a4d77d09ff5c30ff07acd3747c5","user":{"login":"alexei-vinn","id":10831226,"avatar_url":"https://avatars2.githubusercontent.com/u/10831226?v=4","gravatar_id":"","url":"https://api.github.com/users/alexei-vinn","html_url":"https://github.com/alexei-vinn","followers_url":"https://api.github.com/users/alexei-vinn/followers","following_url":"https://api.github.com/users/alexei-vinn/following{/other_user}","gists_url":"https://api.github.com/users/alexei-vinn/gists{/gist_id}","starred_url":"https://api.github.com/users/alexei-vinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexei-vinn/subscriptions","organizations_url":"https://api.github.com/users/alexei-vinn/orgs","repos_url":"https://api.github.com/users/alexei-vinn/repos","events_url":"https://api.github.com/users/alexei-vinn/events{/privacy}","received_events_url":"https://api.github.com/users/alexei-vinn/received_events","type":"User","site_admin":false},"body":"Тогда еще нужна проверка существует ли сущность","created_at":"2018-04-27T09:14:08Z","updated_at":"2018-04-27T09:14:08Z","html_url":"https://github.com/alexei-vinn/d8/pull/2#discussion_r184633389","pull_request_url":"https://api.github.com/repos/alexei-vinn/d8/pulls/2","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/alexei-vinn/d8/pulls/comments/184633389"},"html":{"href":"https://github.com/alexei-vinn/d8/pull/2#discussion_r184633389"},"pull_request":{"href":"https://api.github.com/repos/alexei-vinn/d8/pulls/2"}},"in_reply_to_id":184632015},"pull_request":{"url":"https://api.github.com/repos/alexei-vinn/d8/pulls/2","id":184562040,"html_url":"https://github.com/alexei-vinn/d8/pull/2","diff_url":"https://github.com/alexei-vinn/d8/pull/2.diff","patch_url":"https://github.com/alexei-vinn/d8/pull/2.patch","issue_url":"https://api.github.com/repos/alexei-vinn/d8/issues/2","number":2,"state":"open","locked":false,"title":"Finished creating test block","user":{"login":"alexei-vinn","id":10831226,"avatar_url":"https://avatars2.githubusercontent.com/u/10831226?v=4","gravatar_id":"","url":"https://api.github.com/users/alexei-vinn","html_url":"https://github.com/alexei-vinn","followers_url":"https://api.github.com/users/alexei-vinn/followers","following_url":"https://api.github.com/users/alexei-vinn/following{/other_user}","gists_url":"https://api.github.com/users/alexei-vinn/gists{/gist_id}","starred_url":"https://api.github.com/users/alexei-vinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexei-vinn/subscriptions","organizations_url":"https://api.github.com/users/alexei-vinn/orgs","repos_url":"https://api.github.com/users/alexei-vinn/repos","events_url":"https://api.github.com/users/alexei-vinn/events{/privacy}","received_events_url":"https://api.github.com/users/alexei-vinn/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-27T08:56:26Z","updated_at":"2018-04-27T09:14:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7f977353d3562b224a6569a04dceef3d1c59f7e0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/alexei-vinn/d8/pulls/2/commits","review_comments_url":"https://api.github.com/repos/alexei-vinn/d8/pulls/2/comments","review_comment_url":"https://api.github.com/repos/alexei-vinn/d8/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alexei-vinn/d8/issues/2/comments","statuses_url":"https://api.github.com/repos/alexei-vinn/d8/statuses/0c64e4766a675a4d77d09ff5c30ff07acd3747c5","head":{"label":"alexei-vinn:block_api_task_2.17","ref":"block_api_task_2.17","sha":"0c64e4766a675a4d77d09ff5c30ff07acd3747c5","user":{"login":"alexei-vinn","id":10831226,"avatar_url":"https://avatars2.githubusercontent.com/u/10831226?v=4","gravatar_id":"","url":"https://api.github.com/users/alexei-vinn","html_url":"https://github.com/alexei-vinn","followers_url":"https://api.github.com/users/alexei-vinn/followers","following_url":"https://api.github.com/users/alexei-vinn/following{/other_user}","gists_url":"https://api.github.com/users/alexei-vinn/gists{/gist_id}","starred_url":"https://api.github.com/users/alexei-vinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexei-vinn/subscriptions","organizations_url":"https://api.github.com/users/alexei-vinn/orgs","repos_url":"https://api.github.com/users/alexei-vinn/repos","events_url":"https://api.github.com/users/alexei-vinn/events{/privacy}","received_events_url":"https://api.github.com/users/alexei-vinn/received_events","type":"User","site_admin":false},"repo":{"id":130381388,"name":"d8","full_name":"alexei-vinn/d8","owner":{"login":"alexei-vinn","id":10831226,"avatar_url":"https://avatars2.githubusercontent.com/u/10831226?v=4","gravatar_id":"","url":"https://api.github.com/users/alexei-vinn","html_url":"https://github.com/alexei-vinn","followers_url":"https://api.github.com/users/alexei-vinn/followers","following_url":"https://api.github.com/users/alexei-vinn/following{/other_user}","gists_url":"https://api.github.com/users/alexei-vinn/gists{/gist_id}","starred_url":"https://api.github.com/users/alexei-vinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexei-vinn/subscriptions","organizations_url":"https://api.github.com/users/alexei-vinn/orgs","repos_url":"https://api.github.com/users/alexei-vinn/repos","events_url":"https://api.github.com/users/alexei-vinn/events{/privacy}","received_events_url":"https://api.github.com/users/alexei-vinn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexei-vinn/d8","description":null,"fork":false,"url":"https://api.github.com/repos/alexei-vinn/d8","forks_url":"https://api.github.com/repos/alexei-vinn/d8/forks","keys_url":"https://api.github.com/repos/alexei-vinn/d8/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexei-vinn/d8/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexei-vinn/d8/teams","hooks_url":"https://api.github.com/repos/alexei-vinn/d8/hooks","issue_events_url":"https://api.github.com/repos/alexei-vinn/d8/issues/events{/number}","events_url":"https://api.github.com/repos/alexei-vinn/d8/events","assignees_url":"https://api.github.com/repos/alexei-vinn/d8/assignees{/user}","branches_url":"https://api.github.com/repos/alexei-vinn/d8/branches{/branch}","tags_url":"https://api.github.com/repos/alexei-vinn/d8/tags","blobs_url":"https://api.github.com/repos/alexei-vinn/d8/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexei-vinn/d8/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexei-vinn/d8/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexei-vinn/d8/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexei-vinn/d8/statuses/{sha}","languages_url":"https://api.github.com/repos/alexei-vinn/d8/languages","stargazers_url":"https://api.github.com/repos/alexei-vinn/d8/stargazers","contributors_url":"https://api.github.com/repos/alexei-vinn/d8/contributors","subscribers_url":"https://api.github.com/repos/alexei-vinn/d8/subscribers","subscription_url":"https://api.github.com/repos/alexei-vinn/d8/subscription","commits_url":"https://api.github.com/repos/alexei-vinn/d8/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexei-vinn/d8/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexei-vinn/d8/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexei-vinn/d8/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexei-vinn/d8/contents/{+path}","compare_url":"https://api.github.com/repos/alexei-vinn/d8/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexei-vinn/d8/merges","archive_url":"https://api.github.com/repos/alexei-vinn/d8/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexei-vinn/d8/downloads","issues_url":"https://api.github.com/repos/alexei-vinn/d8/issues{/number}","pulls_url":"https://api.github.com/repos/alexei-vinn/d8/pulls{/number}","milestones_url":"https://api.github.com/repos/alexei-vinn/d8/milestones{/number}","notifications_url":"https://api.github.com/repos/alexei-vinn/d8/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexei-vinn/d8/labels{/name}","releases_url":"https://api.github.com/repos/alexei-vinn/d8/releases{/id}","deployments_url":"https://api.github.com/repos/alexei-vinn/d8/deployments","created_at":"2018-04-20T15:34:30Z","updated_at":"2018-04-27T08:52:32Z","pushed_at":"2018-04-27T08:56:26Z","git_url":"git://github.com/alexei-vinn/d8.git","ssh_url":"git@github.com:alexei-vinn/d8.git","clone_url":"https://github.com/alexei-vinn/d8.git","svn_url":"https://github.com/alexei-vinn/d8","homepage":null,"size":546,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"alexei-vinn:master","ref":"master","sha":"4784fd89884a6d05ac576298030c4f2b8da9a4bd","user":{"login":"alexei-vinn","id":10831226,"avatar_url":"https://avatars2.githubusercontent.com/u/10831226?v=4","gravatar_id":"","url":"https://api.github.com/users/alexei-vinn","html_url":"https://github.com/alexei-vinn","followers_url":"https://api.github.com/users/alexei-vinn/followers","following_url":"https://api.github.com/users/alexei-vinn/following{/other_user}","gists_url":"https://api.github.com/users/alexei-vinn/gists{/gist_id}","starred_url":"https://api.github.com/users/alexei-vinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexei-vinn/subscriptions","organizations_url":"https://api.github.com/users/alexei-vinn/orgs","repos_url":"https://api.github.com/users/alexei-vinn/repos","events_url":"https://api.github.com/users/alexei-vinn/events{/privacy}","received_events_url":"https://api.github.com/users/alexei-vinn/received_events","type":"User","site_admin":false},"repo":{"id":130381388,"name":"d8","full_name":"alexei-vinn/d8","owner":{"login":"alexei-vinn","id":10831226,"avatar_url":"https://avatars2.githubusercontent.com/u/10831226?v=4","gravatar_id":"","url":"https://api.github.com/users/alexei-vinn","html_url":"https://github.com/alexei-vinn","followers_url":"https://api.github.com/users/alexei-vinn/followers","following_url":"https://api.github.com/users/alexei-vinn/following{/other_user}","gists_url":"https://api.github.com/users/alexei-vinn/gists{/gist_id}","starred_url":"https://api.github.com/users/alexei-vinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexei-vinn/subscriptions","organizations_url":"https://api.github.com/users/alexei-vinn/orgs","repos_url":"https://api.github.com/users/alexei-vinn/repos","events_url":"https://api.github.com/users/alexei-vinn/events{/privacy}","received_events_url":"https://api.github.com/users/alexei-vinn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexei-vinn/d8","description":null,"fork":false,"url":"https://api.github.com/repos/alexei-vinn/d8","forks_url":"https://api.github.com/repos/alexei-vinn/d8/forks","keys_url":"https://api.github.com/repos/alexei-vinn/d8/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexei-vinn/d8/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexei-vinn/d8/teams","hooks_url":"https://api.github.com/repos/alexei-vinn/d8/hooks","issue_events_url":"https://api.github.com/repos/alexei-vinn/d8/issues/events{/number}","events_url":"https://api.github.com/repos/alexei-vinn/d8/events","assignees_url":"https://api.github.com/repos/alexei-vinn/d8/assignees{/user}","branches_url":"https://api.github.com/repos/alexei-vinn/d8/branches{/branch}","tags_url":"https://api.github.com/repos/alexei-vinn/d8/tags","blobs_url":"https://api.github.com/repos/alexei-vinn/d8/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexei-vinn/d8/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexei-vinn/d8/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexei-vinn/d8/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexei-vinn/d8/statuses/{sha}","languages_url":"https://api.github.com/repos/alexei-vinn/d8/languages","stargazers_url":"https://api.github.com/repos/alexei-vinn/d8/stargazers","contributors_url":"https://api.github.com/repos/alexei-vinn/d8/contributors","subscribers_url":"https://api.github.com/repos/alexei-vinn/d8/subscribers","subscription_url":"https://api.github.com/repos/alexei-vinn/d8/subscription","commits_url":"https://api.github.com/repos/alexei-vinn/d8/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexei-vinn/d8/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexei-vinn/d8/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexei-vinn/d8/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexei-vinn/d8/contents/{+path}","compare_url":"https://api.github.com/repos/alexei-vinn/d8/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexei-vinn/d8/merges","archive_url":"https://api.github.com/repos/alexei-vinn/d8/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexei-vinn/d8/downloads","issues_url":"https://api.github.com/repos/alexei-vinn/d8/issues{/number}","pulls_url":"https://api.github.com/repos/alexei-vinn/d8/pulls{/number}","milestones_url":"https://api.github.com/repos/alexei-vinn/d8/milestones{/number}","notifications_url":"https://api.github.com/repos/alexei-vinn/d8/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexei-vinn/d8/labels{/name}","releases_url":"https://api.github.com/repos/alexei-vinn/d8/releases{/id}","deployments_url":"https://api.github.com/repos/alexei-vinn/d8/deployments","created_at":"2018-04-20T15:34:30Z","updated_at":"2018-04-27T08:52:32Z","pushed_at":"2018-04-27T08:56:26Z","git_url":"git://github.com/alexei-vinn/d8.git","ssh_url":"git@github.com:alexei-vinn/d8.git","clone_url":"https://github.com/alexei-vinn/d8.git","svn_url":"https://github.com/alexei-vinn/d8","homepage":null,"size":546,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alexei-vinn/d8/pulls/2"},"html":{"href":"https://github.com/alexei-vinn/d8/pull/2"},"issue":{"href":"https://api.github.com/repos/alexei-vinn/d8/issues/2"},"comments":{"href":"https://api.github.com/repos/alexei-vinn/d8/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/alexei-vinn/d8/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/alexei-vinn/d8/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alexei-vinn/d8/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/alexei-vinn/d8/statuses/0c64e4766a675a4d77d09ff5c30ff07acd3747c5"}},"author_association":"OWNER"}}
{"actor":{"display_login":"alexei-vinn"}}