mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,18 +1,26 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Check if each person do not have multiple addresses with the same valideFrom
|
||||
* Check if each person do not have multiple addresses with the same valideFrom.
|
||||
*/
|
||||
class Version20160422000000 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$stmt = $this->connection->query('SELECT COUNT(*), pe.id, ad.validfrom FROM person AS pe
|
||||
@@ -20,23 +28,16 @@ class Version20160422000000 extends AbstractMigration
|
||||
INNER JOIN chill_main_address AS ad ON ad.id = pe_ad.address_id
|
||||
GROUP BY pe.id, ad.validfrom
|
||||
HAVING COUNT(*) > 1');
|
||||
|
||||
|
||||
$personWithTwoAddressWithSameValidFrom = $stmt->fetchAll();
|
||||
|
||||
|
||||
foreach ($personWithTwoAddressWithSameValidFrom as $p) {
|
||||
$this->warnIf(true, 'The person with id '.$p['id'].' has two adresses with the same validFrom date');
|
||||
$this->warnIf(true, 'The person with id ' . $p['id'] . ' has two adresses with the same validFrom date');
|
||||
}
|
||||
|
||||
|
||||
$this->abortIf(
|
||||
sizeof($personWithTwoAddressWithSameValidFrom) != 0,
|
||||
'There exists some person with multiple adress with the same validFrom'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user