{"action":"created","comment":{"url":"https://api.github.com/repos/FluidTYPO3/vhs/pulls/comments/36565659","id":36565659,"diff_hunk":"@@ -25,42 +26,91 @@ class FalViewHelper extends AbstractRecordResourceViewHelper {\n \tprotected $resourceFactory;\n \n \t/**\n+\t * @var |TYPO3\\CMS\\Core\\Resource\\FileRepository\n+\t */\n+\tprotected $fileRepository;\n+\n+\t/**\n \t * Constructor\n \t */\n \tpublic function __construct() {\n \t\t$this->resourceFactory = GeneralUtility::makeInstance('TYPO3\\\\CMS\\\\Core\\\\Resource\\\\ResourceFactory');\n+\t\t$this->fileRepository = GeneralUtility::makeInstance('TYPO3\\\\CMS\\\\Core\\\\Resource\\\\FileRepository');\n \t}\n \n \t/**\n \t * @param mixed $identity\n \t * @return mixed\n \t */\n-\tpublic function getResource($identity) {\n-\t\t$fileReference = $this->resourceFactory->getFileReferenceObject(intval($identity));\n+\tpublic function getResource($fileReference) {\n \t\t$file = $fileReference->getOriginalFile();\n \t\t$fileReferenceProperties = $fileReference->getProperties();\n \t\t$fileProperties = ResourceUtility::getFileArray($file);\n-\n \t\tArrayUtility::mergeRecursiveWithOverrule($fileProperties, $fileReferenceProperties, TRUE, FALSE, FALSE);\n \t\treturn $fileProperties;\n \t}\n \n+\tprotected function getFileReferences($table, $field,$tt_content) {\n+\t\t$uid = $tt_content; // content element uid\n+\t\t$fileObjects = $this->fileRepository->findByRelation($table, $field, $uid);\n+\t\treturn $fileObjects;\n+\t}\n+\n \t/**\n \t * @param array $record\n \t * @return array\n \t */\n \tpublic function getResources($record) {\n-\t\t$sqlTable = $GLOBALS['TYPO3_DB']->fullQuoteStr($this->getTable(), 'sys_file_reference');\n-\t\t$sqlField = $GLOBALS['TYPO3_DB']->fullQuoteStr($this->getField(), 'sys_file_reference');\n-\t\t$sqlRecordUid = $GLOBALS['TYPO3_DB']->fullQuoteStr($record[$this->idField], 'sys_file_reference');\n+\t\t$this->contentObj = $this->configurationManager->getContentObject();\n+\t\t$this->getDatabaseConnection = $GLOBALS['TYPO3_DB'];\n+\t\tif (isset($record['t3ver_oid']) && 0 != $record['t3ver_oid']) {\n+\t\t\t$sqlRecordUid = $record['t3ver_oid'];\n+\t\t} else {\n+\t\t\t$sqlRecordUid = $record[$this->idField];\n+\t\t}\n \n-\t\t$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'sys_file_reference', 'deleted = 0 AND hidden = 0 AND tablenames = ' . $sqlTable . ' AND fieldname = ' . $sqlField . ' AND uid_foreign = ' . $sqlRecordUid, '', 'sorting_foreign');\n \n+\t\tif (!empty($GLOBALS['TSFE']->sys_page)) {\n+\t\t\t$images = $this->getFileReferences($this->getTable(), $this->getField(), $sqlRecordUid);\n+\t\t} else {\n+\t\t\tif($GLOBALS['BE_USER']->workspaceRec['uid']) {\n+\t\t\t\t$ws = $GLOBALS['BE_USER']->workspaceRec['uid'];\n+\t\t\t\t$versionWhere = 'AND sys_file_reference.deleted=0 AND (sys_file_reference.t3ver_wsid=0 OR sys_file_reference.t3ver_wsid='.$ws.') AND sys_file_reference.pid<>-1';\n+\t\t\t} else {\n+\t\t\t\t$versionWhere = 'AND sys_file_reference.deleted=0 AND sys_file_reference.t3ver_state<=0 AND sys_file_reference.pid<>-1 AND sys_file_reference.hidden=0';\n+\t\t\t}\n+\t\t\t$references = $this->getDatabaseConnection->exec_SELECTgetRows(\n+\t\t\t\t\t'uid',\n+\t\t\t\t\t'sys_file_reference',\n+\t\t\t\t\t'tablenames=' . $this->getDatabaseConnection->fullQuoteStr($this->getTable(), 'sys_file_reference') .\n+\t\t\t\t\t' AND uid_foreign=' . (int)$sqlRecordUid .\n+\t\t\t\t\t' AND fieldname=' . $this->getDatabaseConnection->fullQuoteStr($this->getField(), 'sys_file_reference')\n+\t\t\t\t\t. $versionWhere,\n+\t\t\t\t\t'',\n+\t\t\t\t\t'sorting_foreign',\n+\t\t\t\t\t'',\n+\t\t\t\t\t'uid'\n+\t\t\t);\n+\t\t\tif (!empty($references)) {\n+\t\t\t\t$referenceUids = array_keys($references);\n+\t\t\t}\n+\t\t\tif (!empty($referenceUids)) {\n+\t\t\t\tforeach ($referenceUids as $referenceUid) {\n+\t\t\t\t\ttry {\n+\t\t\t\t\t\t// Just passing the reference uid, the factory is doing workspace\n+\t\t\t\t\t\t// overlays automatically depending on the current environment\n+\t\t\t\t\t\t$itemList[] = $this->resourceFactory->getFileReferenceObject($referenceUid);\n+\t\t\t\t\t} catch (ResourceDoesNotExistException $exception) {\n+\t\t\t\t\t\t// No handling, just omit the invalid reference uid\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\t$images = $itemList;","path":"Classes/ViewHelpers/Resource/Record/FalViewHelper.php","position":98,"original_position":98,"commit_id":"baeaa8b4d105530af50709132ffa964e70c01d28","original_commit_id":"baeaa8b4d105530af50709132ffa964e70c01d28","user":{"login":"xf-","id":1295633,"avatar_url":"https://avatars.githubusercontent.com/u/1295633?v=3","gravatar_id":"","url":"https://api.github.com/users/xf-","html_url":"https://github.com/xf-","followers_url":"https://api.github.com/users/xf-/followers","following_url":"https://api.github.com/users/xf-/following{/other_user}","gists_url":"https://api.github.com/users/xf-/gists{/gist_id}","starred_url":"https://api.github.com/users/xf-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xf-/subscriptions","organizations_url":"https://api.github.com/users/xf-/orgs","repos_url":"https://api.github.com/users/xf-/repos","events_url":"https://api.github.com/users/xf-/events{/privacy}","received_events_url":"https://api.github.com/users/xf-/received_events","type":"User","site_admin":false},"body":"$itemList not defined ","created_at":"2015-08-07T22:06:47Z","updated_at":"2015-08-07T22:06:47Z","html_url":"https://github.com/FluidTYPO3/vhs/pull/887#discussion_r36565659","pull_request_url":"https://api.github.com/repos/FluidTYPO3/vhs/pulls/887","_links":{"self":{"href":"https://api.github.com/repos/FluidTYPO3/vhs/pulls/comments/36565659"},"html":{"href":"https://github.com/FluidTYPO3/vhs/pull/887#discussion_r36565659"},"pull_request":{"href":"https://api.github.com/repos/FluidTYPO3/vhs/pulls/887"}}},"pull_request":{"url":"https://api.github.com/repos/FluidTYPO3/vhs/pulls/887","id":41914242,"html_url":"https://github.com/FluidTYPO3/vhs/pull/887","diff_url":"https://github.com/FluidTYPO3/vhs/pull/887.diff","patch_url":"https://github.com/FluidTYPO3/vhs/pull/887.patch","issue_url":"https://api.github.com/repos/FluidTYPO3/vhs/issues/887","number":887,"state":"open","locked":false,"title":"Fixes Workspaces Bug with Fal Resource","user":{"login":"Marc-Bauer","id":8803949,"avatar_url":"https://avatars.githubusercontent.com/u/8803949?v=3","gravatar_id":"","url":"https://api.github.com/users/Marc-Bauer","html_url":"https://github.com/Marc-Bauer","followers_url":"https://api.github.com/users/Marc-Bauer/followers","following_url":"https://api.github.com/users/Marc-Bauer/following{/other_user}","gists_url":"https://api.github.com/users/Marc-Bauer/gists{/gist_id}","starred_url":"https://api.github.com/users/Marc-Bauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Marc-Bauer/subscriptions","organizations_url":"https://api.github.com/users/Marc-Bauer/orgs","repos_url":"https://api.github.com/users/Marc-Bauer/repos","events_url":"https://api.github.com/users/Marc-Bauer/events{/privacy}","received_events_url":"https://api.github.com/users/Marc-Bauer/received_events","type":"User","site_admin":false},"body":"#817 ","created_at":"2015-08-07T17:25:04Z","updated_at":"2015-08-07T22:06:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c60b931ff660d5751540cda5ee3c602e3f40db4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/FluidTYPO3/vhs/pulls/887/commits","review_comments_url":"https://api.github.com/repos/FluidTYPO3/vhs/pulls/887/comments","review_comment_url":"https://api.github.com/repos/FluidTYPO3/vhs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FluidTYPO3/vhs/issues/887/comments","statuses_url":"https://api.github.com/repos/FluidTYPO3/vhs/statuses/baeaa8b4d105530af50709132ffa964e70c01d28","head":{"label":"Marc-Bauer:development","ref":"development","sha":"baeaa8b4d105530af50709132ffa964e70c01d28","user":{"login":"Marc-Bauer","id":8803949,"avatar_url":"https://avatars.githubusercontent.com/u/8803949?v=3","gravatar_id":"","url":"https://api.github.com/users/Marc-Bauer","html_url":"https://github.com/Marc-Bauer","followers_url":"https://api.github.com/users/Marc-Bauer/followers","following_url":"https://api.github.com/users/Marc-Bauer/following{/other_user}","gists_url":"https://api.github.com/users/Marc-Bauer/gists{/gist_id}","starred_url":"https://api.github.com/users/Marc-Bauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Marc-Bauer/subscriptions","organizations_url":"https://api.github.com/users/Marc-Bauer/orgs","repos_url":"https://api.github.com/users/Marc-Bauer/repos","events_url":"https://api.github.com/users/Marc-Bauer/events{/privacy}","received_events_url":"https://api.github.com/users/Marc-Bauer/received_events","type":"User","site_admin":false},"repo":{"id":40371404,"name":"vhs","full_name":"Marc-Bauer/vhs","owner":{"login":"Marc-Bauer","id":8803949,"avatar_url":"https://avatars.githubusercontent.com/u/8803949?v=3","gravatar_id":"","url":"https://api.github.com/users/Marc-Bauer","html_url":"https://github.com/Marc-Bauer","followers_url":"https://api.github.com/users/Marc-Bauer/followers","following_url":"https://api.github.com/users/Marc-Bauer/following{/other_user}","gists_url":"https://api.github.com/users/Marc-Bauer/gists{/gist_id}","starred_url":"https://api.github.com/users/Marc-Bauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Marc-Bauer/subscriptions","organizations_url":"https://api.github.com/users/Marc-Bauer/orgs","repos_url":"https://api.github.com/users/Marc-Bauer/repos","events_url":"https://api.github.com/users/Marc-Bauer/events{/privacy}","received_events_url":"https://api.github.com/users/Marc-Bauer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Marc-Bauer/vhs","description":"TYPO3 extension VHS: Fluid ViewHelpers","fork":true,"url":"https://api.github.com/repos/Marc-Bauer/vhs","forks_url":"https://api.github.com/repos/Marc-Bauer/vhs/forks","keys_url":"https://api.github.com/repos/Marc-Bauer/vhs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Marc-Bauer/vhs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Marc-Bauer/vhs/teams","hooks_url":"https://api.github.com/repos/Marc-Bauer/vhs/hooks","issue_events_url":"https://api.github.com/repos/Marc-Bauer/vhs/issues/events{/number}","events_url":"https://api.github.com/repos/Marc-Bauer/vhs/events","assignees_url":"https://api.github.com/repos/Marc-Bauer/vhs/assignees{/user}","branches_url":"https://api.github.com/repos/Marc-Bauer/vhs/branches{/branch}","tags_url":"https://api.github.com/repos/Marc-Bauer/vhs/tags","blobs_url":"https://api.github.com/repos/Marc-Bauer/vhs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Marc-Bauer/vhs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Marc-Bauer/vhs/git/refs{/sha}","trees_url":"https://api.github.com/repos/Marc-Bauer/vhs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Marc-Bauer/vhs/statuses/{sha}","languages_url":"https://api.github.com/repos/Marc-Bauer/vhs/languages","stargazers_url":"https://api.github.com/repos/Marc-Bauer/vhs/stargazers","contributors_url":"https://api.github.com/repos/Marc-Bauer/vhs/contributors","subscribers_url":"https://api.github.com/repos/Marc-Bauer/vhs/subscribers","subscription_url":"https://api.github.com/repos/Marc-Bauer/vhs/subscription","commits_url":"https://api.github.com/repos/Marc-Bauer/vhs/commits{/sha}","git_commits_url":"https://api.github.com/repos/Marc-Bauer/vhs/git/commits{/sha}","comments_url":"https://api.github.com/repos/Marc-Bauer/vhs/comments{/number}","issue_comment_url":"https://api.github.com/repos/Marc-Bauer/vhs/issues/comments{/number}","contents_url":"https://api.github.com/repos/Marc-Bauer/vhs/contents/{+path}","compare_url":"https://api.github.com/repos/Marc-Bauer/vhs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Marc-Bauer/vhs/merges","archive_url":"https://api.github.com/repos/Marc-Bauer/vhs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Marc-Bauer/vhs/downloads","issues_url":"https://api.github.com/repos/Marc-Bauer/vhs/issues{/number}","pulls_url":"https://api.github.com/repos/Marc-Bauer/vhs/pulls{/number}","milestones_url":"https://api.github.com/repos/Marc-Bauer/vhs/milestones{/number}","notifications_url":"https://api.github.com/repos/Marc-Bauer/vhs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Marc-Bauer/vhs/labels{/name}","releases_url":"https://api.github.com/repos/Marc-Bauer/vhs/releases{/id}","created_at":"2015-08-07T17:02:41Z","updated_at":"2015-08-07T17:02:42Z","pushed_at":"2015-08-07T17:21:10Z","git_url":"git://github.com/Marc-Bauer/vhs.git","ssh_url":"git@github.com:Marc-Bauer/vhs.git","clone_url":"https://github.com/Marc-Bauer/vhs.git","svn_url":"https://github.com/Marc-Bauer/vhs","homepage":"http://fluidtypo3.org","size":17478,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"development"}},"base":{"label":"FluidTYPO3:development","ref":"development","sha":"f6ba7fc5215a6da96f23fc71c00f54aaca4734a3","user":{"login":"FluidTYPO3","id":3912401,"avatar_url":"https://avatars.githubusercontent.com/u/3912401?v=3","gravatar_id":"","url":"https://api.github.com/users/FluidTYPO3","html_url":"https://github.com/FluidTYPO3","followers_url":"https://api.github.com/users/FluidTYPO3/followers","following_url":"https://api.github.com/users/FluidTYPO3/following{/other_user}","gists_url":"https://api.github.com/users/FluidTYPO3/gists{/gist_id}","starred_url":"https://api.github.com/users/FluidTYPO3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FluidTYPO3/subscriptions","organizations_url":"https://api.github.com/users/FluidTYPO3/orgs","repos_url":"https://api.github.com/users/FluidTYPO3/repos","events_url":"https://api.github.com/users/FluidTYPO3/events{/privacy}","received_events_url":"https://api.github.com/users/FluidTYPO3/received_events","type":"Organization","site_admin":false},"repo":{"id":6505090,"name":"vhs","full_name":"FluidTYPO3/vhs","owner":{"login":"FluidTYPO3","id":3912401,"avatar_url":"https://avatars.githubusercontent.com/u/3912401?v=3","gravatar_id":"","url":"https://api.github.com/users/FluidTYPO3","html_url":"https://github.com/FluidTYPO3","followers_url":"https://api.github.com/users/FluidTYPO3/followers","following_url":"https://api.github.com/users/FluidTYPO3/following{/other_user}","gists_url":"https://api.github.com/users/FluidTYPO3/gists{/gist_id}","starred_url":"https://api.github.com/users/FluidTYPO3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FluidTYPO3/subscriptions","organizations_url":"https://api.github.com/users/FluidTYPO3/orgs","repos_url":"https://api.github.com/users/FluidTYPO3/repos","events_url":"https://api.github.com/users/FluidTYPO3/events{/privacy}","received_events_url":"https://api.github.com/users/FluidTYPO3/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FluidTYPO3/vhs","description":"TYPO3 extension VHS: Fluid ViewHelpers","fork":false,"url":"https://api.github.com/repos/FluidTYPO3/vhs","forks_url":"https://api.github.com/repos/FluidTYPO3/vhs/forks","keys_url":"https://api.github.com/repos/FluidTYPO3/vhs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FluidTYPO3/vhs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FluidTYPO3/vhs/teams","hooks_url":"https://api.github.com/repos/FluidTYPO3/vhs/hooks","issue_events_url":"https://api.github.com/repos/FluidTYPO3/vhs/issues/events{/number}","events_url":"https://api.github.com/repos/FluidTYPO3/vhs/events","assignees_url":"https://api.github.com/repos/FluidTYPO3/vhs/assignees{/user}","branches_url":"https://api.github.com/repos/FluidTYPO3/vhs/branches{/branch}","tags_url":"https://api.github.com/repos/FluidTYPO3/vhs/tags","blobs_url":"https://api.github.com/repos/FluidTYPO3/vhs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FluidTYPO3/vhs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FluidTYPO3/vhs/git/refs{/sha}","trees_url":"https://api.github.com/repos/FluidTYPO3/vhs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FluidTYPO3/vhs/statuses/{sha}","languages_url":"https://api.github.com/repos/FluidTYPO3/vhs/languages","stargazers_url":"https://api.github.com/repos/FluidTYPO3/vhs/stargazers","contributors_url":"https://api.github.com/repos/FluidTYPO3/vhs/contributors","subscribers_url":"https://api.github.com/repos/FluidTYPO3/vhs/subscribers","subscription_url":"https://api.github.com/repos/FluidTYPO3/vhs/subscription","commits_url":"https://api.github.com/repos/FluidTYPO3/vhs/commits{/sha}","git_commits_url":"https://api.github.com/repos/FluidTYPO3/vhs/git/commits{/sha}","comments_url":"https://api.github.com/repos/FluidTYPO3/vhs/comments{/number}","issue_comment_url":"https://api.github.com/repos/FluidTYPO3/vhs/issues/comments{/number}","contents_url":"https://api.github.com/repos/FluidTYPO3/vhs/contents/{+path}","compare_url":"https://api.github.com/repos/FluidTYPO3/vhs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FluidTYPO3/vhs/merges","archive_url":"https://api.github.com/repos/FluidTYPO3/vhs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FluidTYPO3/vhs/downloads","issues_url":"https://api.github.com/repos/FluidTYPO3/vhs/issues{/number}","pulls_url":"https://api.github.com/repos/FluidTYPO3/vhs/pulls{/number}","milestones_url":"https://api.github.com/repos/FluidTYPO3/vhs/milestones{/number}","notifications_url":"https://api.github.com/repos/FluidTYPO3/vhs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FluidTYPO3/vhs/labels{/name}","releases_url":"https://api.github.com/repos/FluidTYPO3/vhs/releases{/id}","created_at":"2012-11-02T11:19:14Z","updated_at":"2015-08-05T15:01:13Z","pushed_at":"2015-08-07T17:25:05Z","git_url":"git://github.com/FluidTYPO3/vhs.git","ssh_url":"git@github.com:FluidTYPO3/vhs.git","clone_url":"https://github.com/FluidTYPO3/vhs.git","svn_url":"https://github.com/FluidTYPO3/vhs","homepage":"http://fluidtypo3.org","size":17478,"stargazers_count":85,"watchers_count":85,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":107,"mirror_url":null,"open_issues_count":14,"forks":107,"open_issues":14,"watchers":85,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/FluidTYPO3/vhs/pulls/887"},"html":{"href":"https://github.com/FluidTYPO3/vhs/pull/887"},"issue":{"href":"https://api.github.com/repos/FluidTYPO3/vhs/issues/887"},"comments":{"href":"https://api.github.com/repos/FluidTYPO3/vhs/issues/887/comments"},"review_comments":{"href":"https://api.github.com/repos/FluidTYPO3/vhs/pulls/887/comments"},"review_comment":{"href":"https://api.github.com/repos/FluidTYPO3/vhs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FluidTYPO3/vhs/pulls/887/commits"},"statuses":{"href":"https://api.github.com/repos/FluidTYPO3/vhs/statuses/baeaa8b4d105530af50709132ffa964e70c01d28"}}}}