Remove deprecation (Event).

This commit is contained in:
Pol Dellaiera 2021-05-06 21:24:57 +02:00
parent c019da9bcf
commit 92b6f4e206
3 changed files with 34 additions and 35 deletions

View File

@ -17,57 +17,57 @@
*/
namespace Chill\PersonBundle\Actions;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Event triggered when an entity attached to a person is removed.
*
*
*
*/
class ActionEvent extends Event
class ActionEvent implements Event
{
const DELETE = 'CHILL_PERSON.DELETE_ASSOCIATED_ENTITY';
const MOVE = 'CHILL_PERSON.MOVE_ASSOCIATED_ENTITY';
/**
*
* @var int
*/
protected $personId;
/**
* the FQDN class name as recorded in doctrine
*
* @var string
*/
protected $entity;
/**
* an array of key value data to describe the movement
*
* @var array
*/
protected $metadata;
/**
* the sql statement
*
* @var string
* @var string
*/
protected $sqlStatement;
/**
*
* @var string[]
*/
protected $preSql = [];
/**
*
* @var string[]
*/
protected $postSql = [];
public function __construct($personId, $entity, $sqlStatement, $metadata = [])
{
$this->personId = $personId;
@ -77,7 +77,7 @@ class ActionEvent extends Event
}
/**
*
*
* @return string[]
*/
public function getPreSql(): array
@ -86,7 +86,7 @@ class ActionEvent extends Event
}
/**
*
*
* @return string[]
*/
public function getPostSql(): array
@ -105,7 +105,7 @@ class ActionEvent extends Event
/**
* Add Sql which will be executed **after** the delete statement
*
*
* @param type $postSql
* @return $this
*/
@ -122,22 +122,22 @@ class ActionEvent extends Event
/**
* get the entity name, as recorded in doctrine
*
*
* @return string
*/
public function getEntity(): string
{
return $this->entity;
}
public function getSqlStatement()
{
return $this->sqlStatement;
}
public function getMetadata()
{
return $this->metadata;
}
}

View File

@ -22,11 +22,10 @@ namespace Chill\PersonBundle\Privacy;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Symfony\Component\EventDispatcher\Event;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Symfony\Contracts\EventDispatcher\Event;
class AccompanyingPeriodPrivacyEvent extends Event
class AccompanyingPeriodPrivacyEvent implements Event
{
public const ACCOMPANYING_PERIOD_PRIVACY_EVENT = 'chill_person.accompanying_period_privacy_event';

View File

@ -22,8 +22,8 @@ namespace Chill\PersonBundle\Privacy;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Symfony\Component\EventDispatcher\Event;
use Chill\PersonBundle\Entity\Person;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Class PrivacyEvent
@ -33,25 +33,25 @@ use Chill\PersonBundle\Entity\Person;
*
* @package Chill\PersonBundle\Privacy
*/
class PrivacyEvent extends Event
class PrivacyEvent implements Event
{
const PERSON_PRIVACY_EVENT = 'chill_person.privacy_event';
/**
* @var Person
*/
private $person;
/**
* @var array
*/
private $args;
/**
* @var array
*/
private $persons;
/**
* PrivacyEvent constructor.
*
@ -64,7 +64,7 @@ class PrivacyEvent extends Event
$this->args = $args;
$this->persons = array();
}
/**
* @return Person
*/
@ -72,17 +72,17 @@ class PrivacyEvent extends Event
{
return $this->person;
}
/**
* @param Person $person
*/
public function addPerson(Person $person)
{
$this->persons[] = $person;
return $this;
}
/**
* @return array $persons
*/
@ -90,7 +90,7 @@ class PrivacyEvent extends Event
{
return $this->persons;
}
/**
* @return bool
*/
@ -98,7 +98,7 @@ class PrivacyEvent extends Event
{
return count($this->persons) >= 1;
}
/**
* @return array
*/
@ -106,5 +106,5 @@ class PrivacyEvent extends Event
{
return $this->args;
}
}
}