<?php
namespace App\Repository;

use Doctrine\ORM\EntityRepository;
use App\Entity\ActorEntity;

/**
 * Repository for workspaces
 */
class ActorRepository extends EntityRepository
{

    /** @var array Default sorting */
    public const DEFAULT_ORDER = [
        'followed' => 'desc',
        'active' => 'desc',
        'firstName' => 'asc',
        'lastName' => 'asc'
    ];

    /**
     * {@inheritdoc}
     */
    public function findAll($onlyActive = false): array
    {
        $critera = [];
        if ($onlyActive) {
            $critera['active'] = True;
        }
        return $this->findBy($critera, ActorRepository::DEFAULT_ORDER);
    }

    /**
     * {@inheritdoc}
     */
    public function find($id, $lockMode = null, $lockVersion = null): ?ActorEntity
    {
        return parent::find($id, $lockMode = null, $lockVersion = null);
    }
}