Ported UsersRenamedEvent, UserSubscribersUpdatedEvent.

This commit is contained in:
Alexey Skobkin 2023-03-19 19:20:12 +03:00
parent 405b8a9f59
commit 64855c5076
No known key found for this signature in database
GPG key ID: 5D5CEF6F221278E7
4 changed files with 44 additions and 102 deletions

View file

@ -1,65 +0,0 @@
<?php
namespace src\PointToolsBundle\Event;
use src\PointToolsBundle\Entity\User;
use Symfony\Component\EventDispatcher\Event;
/**
* Dispatched when user subscribers list was changed
*/
class UserSubscribersUpdatedEvent extends Event
{
const NAME = 'app.user.subscribers_updated';
/**
* @var User
*/
private $user;
/**
* @var User[]
*/
private $subscribed;
/**
* @var User[]
*/
private $unsubscribed;
/**
* @param User $user
* @param User[] $subscribed
* @param User[] $unsubscribed
*/
public function __construct(User $user, array $subscribed, array $unsubscribed)
{
$this->user = $user;
$this->subscribed = $subscribed;
$this->unsubscribed = $unsubscribed;
}
/**
* @return User
*/
public function getUser(): User
{
return $this->user;
}
/**
* @return User[]
*/
public function getSubscribedUsers(): array
{
return $this->subscribed;
}
/**
* @return User[]
*/
public function getUnsubscribedUsers(): array
{
return $this->unsubscribed;
}
}

View file

@ -1,37 +0,0 @@
<?php
namespace src\PointToolsBundle\Event;
use src\PointToolsBundle\Entity\UserRenameEvent;
use Symfony\Component\EventDispatcher\Event;
/**
* Dispatched when one or more users were renamed
*/
class UsersRenamedEvent extends Event
{
const NAME = 'app.users.renamed';
/**
* @var UserRenameEvent[]
*/
private $renames;
/**
* UsersRenamedEvent constructor.
*
* @param UserRenameEvent[] $renames
*/
public function __construct(array $renames)
{
$this->renames = $renames;
}
/**
* @return UserRenameEvent[]
*/
public function getRenames(): array
{
return $this->renames;
}
}

View file

@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace App\Event;
use App\Entity\User;
use Symfony\Contracts\EventDispatcher\Event;
/** Dispatched when user subscribers list was changed */
class UserSubscribersUpdatedEvent extends Event
{
const NAME = 'app.user.subscribers_updated';
/**
* @param User $user
* @param User[] $subscribed
* @param User[] $unsubscribed
*/
public function __construct(
public readonly User $user,
public readonly array $subscribed,
public readonly array $unsubscribed
) {
}
}

View file

@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace App\Event;
use App\Entity\UserRenameEvent;
use Symfony\Contracts\EventDispatcher\Event;
/** Dispatched when one or more users were renamed */
class UsersRenamedEvent extends Event
{
const NAME = 'app.users.renamed';
/** @param UserRenameEvent[] $renames */
public function __construct(
public readonly array $renames
) {
}
}