View file MMO-Hide-2.3.4/upload/src/addons/MMO/Hide/Repository/Reaction.php

File size: 778B
<?php

namespace MMO\Hide\Repository;

use XF\Finder\ReactionFinder;
use XF\Mvc\Entity\Finder;
use XF\Mvc\Entity\Repository;

class Reaction extends Repository
{
    /**
     * @param bool $activeOnly
     * @return Finder
     */
    public function findReactionsForList(bool $activeOnly = false): Finder
    {
        $finder = $this->finder(ReactionFinder::class)
            ->order('display_order');

        if ($activeOnly)
        {
            $finder->where('active', 1);
        }

        return $finder;
    }

    /**
     * @return array|\XF\Mvc\Entity\ArrayCollection
     */
    public function getReactionTitlePairs()
    {
        return $this->findReactionsForList(true)->fetch()->pluckNamed('title', 'reaction_id');
    }
}