2022-01-02 20:04:52 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types = 1);
|
|
|
|
|
|
|
|
namespace Component\Collection\Util\Controller;
|
|
|
|
|
|
|
|
use App\Core\Controller;
|
2022-01-03 20:37:22 +00:00
|
|
|
use App\Entity\Actor;
|
2022-10-19 22:39:17 +01:00
|
|
|
use App\Entity\Note;
|
2022-01-03 20:37:22 +00:00
|
|
|
use App\Util\Common;
|
2022-10-19 22:39:17 +01:00
|
|
|
use Component\Collection\Collection as CollectionComponent;
|
2022-01-02 20:04:52 +00:00
|
|
|
|
2022-10-19 22:39:17 +01:00
|
|
|
/**
|
|
|
|
* @template T
|
|
|
|
*/
|
2022-10-19 22:39:17 +01:00
|
|
|
abstract class Collection extends Controller
|
2022-01-02 20:04:52 +00:00
|
|
|
{
|
2022-10-19 22:39:17 +01:00
|
|
|
/**
|
|
|
|
* @param array<string, OrderByType> $note_order_by
|
|
|
|
* @param array<string, OrderByType> $actor_order_by
|
2022-10-19 22:39:17 +01:00
|
|
|
*
|
|
|
|
* @return array{notes: null|Note[], actors: null|Actor[]}
|
2022-10-19 22:39:17 +01:00
|
|
|
*/
|
2022-02-27 21:12:51 +00:00
|
|
|
public function query(string $query, ?string $locale = null, ?Actor $actor = null, array $note_order_by = [], array $actor_order_by = []): array
|
2022-01-02 23:59:23 +00:00
|
|
|
{
|
2022-01-04 21:58:49 +00:00
|
|
|
$actor ??= Common::actor();
|
2022-01-10 10:17:05 +00:00
|
|
|
$locale ??= Common::currentLanguage()->getLocale();
|
2022-10-19 22:39:17 +01:00
|
|
|
return CollectionComponent::query($query, $this->int('page') ?? 1, $locale, $actor, $note_order_by, $actor_order_by);
|
2022-01-02 23:59:23 +00:00
|
|
|
}
|
2022-01-02 20:04:52 +00:00
|
|
|
}
|