mirror of
https://github.com/Codappix/search_core.git
synced 2024-12-25 20:56:11 +01:00
TASK: Refactor common code base
This commit is contained in:
parent
6423f510e2
commit
a998f155c1
1 changed files with 13 additions and 17 deletions
|
@ -124,18 +124,7 @@ class PagesIndexer extends TcaIndexer
|
|||
*/
|
||||
protected function getContentElementImages($uidOfContentElement)
|
||||
{
|
||||
$imageRelationUids = [];
|
||||
$imageRelations = $this->fileRepository->findByRelation(
|
||||
'tt_content',
|
||||
'image',
|
||||
$uidOfContentElement
|
||||
);
|
||||
|
||||
foreach ($imageRelations as $relation) {
|
||||
$imageRelationUids[] = $relation->getUid();
|
||||
}
|
||||
|
||||
return $imageRelationUids;
|
||||
return $this->fetchSysFileReferenceUids($uidOfContentElement, 'tt_content', 'image');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -143,13 +132,20 @@ class PagesIndexer extends TcaIndexer
|
|||
* @return []
|
||||
*/
|
||||
protected function fetchMediaForPage($uid)
|
||||
{
|
||||
return $this->fetchSysFileReferenceUids($uid, 'pages', 'media');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $uid
|
||||
* @param string $tablename
|
||||
* @param string $fieldname
|
||||
* @return []
|
||||
*/
|
||||
protected function fetchSysFileReferenceUids($uid, $tablename, $fieldname)
|
||||
{
|
||||
$imageRelationUids = [];
|
||||
$imageRelations = $this->fileRepository->findByRelation(
|
||||
'pages',
|
||||
'media',
|
||||
$uid
|
||||
);
|
||||
$imageRelations = $this->fileRepository->findByRelation($tablename, $fieldname, $uid);
|
||||
|
||||
foreach ($imageRelations as $relation) {
|
||||
$imageRelationUids[] = $relation->getUid();
|
||||
|
|
Loading…
Reference in a new issue