mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-23 23: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)
|
protected function getContentElementImages($uidOfContentElement)
|
||||||
{
|
{
|
||||||
$imageRelationUids = [];
|
return $this->fetchSysFileReferenceUids($uidOfContentElement, 'tt_content', 'image');
|
||||||
$imageRelations = $this->fileRepository->findByRelation(
|
|
||||||
'tt_content',
|
|
||||||
'image',
|
|
||||||
$uidOfContentElement
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($imageRelations as $relation) {
|
|
||||||
$imageRelationUids[] = $relation->getUid();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $imageRelationUids;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,13 +132,20 @@ class PagesIndexer extends TcaIndexer
|
||||||
* @return []
|
* @return []
|
||||||
*/
|
*/
|
||||||
protected function fetchMediaForPage($uid)
|
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 = [];
|
$imageRelationUids = [];
|
||||||
$imageRelations = $this->fileRepository->findByRelation(
|
$imageRelations = $this->fileRepository->findByRelation($tablename, $fieldname, $uid);
|
||||||
'pages',
|
|
||||||
'media',
|
|
||||||
$uid
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($imageRelations as $relation) {
|
foreach ($imageRelations as $relation) {
|
||||||
$imageRelationUids[] = $relation->getUid();
|
$imageRelationUids[] = $relation->getUid();
|
||||||
|
|
Loading…
Reference in a new issue