Update Models\Poll

This commit is contained in:
Visman 2021-12-02 22:43:20 +07:00
parent 0e72ea4db1
commit 1f657fb4cf
7 changed files with 32 additions and 20 deletions

View file

@ -12,9 +12,9 @@ namespace ForkBB\Models\Poll;
use ForkBB\Models\Action;
use ForkBB\Models\DataModel;
use ForkBB\Models\Forum\Model as Forum;
use ForkBB\Models\Poll\Model as Poll;
use ForkBB\Models\Topic\Model as Topic;
use ForkBB\Models\Forum\Forum;
use ForkBB\Models\Poll\Poll;
use ForkBB\Models\Topic\Topic;
use InvalidArgumentException;
use RuntimeException;

View file

@ -11,7 +11,7 @@ declare(strict_types=1);
namespace ForkBB\Models\Poll;
use ForkBB\Models\Action;
use ForkBB\Models\Poll\Model as Poll;
use ForkBB\Models\Poll\Poll;
use InvalidArgumentException;
class Load extends Action

View file

@ -12,15 +12,21 @@ namespace ForkBB\Models\Poll;
use ForkBB\Core\Container;
use ForkBB\Models\DataModel;
use ForkBB\Models\Topic\Model as Topic;
use ForkBB\Models\Topic\Topic;
use PDO;
use RuntimeException;
use function \ForkBB\__;
class Model extends DataModel
class Poll extends DataModel
{
const JSON_OPTIONS = \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE | \JSON_THROW_ON_ERROR;
/**
* Ключ модели для контейнера
* @var string
*/
protected $cKey = 'Poll';
/**
* Возвращает родительскую тему
*/

View file

@ -10,12 +10,18 @@ declare(strict_types=1);
namespace ForkBB\Models\Poll;
use ForkBB\Models\ManagerModel;
use ForkBB\Models\Poll\Model as Poll;
use ForkBB\Models\Manager;
use ForkBB\Models\Poll\Poll;
use RuntimeException;
class Manager extends ManagerModel
class Polls extends Manager
{
/**
* Ключ модели для контейнера
* @var string
*/
protected $cKey = 'Polls';
/**
* Создает новый опрос
*/
@ -79,7 +85,7 @@ class Manager extends ManagerModel
/**
* Сбрасывает кеш указанного голосования
*/
public function reset(int $id): Manager
public function reset(int $id): Polls
{
if (true !== $this->c->Cache->delete("poll{$id}")) {
throw new RuntimeException("Unable to remove key from cache - poll{$id}");

View file

@ -11,7 +11,7 @@ declare(strict_types=1);
namespace ForkBB\Models\Poll;
use ForkBB\Models\Action;
use ForkBB\Models\Poll\Model as Poll;
use ForkBB\Models\Poll\Poll;
use InvalidArgumentException;
use function \ForkBB\__;

View file

@ -11,8 +11,8 @@ declare(strict_types=1);
namespace ForkBB\Models\Poll;
use ForkBB\Models\Action;
use ForkBB\Models\Poll\Model as Poll;
use ForkBB\Models\Topic\Model as Topic;
use ForkBB\Models\Poll\Poll;
use ForkBB\Models\Topic\Topic;
use RuntimeException;
class Save extends Action

View file

@ -141,7 +141,7 @@ return [
'forums' => '@ForumManager:init',
'topics' => \ForkBB\Models\Topic\Manager::class,
'posts' => \ForkBB\Models\Post\Manager::class,
'polls' => \ForkBB\Models\Poll\Manager::class,
'polls' => \ForkBB\Models\Poll\Polls::class,
'reports' => \ForkBB\Models\Report\Manager::class,
'user' => '@users:current',
'userRules' => '@UsersRules:init',
@ -187,11 +187,6 @@ return [
'ProfileRules' => \ForkBB\Models\Rules\Profile::class,
'UsersRules' => \ForkBB\Models\Rules\Users::class,
'PollManagerLoad' => \ForkBB\Models\Poll\Load::class,
'PollManagerSave' => \ForkBB\Models\Poll\Save::class,
'PollManagerDelete' => \ForkBB\Models\Poll\Delete::class,
'PollManagerRevision' => \ForkBB\Models\Poll\Revision::class,
'SubscriptionModelSend' => \ForkBB\Models\Subscription\Send::class,
'BanList*check' => \ForkBB\Models\BanList\Check::class,
@ -250,6 +245,11 @@ return [
'PTopic*CalcStat' => \ForkBB\Models\PM\CalcStat::class,
'Polls&delete' => \ForkBB\Models\Poll\Delete::class,
'Polls&load' => \ForkBB\Models\Poll\Load::class,
'Polls&revision' => \ForkBB\Models\Poll\Revision::class,
'Polls&save' => \ForkBB\Models\Poll\Save::class,
'UserManagerNormUsername' => \ForkBB\Models\User\NormUsername::class,
],
'multiple' => [
@ -377,7 +377,7 @@ return [
'PostManagerFeed' => \ForkBB\Models\Post\Feed::class,
'PostManagerUpdateUsername' => \ForkBB\Models\Post\UpdateUsername::class,
'PollModel' => \ForkBB\Models\Poll\Model::class,
'PollModel' => \ForkBB\Models\Poll\Poll::class,
'ReportModel' => \ForkBB\Models\Report\Model::class,
'ReportManagerSave' => \ForkBB\Models\Report\Save::class,