Renamed TagWillBeSaved => Saving. Deprecated the old event. (#92)

This commit is contained in:
Rafael Horvat 2020-10-02 18:55:25 +02:00 committed by GitHub
parent 48afda2422
commit 1f0b87fede
3 changed files with 50 additions and 0 deletions

View File

@ -9,6 +9,7 @@
namespace Flarum\Tags\Command;
use Flarum\Tags\Event\Saving;
use Flarum\Tags\Event\TagWillBeSaved;
use Flarum\Tags\TagRepository;
use Flarum\Tags\TagValidator;
@ -80,6 +81,9 @@ class EditTagHandler
$tag->is_restricted = (bool) $attributes['isRestricted'];
}
event(new Saving($tag, $actor, $data));
// Deprecated BC layer, remove in beta 15.
event(new TagWillBeSaved($tag, $actor, $data));
$this->validator->assertValid($tag->getDirty());

View File

@ -0,0 +1,43 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Tags\Event;
use Flarum\Tags\Tag;
use Flarum\User\User;
class Saving
{
/**
* @var Tag
*/
public $tag;
/**
* @var User
*/
public $actor;
/**
* @var array
*/
public $data;
/**
* @param Tag $tag
* @param User $actor
* @param array $data
*/
public function __construct(Tag $tag, User $actor, array $data)
{
$this->tag = $tag;
$this->actor = $actor;
$this->data = $data;
}
}

View File

@ -12,6 +12,9 @@ namespace Flarum\Tags\Event;
use Flarum\Tags\Tag;
use Flarum\User\User;
/**
* @deprecated beta 14, removed beta 15.
*/
class TagWillBeSaved
{
/**