Skip to content

Commit

Permalink
Merge branch '5.x' into 6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Davidmattei committed Apr 9, 2024
2 parents 0e0e31f + 9de994f commit e102fea
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
{% endif %}
{%- endblock -%}

{%- block modified -%}<td data-order="{{ data.task_modified|date('U') }}">{{ data.task_modified -}}</td>{%- endblock -%}
{%- block modified -%}<td data-order="{{ data.task_modified|date('U') }}">{{ data.task_modified|date(date_time_format) -}}</td>{%- endblock -%}

{%- block actions -%}
<div class="btn-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace EMS\CoreBundle\DataTable\Type;

use EMS\CoreBundle\Core\DataTable\Type\AbstractEntityTableType;
use EMS\CoreBundle\Form\Data\DateTableColumn;
use EMS\CoreBundle\Form\Data\DatetimeTableColumn;
use EMS\CoreBundle\Form\Data\EntityTable;
use EMS\CoreBundle\Form\Data\TableAbstract;
Expand All @@ -27,7 +26,7 @@ public function build(EntityTable $table): void
$table->addColumn('form-submission.index.column.form', 'name');
$table->addColumn('form-submission.index.column.locale', 'locale');
$table->addColumnDefinition(new DatetimeTableColumn('form-submission.index.column.created', 'created'));
$table->addColumnDefinition(new DateTableColumn('form-submission.index.column.expire_date', 'expireDate'));
$table->addColumnDefinition(new DatetimeTableColumn('form-submission.index.column.expire_date', 'expireDate'));

$table->addItemGetAction('form.submissions.download', 'form-submission.form-submissions.download', 'download');
$table->addItemPostAction('form.submissions.process', 'form-submission.form-submissions.process', 'check', 'form-submission.form-submissions.confirm');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace Application\Migrations;

use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20240409120638 extends AbstractMigration
{
public function getDescription(): string
{
return 'Form submission change expire_date from date to datetime';
}

public function up(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof MySQLPlatform,
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQLPlatform'."
);

$this->addSql('ALTER TABLE form_submission CHANGE expire_date expire_date DATETIME DEFAULT NULL');
}

public function down(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof MySQLPlatform,
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQLPlatform'."
);

$this->addSql('ALTER TABLE form_submission CHANGE expire_date expire_date DATE DEFAULT NULL');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace Application\Migrations;

use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20240409120406 extends AbstractMigration
{
public function getDescription(): string
{
return 'Form submission change expire_date from date to datetime';
}

public function up(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform,
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQLPlatform'."
);

$this->addSql('ALTER TABLE form_submission ALTER expire_date TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
}

public function down(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform,
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQLPlatform'."
);

$this->addSql('ALTER TABLE form_submission ALTER expire_date TYPE DATE');
}
}
26 changes: 13 additions & 13 deletions EMS/core-bundle/src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<argument type="service" id="ems.repository.dashboard"/>
<argument type="service" id="logger"/>
<argument type="service" id="security.authorization_checker"/>
<tag name="emsco.entity.service" priority="10" />
<tag name="emsco.entity.service" priority="50" />
</service>
<service id="ems.form.field-type.manager" class="EMS\CoreBundle\Core\Form\FieldTypeManager">
<argument type="service" id="logger"/>
Expand All @@ -46,12 +46,12 @@
<service id="ems.form.manager" class="EMS\CoreBundle\Core\Form\FormManager">
<argument type="service" id="ems.repository.form"/>
<argument type="service" id="logger"/>
<tag name="emsco.entity.service" priority="48" />
<tag name="emsco.entity.service" priority="70" />
</service>
<service id="ems.service.channel" class="EMS\CoreBundle\Service\Channel\ChannelService">
<argument type="service" id="ems.repository.channel"/>
<argument type="service" id="logger"/>
<tag name="emsco.entity.service" priority="10" />
<tag name="emsco.entity.service" priority="40" />
</service>
<service id="ems.service.channel.register" class="EMS\CoreBundle\Service\Channel\ChannelRegistrar">
<argument type="service" id="ems.repository.channel"/>
Expand Down Expand Up @@ -111,7 +111,7 @@
<argument type="service" id="ems.repository.query_search"/>
<argument type="service" id="logger"/>
<argument type="service" id="ems.service.environment" />
<tag name="emsco.entity.service" priority="10" />
<tag name="emsco.entity.service" priority="30" />
</service>

