mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,73 +1,61 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2016-2019 Champs-Libres <info@champs-libres.coop>
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Actions;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* Event triggered when an entity attached to a person is removed.
|
||||
*
|
||||
*
|
||||
*/
|
||||
class ActionEvent extends Event
|
||||
{
|
||||
const DELETE = 'CHILL_PERSON.DELETE_ASSOCIATED_ENTITY';
|
||||
const MOVE = 'CHILL_PERSON.MOVE_ASSOCIATED_ENTITY';
|
||||
|
||||
public const DELETE = 'CHILL_PERSON.DELETE_ASSOCIATED_ENTITY';
|
||||
|
||||
public const MOVE = 'CHILL_PERSON.MOVE_ASSOCIATED_ENTITY';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $personId;
|
||||
|
||||
/**
|
||||
* the FQDN class name as recorded in doctrine
|
||||
* the FQDN class name as recorded in doctrine.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $entity;
|
||||
|
||||
|
||||
/**
|
||||
* an array of key value data to describe the movement
|
||||
* an array of key value data to describe the movement.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $metadata;
|
||||
|
||||
|
||||
/**
|
||||
* the sql statement
|
||||
*
|
||||
* @var string
|
||||
* @var int
|
||||
*/
|
||||
protected $sqlStatement;
|
||||
|
||||
protected $personId;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $preSql = [];
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $postSql = [];
|
||||
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
protected $preSql = [];
|
||||
|
||||
/**
|
||||
* the sql statement.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sqlStatement;
|
||||
|
||||
public function __construct($personId, $entity, $sqlStatement, $metadata = [])
|
||||
{
|
||||
$this->personId = $personId;
|
||||
@@ -77,21 +65,17 @@ class ActionEvent extends Event
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string[]
|
||||
* Add Sql which will be executed **after** the delete statement.
|
||||
*
|
||||
* @param type $postSql
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function getPreSql(): array
|
||||
public function addPostSql(string $postSql)
|
||||
{
|
||||
return $this->preSql;
|
||||
}
|
||||
$this->postSql[] = $postSql;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getPostSql(): array
|
||||
{
|
||||
return $this->postSql;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -100,19 +84,21 @@ class ActionEvent extends Event
|
||||
public function addPreSql(string $preSql)
|
||||
{
|
||||
$this->preSql[] = $preSql;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Sql which will be executed **after** the delete statement
|
||||
*
|
||||
* @param type $postSql
|
||||
* @return $this
|
||||
* get the entity name, as recorded in doctrine.
|
||||
*/
|
||||
public function addPostSql(string $postSql)
|
||||
public function getEntity(): string
|
||||
{
|
||||
$this->postSql[] = $postSql;
|
||||
return $this;
|
||||
return $this->entity;
|
||||
}
|
||||
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
public function getPersonId(): int
|
||||
@@ -121,23 +107,23 @@ class ActionEvent extends Event
|
||||
}
|
||||
|
||||
/**
|
||||
* get the entity name, as recorded in doctrine
|
||||
*
|
||||
* @return string
|
||||
* @return string[]
|
||||
*/
|
||||
public function getEntity(): string
|
||||
public function getPostSql(): array
|
||||
{
|
||||
return $this->entity;
|
||||
return $this->postSql;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getPreSql(): array
|
||||
{
|
||||
return $this->preSql;
|
||||
}
|
||||
|
||||
public function getSqlStatement()
|
||||
{
|
||||
return $this->sqlStatement;
|
||||
}
|
||||
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user