mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-25 00:53:48 +00:00
Merge branch 'master' into upgrade-sf5
This commit is contained in:
@@ -13,4 +13,6 @@ namespace Chill\ReportBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class ChillReportBundle extends Bundle {}
|
||||
class ChillReportBundle extends Bundle
|
||||
{
|
||||
}
|
||||
|
@@ -38,7 +38,8 @@ class ReportController extends AbstractController
|
||||
private readonly PaginatorFactory $paginator,
|
||||
private readonly TranslatorInterface $translator,
|
||||
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new report for a given person and of a given type.
|
||||
|
@@ -41,7 +41,7 @@ class Report implements HasCenterInterface, HasScopeInterface
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup")
|
||||
*/
|
||||
private ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $cFGroup = null;
|
||||
private ?CustomFieldsGroup $cFGroup = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
@@ -60,17 +60,17 @@ class Report implements HasCenterInterface, HasScopeInterface
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||
*/
|
||||
private ?\Chill\PersonBundle\Entity\Person $person = null;
|
||||
private ?Person $person = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
|
||||
*/
|
||||
private ?\Chill\MainBundle\Entity\Scope $scope = null;
|
||||
private ?Scope $scope = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||
*/
|
||||
private ?\Chill\MainBundle\Entity\User $user = null;
|
||||
private ?User $user = null;
|
||||
|
||||
/**
|
||||
* @return Center
|
||||
|
@@ -46,7 +46,9 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
|
||||
|
||||
protected array $slugs = [];
|
||||
|
||||
public function __construct(protected CustomFieldsGroup $customfieldsGroup, protected TranslatableStringHelper $translatableStringHelper, protected TranslatorInterface $translator, protected CustomFieldProvider $customFieldProvider, protected EntityManagerInterface $em) {}
|
||||
public function __construct(protected CustomFieldsGroup $customfieldsGroup, protected TranslatableStringHelper $translatableStringHelper, protected TranslatorInterface $translator, protected CustomFieldProvider $customFieldProvider, protected EntityManagerInterface $em)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
|
@@ -19,7 +19,9 @@ use Doctrine\ORM\Query\Expr;
|
||||
|
||||
class ReportDateFilter implements FilterInterface
|
||||
{
|
||||
public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {}
|
||||
public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
|
@@ -44,7 +44,9 @@ final class ReportVoterTest extends KernelTestCase
|
||||
*/
|
||||
protected $voter;
|
||||
|
||||
public static function setUpBeforeClass(): void {}
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
}
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
@@ -132,7 +134,7 @@ final class ReportVoterTest extends KernelTestCase
|
||||
Report $report,
|
||||
$action,
|
||||
$message,
|
||||
User $user = null
|
||||
?User $user = null
|
||||
) {
|
||||
$token = $this->prepareToken($user);
|
||||
$result = $this->voter->vote($token, $report, [$action]);
|
||||
@@ -159,7 +161,7 @@ final class ReportVoterTest extends KernelTestCase
|
||||
*
|
||||
* @return \Symfony\Component\Security\Core\Authentication\Token\TokenInterface
|
||||
*/
|
||||
protected function prepareToken(User $user = null)
|
||||
protected function prepareToken(?User $user = null)
|
||||
{
|
||||
$token = $this->prophet->prophesize();
|
||||
$token
|
||||
|
@@ -28,7 +28,7 @@ final class TimelineProviderTest extends WebTestCase
|
||||
{
|
||||
private static ?object $em = null;
|
||||
|
||||
private \Chill\PersonBundle\Entity\Person $person;
|
||||
private Person $person;
|
||||
|
||||
/**
|
||||
* @var Report
|
||||
|
@@ -25,7 +25,9 @@ use Symfony\Component\Security\Core\Security;
|
||||
*/
|
||||
class TimelineReportProvider implements TimelineProviderInterface
|
||||
{
|
||||
public function __construct(protected EntityManager $em, protected AuthorizationHelper $helper, private readonly Security $security, protected CustomFieldsHelper $customFieldsHelper, protected $showEmptyValues) {}
|
||||
public function __construct(protected EntityManager $em, protected AuthorizationHelper $helper, private readonly Security $security, protected CustomFieldsHelper $customFieldsHelper, protected $showEmptyValues)
|
||||
{
|
||||
}
|
||||
|
||||
public function fetchQuery($context, array $args)
|
||||
{
|
||||
|
@@ -32,7 +32,18 @@ class Version20141129012050 extends AbstractMigration
|
||||
$this->addSql('CREATE INDEX IDX_C38372B2217BBB47 ON Report (person_id);');
|
||||
$this->addSql('CREATE INDEX IDX_C38372B216D2C9F0 ON Report (cFGroup_id);');
|
||||
$this->addSql('ALTER TABLE Report ADD CONSTRAINT FK_C38372B2A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
$this->addSql('ALTER TABLE Report ADD CONSTRAINT FK_C38372B2217BBB47 FOREIGN KEY (person_id) REFERENCES Person (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
|
||||
// before adding fk constraint to person, check what is the table name
|
||||
$results = $this->connection->executeQuery('SELECT EXISTS (SELECT 1 FROM pg_tables WHERE tablename = \'chill_person_person\')');
|
||||
/** @var bool $isChillPersonPersonTable */
|
||||
$isChillPersonPersonTable = $results->fetchFirstColumn()[0];
|
||||
|
||||
if ($isChillPersonPersonTable) {
|
||||
$this->addSql('ALTER TABLE Report ADD CONSTRAINT FK_C38372B2217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
} else {
|
||||
$this->addSql('ALTER TABLE Report ADD CONSTRAINT FK_C38372B2217BBB47 FOREIGN KEY (person_id) REFERENCES Person (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
}
|
||||
|
||||
$this->addSql('ALTER TABLE Report ADD CONSTRAINT FK_C38372B216D2C9F0 FOREIGN KEY (cFGroup_id) REFERENCES CustomFieldsGroup (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
*/
|
||||
class Version20150622233319 extends AbstractMigration implements ContainerAwareInterface
|
||||
{
|
||||
private ?\Symfony\Component\DependencyInjection\ContainerInterface $container = null;
|
||||
private ?ContainerInterface $container = null;
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
@@ -37,7 +37,7 @@ class Version20150622233319 extends AbstractMigration implements ContainerAwareI
|
||||
$this->addSql('ALTER TABLE Report DROP scope_id');
|
||||
}
|
||||
|
||||
public function setContainer(ContainerInterface $container = null)
|
||||
public function setContainer(?ContainerInterface $container = null)
|
||||
{
|
||||
if (null === $container) {
|
||||
throw new \RuntimeException('Container is not provided. This migration need container to set a default center');
|
||||
|
Reference in New Issue
Block a user