<service id="ems.service.internationalization.xliff" alias="EMS\CoreBundle\Service\Internationalization\XliffService"/>
Expand Down Expand Up @@ -205,7 +205,7 @@
<service id="ems.schedule.manager" class="EMS\CoreBundle\Core\Job\ScheduleManager">
<argument type="service" id="ems.repository.schedule"/>
<argument type="service" id="logger"/>
<tag name="emsco.entity.service" priority="10" />
<tag name="emsco.entity.service" priority="20" />
</service>
<service id="EMS\CoreBundle\Core\Revision\Json\JsonMenuRenderer">
<argument type="service" id="twig"/>
Expand All @@ -229,11 +229,11 @@

<service id="emsco.helper.analyzer" class="EMS\CoreBundle\Core\Mapping\AnalyzerManager">
<argument type="service" id="ems.repository.analyzer"/>
<tag name="emsco.entity.service" priority="60" />
<tag name="emsco.entity.service" priority="120" />
</service>
<service id="emsco.helper.filter" class="EMS\CoreBundle\Core\Mapping\FilterManager">
<argument type="service" id="ems.repository.filter"/>
<tag name="emsco.entity.service" priority="60" />
<tag name="emsco.entity.service" priority="110" />
</service>
<service id="emsco.helper.entities" class="EMS\CoreBundle\Core\Entity\EntitiesHelper">
<argument type="tagged_iterator" tag="emsco.entity.service"/>
Expand Down Expand Up @@ -336,7 +336,7 @@
<argument type="service" id="logger" />
<argument type="service" id="ems_common.service.elastica" />
<argument>%ems_core.instance_id%</argument>
<tag name="emsco.entity.service" priority="59" />
<tag name="emsco.entity.service" priority="80" />
</service>
<service id="EMS\CoreBundle\Service\ContentTypeService">
<argument type="service" id="doctrine" />
Expand All @@ -349,7 +349,7 @@
<argument type="service" id="security.token_storage" />
<argument type="service" id="translator" />
<argument>%ems_core.circles_object%</argument>
<tag name="emsco.entity.service" priority="49" />
<tag name="emsco.entity.service" priority="60" />
</service>
<service id="ems.service.user" class="EMS\CoreBundle\Service\UserService">
<argument type="service" id="doctrine" />
Expand All @@ -363,7 +363,7 @@
<service id="ems.service.wysiwyg_profile" class="EMS\CoreBundle\Service\WysiwygProfileService">
<argument type="service" id="ems.repository.wysiwyg_profile"/>
<argument type="service" id="logger"/>
<tag name="emsco.entity.service" priority="10" />
<tag name="emsco.entity.service" priority="110" />
</service>
<service id="ems.service.aggregate_option" class="EMS\CoreBundle\Service\AggregateOptionService">
<argument type="service" id="doctrine"/>
Expand All @@ -383,7 +383,7 @@
<service id="ems.service.wysiwyg_styles_set" class="EMS\CoreBundle\Service\WysiwygStylesSetService">
<argument type="service" id="ems.repository.wysiwyg_style_set"/>
<argument type="service" id="logger"/>
<tag name="emsco.entity.service" priority="10" />
<tag name="emsco.entity.service" priority="100" />
</service>
<service id="ems.service.objectchoicecache" class="EMS\CoreBundle\Service\ObjectChoiceCacheService">
<argument type="service" id="logger"/>
Expand Down Expand Up @@ -421,7 +421,7 @@
</service>
<service id="EMS\CoreBundle\Service\I18nService" class="EMS\CoreBundle\Service\I18nService">
<argument type="service" id="ems.repository.i18n"/>
<tag name="emsco.entity.service" priority="10" />
<tag name="emsco.entity.service" priority="130" />
</service>
<service id="ems.service.rest_client" class="EMS\CoreBundle\Service\RestClientService" />
<service id="ems.service.asset_extractor" class="EMS\CoreBundle\Service\AssetExtractorService">
Expand Down Expand Up @@ -509,7 +509,7 @@
<service id="ems.managed_alias.manager" class="EMS\CoreBundle\Core\ManagedAlias\ManagedAliasManager">
<argument type="service" id="EMS\CoreBundle\Repository\ManagedAliasRepository" />
<argument>%ems_core.instance_id%</argument>
<tag name="emsco.entity.service" priority="58" />
<tag name="emsco.entity.service" priority="90" />
</service>

<!-- Aliases -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
{% endif %}
{%- endblock -%}

{%- block modified -%}<td data-order="{{ data.task_modified|date('U') }}">{{ data.task_modified -}}</td>{%- endblock -%}
{%- block modified -%}<td data-order="{{ data.task_modified|date('U') }}">{{ data.task_modified|date(date_time_format) -}}</td>{%- endblock -%}

{%- block actions -%}
<div class="btn-group">
Expand Down
5 changes: 3 additions & 2 deletions EMS/submission-bundle/src/Entity/FormSubmission.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public function toArray(): array
}

if ($this->files->count() > 0) {
$data['files'] = $this->files->toArray();
$files = $this->files->toArray();
$data['files'] = \array_map(static fn (FormSubmissionFile $f) => $f->toArray(), $files);
} else {
unset($data['files']);
}
Expand Down Expand Up @@ -127,7 +128,7 @@ public function getLabel(): ?string
return $this->label;
}

public function getExpireDate(): ?\DateTime
public function getExpireDate(): ?\DateTimeInterface
{
return $this->expireDate;
}
Expand Down
8 changes: 8 additions & 0 deletions EMS/submission-bundle/src/Entity/FormSubmissionFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ public function __construct(
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
return $this->toArray();
}

/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'id' => $this->id->toString(),
Expand Down
2 changes: 1 addition & 1 deletion EMS/submission-bundle/src/Request/DatabaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getLabel(): string
return $this->label;
}

public function getExpireDate(): ?\DateTime
public function getExpireDate(): ?\DateTimeInterface
{
return $this->expireDate ? \DateTime::createFromImmutable($this->expireDate) : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<field name="instance" length="255"/>
<field name="locale" length="2"/>
<field name="data" type="json" nullable="true"/>
<field name="expireDate" column="expire_date" type="date" nullable="true"/>
<field name="expireDate" column="expire_date" type="datetime" nullable="true"/>
<field name="label" length="255"/>
<field name="processTryCounter" column="process_try_counter" type="integer">
<options>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Application\Migrations;

use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

Expand Down
37 changes: 37 additions & 0 deletions elasticms-web/migrations/pdo_mysql/Version20240409121627.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20240409121627 extends AbstractMigration
{
public function getDescription(): string
{
return 'Form submission change expire_date from date to datetime';
}

public function up(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof MySQLPlatform,
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQLPlatform'."
);

$this->addSql('ALTER TABLE form_submission CHANGE expire_date expire_date DATETIME DEFAULT NULL');
}

public function down(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof MySQLPlatform,
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQLPlatform'."
);

$this->addSql('ALTER TABLE form_submission CHANGE expire_date expire_date DATE DEFAULT NULL');
}
}
37 changes: 37 additions & 0 deletions elasticms-web/migrations/pdo_pgsql/Version20240409121450.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20240409121450 extends AbstractMigration
{
public function getDescription(): string
{
return 'Form submission change expire_date from date to datetime';
}

public function up(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform,
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQLPlatform'."
);

$this->addSql('ALTER TABLE form_submission ALTER expire_date TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
}

public function down(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform,
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQLPlatform'."
);

$this->addSql('ALTER TABLE form_submission ALTER expire_date TYPE DATE');
}
}

0 comments on commit e102fea

Please sign in to comment.