<?php
declare(strict_types = 1);

namespace Wga\WgaFaq\Domain\Repository;

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;
use TYPO3\CMS\Extbase\Persistence\Repository;

/**
 * Repository for faq objects
 */
class FaqRepository extends Repository
{
    /**
     * @param $ids
     * @param $limit
     * @return object[]|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
     */
    public function findAllRecords($ids, $limit)
    {
        $query = $this->createQuery();
        $query->getQuerySettings()->setStoragePageIds(explode(',', $ids));
        if ($limit >= 1) {
            $query->setLimit($limit)->getQuerySettings()->setStoragePageIds(explode(',', $ids));
        }

        return $query->execute();
    }
}
