Skip to content
Snippets Groups Projects
Commit 1eed2e19 authored by sebastien dupuy's avatar sebastien dupuy
Browse files

ajout des sous traitants pour une violation ok

parent ae39f56b
No related branches found
No related tags found
No related merge requests found
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221223094240 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE contractor_violation (violation_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', contractor_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_D2E7389E7386118A (violation_id), INDEX IDX_D2E7389EB0265DC7 (contractor_id), PRIMARY KEY(violation_id, contractor_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE contractor_violation ADD CONSTRAINT FK_D2E7389E7386118A FOREIGN KEY (violation_id) REFERENCES registry_violation (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE contractor_violation ADD CONSTRAINT FK_D2E7389EB0265DC7 FOREIGN KEY (contractor_id) REFERENCES registry_contractor (id) ON DELETE CASCADE');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TABLE contractor_violation');
}
}
...@@ -40,7 +40,16 @@ ...@@ -40,7 +40,16 @@
<many-to-many field="mesurements" target-entity="App\Domain\Registry\Model\Mesurement" mapped-by="violations"/> <many-to-many field="mesurements" target-entity="App\Domain\Registry\Model\Mesurement" mapped-by="violations"/>
<many-to-many field="contractors" target-entity="App\Domain\Registry\Model\Contractor" mapped-by="violations"/> <many-to-many field="contractors" target-entity="App\Domain\Registry\Model\Contractor" inversed-by="violations">
<join-table name="contractor_violation">
<join-columns>
<join-column on-delete="CASCADE"/>
</join-columns>
<inverse-join-columns>
<join-column on-delete="CASCADE"/>
</inverse-join-columns>
</join-table>
</many-to-many>
<many-to-many field="treatments" target-entity="App\Domain\Registry\Model\Treatment" inversed-by="violations"> <many-to-many field="treatments" target-entity="App\Domain\Registry\Model\Treatment" inversed-by="violations">
<join-table name="treatment_violation"> <join-table name="treatment_violation">
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
{% for contractor in activeContractors %} {% for contractor in activeContractors %}
<li> <li>
<a href="{{ path('registry_contractor_show', { id: contractor.id }) }}"> <a href="{{ path('registry_contractor_show', { id: contractor.id }) }}">
{{ contractor.name }} ({{ contractor.legalBasis|dictionary('registry_contractor_legal_basis') }}) {{ contractor.name }}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}
......
...@@ -38,7 +38,7 @@ label: ...@@ -38,7 +38,7 @@ label:
linked_mesurement: Actions de protection associées linked_mesurement: Actions de protection associées
linked_violations: Violations associées linked_violations: Violations associées
linked_request: Demandes associées linked_request: Demandes associées
linked_contractors: Sous-traitants associés linked_contractor: Sous-traitants associés
no: Non no: Non
yes: Oui yes: Oui
no_linked_document: Aucun document associé no_linked_document: Aucun document associé
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment