WIP: Symfony 6 project remake #2
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
25
src/Event/UserSubscribersUpdatedEvent.php
Normal file
25
src/Event/UserSubscribersUpdatedEvent.php
Normal 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
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
19
src/Event/UsersRenamedEvent.php
Normal file
19
src/Event/UsersRenamedEvent.php
Normal 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
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue