<?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 Version20210823141711 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->addSql('CREATE TABLE collectif_data (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, territory_id INT DEFAULT NULL, nb_participant INT NOT NULL, status DOUBLE PRECISION NOT NULL, INDEX IDX_F35F8503A76ED395 (user_id), INDEX IDX_F35F850373F74AD4 (territory_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE configuration (id INT AUTO_INCREMENT NOT NULL, value VARCHAR(255) NOT NULL, dev_alias VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE dreams (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, thematic_id INT DEFAULT NULL, description LONGTEXT NOT NULL, INDEX IDX_FD07CC0AE2920B1 (individual_data_id), INDEX IDX_FD07CC0AD9275BF1 (collectif_data_id), INDEX IDX_FD07CC0A2395FCED (thematic_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE file (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, updated_by_id INT NOT NULL, path VARCHAR(255) DEFAULT NULL, legend VARCHAR(255) DEFAULT NULL, dev_alias VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, locales_enabled LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', position DOUBLE PRECISION NOT NULL, INDEX IDX_8C9F3610B03A8386 (created_by_id), INDEX IDX_8C9F3610896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE group_user (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, updated_by_id INT NOT NULL, title VARCHAR(255) NOT NULL, dev_alias VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_A4C98D39B03A8386 (created_by_id), INDEX IDX_A4C98D39896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE individual_data (id INT AUTO_INCREMENT NOT NULL, territory_id INT DEFAULT NULL, firstname VARCHAR(255) NOT NULL, lastname VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, intro_question VARCHAR(255) NOT NULL, intro_answer VARCHAR(255) DEFAULT NULL, status DOUBLE PRECISION NOT NULL, INDEX IDX_653169D073F74AD4 (territory_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE page (id INT AUTO_INCREMENT NOT NULL, image_id INT DEFAULT NULL, file_id INT DEFAULT NULL, created_by_id INT NOT NULL, updated_by_id INT NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, meta_title VARCHAR(255) DEFAULT NULL, meta_description LONGTEXT DEFAULT NULL, old_urls LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', slug VARCHAR(255) NOT NULL, position DOUBLE PRECISION NOT NULL, status DOUBLE PRECISION NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, dev_alias VARCHAR(255) DEFAULT NULL, INDEX IDX_140AB6203DA5256D (image_id), INDEX IDX_140AB62093CB796C (file_id), INDEX IDX_140AB620B03A8386 (created_by_id), INDEX IDX_140AB620896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE page_file (page_id INT NOT NULL, file_id INT NOT NULL, INDEX IDX_B5B2ACAC4663E4 (page_id), INDEX IDX_B5B2ACA93CB796C (file_id), PRIMARY KEY(page_id, file_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE projects_boost (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, thematic_id INT DEFAULT NULL, description LONGTEXT NOT NULL, INDEX IDX_C3E57356E2920B1 (individual_data_id), INDEX IDX_C3E57356D9275BF1 (collectif_data_id), INDEX IDX_C3E573562395FCED (thematic_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE projects_inspiring (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, thematic_id INT DEFAULT NULL, description LONGTEXT NOT NULL, INDEX IDX_E60CAEC6E2920B1 (individual_data_id), INDEX IDX_E60CAEC6D9275BF1 (collectif_data_id), INDEX IDX_E60CAEC62395FCED (thematic_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE reminder (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, updated_by_id INT NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, crud_action VARCHAR(64) DEFAULT NULL, crud_controller_fqcn VARCHAR(255) DEFAULT NULL, entity_id INT DEFAULT NULL, date_reminder DATE DEFAULT NULL, done TINYINT(1) NOT NULL, dev_alias VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_40374F40B03A8386 (created_by_id), INDEX IDX_40374F40896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE reminder_user_interface (reminder_id INT NOT NULL, user_interface_id INT NOT NULL, INDEX IDX_7FD2584BD987BE75 (reminder_id), INDEX IDX_7FD2584B2BC79580 (user_interface_id), PRIMARY KEY(reminder_id, user_interface_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE revolts (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, thematic_id INT DEFAULT NULL, description LONGTEXT NOT NULL, INDEX IDX_68E7DC9FE2920B1 (individual_data_id), INDEX IDX_68E7DC9FD9275BF1 (collectif_data_id), INDEX IDX_68E7DC9F2395FCED (thematic_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE site (id INT AUTO_INCREMENT NOT NULL, dev_alias VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE site_setting (id INT AUTO_INCREMENT NOT NULL, site_id INT NOT NULL, file_id INT DEFAULT NULL, name VARCHAR(63) NOT NULL, text LONGTEXT DEFAULT NULL, date DATETIME DEFAULT NULL, INDEX IDX_64D05A53F6BD1646 (site_id), INDEX IDX_64D05A5393CB796C (file_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE territory (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, dev_alias VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE thematic (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE ticket (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, created_by_id INT NOT NULL, updated_by_id INT NOT NULL, type VARCHAR(32) NOT NULL, status VARCHAR(32) NOT NULL, subject VARCHAR(255) NOT NULL, tags LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', visitor_firstname VARCHAR(64) DEFAULT NULL, visitor_lastname VARCHAR(64) DEFAULT NULL, visitor_email VARCHAR(128) DEFAULT NULL, visitor_token VARCHAR(255) DEFAULT NULL, dev_alias VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_97A0ADA3A76ED395 (user_id), INDEX IDX_97A0ADA3B03A8386 (created_by_id), INDEX IDX_97A0ADA3896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE ticket_message (id INT AUTO_INCREMENT NOT NULL, ticket_id INT NOT NULL, created_by_id INT NOT NULL, updated_by_id INT NOT NULL, message LONGTEXT NOT NULL, answer_by_admin TINYINT(1) DEFAULT NULL, image_filename VARCHAR(255) DEFAULT NULL, dev_alias VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, status DOUBLE PRECISION NOT NULL, INDEX IDX_BA71692D700047D2 (ticket_id), INDEX IDX_BA71692DB03A8386 (created_by_id), INDEX IDX_BA71692D896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) NOT NULL, lastname VARCHAR(255) DEFAULT NULL, firstname VARCHAR(255) DEFAULT NULL, phone VARCHAR(20) DEFAULT NULL, gender TINYINT(1) DEFAULT NULL, birthdate DATE DEFAULT NULL, is_verified TINYINT(1) NOT NULL, ticket_types_notification LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', dev_alias VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE user_group_user_interface (user_id INT NOT NULL, group_user_interface_id INT NOT NULL, INDEX IDX_12B87B34A76ED395 (user_id), INDEX IDX_12B87B34F583BABC (group_user_interface_id), PRIMARY KEY(user_id, group_user_interface_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('ALTER TABLE collectif_data ADD CONSTRAINT FK_F35F8503A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE collectif_data ADD CONSTRAINT FK_F35F850373F74AD4 FOREIGN KEY (territory_id) REFERENCES territory (id)'); | |||||
$this->addSql('ALTER TABLE dreams ADD CONSTRAINT FK_FD07CC0AE2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('ALTER TABLE dreams ADD CONSTRAINT FK_FD07CC0AD9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)'); | |||||
$this->addSql('ALTER TABLE dreams ADD CONSTRAINT FK_FD07CC0A2395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id)'); | |||||
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F3610B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F3610896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE group_user ADD CONSTRAINT FK_A4C98D39B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE group_user ADD CONSTRAINT FK_A4C98D39896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE individual_data ADD CONSTRAINT FK_653169D073F74AD4 FOREIGN KEY (territory_id) REFERENCES territory (id)'); | |||||
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB6203DA5256D FOREIGN KEY (image_id) REFERENCES file (id)'); | |||||
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB62093CB796C FOREIGN KEY (file_id) REFERENCES file (id)'); | |||||
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE page_file ADD CONSTRAINT FK_B5B2ACAC4663E4 FOREIGN KEY (page_id) REFERENCES page (id) ON DELETE CASCADE'); | |||||
$this->addSql('ALTER TABLE page_file ADD CONSTRAINT FK_B5B2ACA93CB796C FOREIGN KEY (file_id) REFERENCES file (id) ON DELETE CASCADE'); | |||||
$this->addSql('ALTER TABLE projects_boost ADD CONSTRAINT FK_C3E57356E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('ALTER TABLE projects_boost ADD CONSTRAINT FK_C3E57356D9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)'); | |||||
$this->addSql('ALTER TABLE projects_boost ADD CONSTRAINT FK_C3E573562395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id)'); | |||||
$this->addSql('ALTER TABLE projects_inspiring ADD CONSTRAINT FK_E60CAEC6E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('ALTER TABLE projects_inspiring ADD CONSTRAINT FK_E60CAEC6D9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)'); | |||||
$this->addSql('ALTER TABLE projects_inspiring ADD CONSTRAINT FK_E60CAEC62395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id)'); | |||||
$this->addSql('ALTER TABLE reminder ADD CONSTRAINT FK_40374F40B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE reminder ADD CONSTRAINT FK_40374F40896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE reminder_user_interface ADD CONSTRAINT FK_7FD2584BD987BE75 FOREIGN KEY (reminder_id) REFERENCES reminder (id) ON DELETE CASCADE'); | |||||
$this->addSql('ALTER TABLE reminder_user_interface ADD CONSTRAINT FK_7FD2584B2BC79580 FOREIGN KEY (user_interface_id) REFERENCES user (id) ON DELETE CASCADE'); | |||||
$this->addSql('ALTER TABLE revolts ADD CONSTRAINT FK_68E7DC9FE2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('ALTER TABLE revolts ADD CONSTRAINT FK_68E7DC9FD9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)'); | |||||
$this->addSql('ALTER TABLE revolts ADD CONSTRAINT FK_68E7DC9F2395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id)'); | |||||
$this->addSql('ALTER TABLE site_setting ADD CONSTRAINT FK_64D05A53F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id)'); | |||||
$this->addSql('ALTER TABLE site_setting ADD CONSTRAINT FK_64D05A5393CB796C FOREIGN KEY (file_id) REFERENCES file (id)'); | |||||
$this->addSql('ALTER TABLE ticket ADD CONSTRAINT FK_97A0ADA3A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE ticket ADD CONSTRAINT FK_97A0ADA3B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE ticket ADD CONSTRAINT FK_97A0ADA3896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE ticket_message ADD CONSTRAINT FK_BA71692D700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket (id)'); | |||||
$this->addSql('ALTER TABLE ticket_message ADD CONSTRAINT FK_BA71692DB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE ticket_message ADD CONSTRAINT FK_BA71692D896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE user_group_user_interface ADD CONSTRAINT FK_12B87B34A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE'); | |||||
$this->addSql('ALTER TABLE user_group_user_interface ADD CONSTRAINT FK_12B87B34F583BABC FOREIGN KEY (group_user_interface_id) REFERENCES group_user (id) ON DELETE CASCADE'); | |||||
} | |||||
public function down(Schema $schema): void | |||||
{ | |||||
// this down() migration is auto-generated, please modify it to your needs | |||||
$this->addSql('ALTER TABLE dreams DROP FOREIGN KEY FK_FD07CC0AD9275BF1'); | |||||
$this->addSql('ALTER TABLE projects_boost DROP FOREIGN KEY FK_C3E57356D9275BF1'); | |||||
$this->addSql('ALTER TABLE projects_inspiring DROP FOREIGN KEY FK_E60CAEC6D9275BF1'); | |||||
$this->addSql('ALTER TABLE revolts DROP FOREIGN KEY FK_68E7DC9FD9275BF1'); | |||||
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB6203DA5256D'); | |||||
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB62093CB796C'); | |||||
$this->addSql('ALTER TABLE page_file DROP FOREIGN KEY FK_B5B2ACA93CB796C'); | |||||
$this->addSql('ALTER TABLE site_setting DROP FOREIGN KEY FK_64D05A5393CB796C'); | |||||
$this->addSql('ALTER TABLE user_group_user_interface DROP FOREIGN KEY FK_12B87B34F583BABC'); | |||||
$this->addSql('ALTER TABLE dreams DROP FOREIGN KEY FK_FD07CC0AE2920B1'); | |||||
$this->addSql('ALTER TABLE projects_boost DROP FOREIGN KEY FK_C3E57356E2920B1'); | |||||
$this->addSql('ALTER TABLE projects_inspiring DROP FOREIGN KEY FK_E60CAEC6E2920B1'); | |||||
$this->addSql('ALTER TABLE revolts DROP FOREIGN KEY FK_68E7DC9FE2920B1'); | |||||
$this->addSql('ALTER TABLE page_file DROP FOREIGN KEY FK_B5B2ACAC4663E4'); | |||||
$this->addSql('ALTER TABLE reminder_user_interface DROP FOREIGN KEY FK_7FD2584BD987BE75'); | |||||
$this->addSql('ALTER TABLE site_setting DROP FOREIGN KEY FK_64D05A53F6BD1646'); | |||||
$this->addSql('ALTER TABLE collectif_data DROP FOREIGN KEY FK_F35F850373F74AD4'); | |||||
$this->addSql('ALTER TABLE individual_data DROP FOREIGN KEY FK_653169D073F74AD4'); | |||||
$this->addSql('ALTER TABLE dreams DROP FOREIGN KEY FK_FD07CC0A2395FCED'); | |||||
$this->addSql('ALTER TABLE projects_boost DROP FOREIGN KEY FK_C3E573562395FCED'); | |||||
$this->addSql('ALTER TABLE projects_inspiring DROP FOREIGN KEY FK_E60CAEC62395FCED'); | |||||
$this->addSql('ALTER TABLE revolts DROP FOREIGN KEY FK_68E7DC9F2395FCED'); | |||||
$this->addSql('ALTER TABLE ticket_message DROP FOREIGN KEY FK_BA71692D700047D2'); | |||||
$this->addSql('ALTER TABLE collectif_data DROP FOREIGN KEY FK_F35F8503A76ED395'); | |||||
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F3610B03A8386'); | |||||
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F3610896DBBDE'); | |||||
$this->addSql('ALTER TABLE group_user DROP FOREIGN KEY FK_A4C98D39B03A8386'); | |||||
$this->addSql('ALTER TABLE group_user DROP FOREIGN KEY FK_A4C98D39896DBBDE'); | |||||
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620B03A8386'); | |||||
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620896DBBDE'); | |||||
$this->addSql('ALTER TABLE reminder DROP FOREIGN KEY FK_40374F40B03A8386'); | |||||
$this->addSql('ALTER TABLE reminder DROP FOREIGN KEY FK_40374F40896DBBDE'); | |||||
$this->addSql('ALTER TABLE reminder_user_interface DROP FOREIGN KEY FK_7FD2584B2BC79580'); | |||||
$this->addSql('ALTER TABLE ticket DROP FOREIGN KEY FK_97A0ADA3A76ED395'); | |||||
$this->addSql('ALTER TABLE ticket DROP FOREIGN KEY FK_97A0ADA3B03A8386'); | |||||
$this->addSql('ALTER TABLE ticket DROP FOREIGN KEY FK_97A0ADA3896DBBDE'); | |||||
$this->addSql('ALTER TABLE ticket_message DROP FOREIGN KEY FK_BA71692DB03A8386'); | |||||
$this->addSql('ALTER TABLE ticket_message DROP FOREIGN KEY FK_BA71692D896DBBDE'); | |||||
$this->addSql('ALTER TABLE user_group_user_interface DROP FOREIGN KEY FK_12B87B34A76ED395'); | |||||
$this->addSql('DROP TABLE collectif_data'); | |||||
$this->addSql('DROP TABLE configuration'); | |||||
$this->addSql('DROP TABLE dreams'); | |||||
$this->addSql('DROP TABLE file'); | |||||
$this->addSql('DROP TABLE group_user'); | |||||
$this->addSql('DROP TABLE individual_data'); | |||||
$this->addSql('DROP TABLE page'); | |||||
$this->addSql('DROP TABLE page_file'); | |||||
$this->addSql('DROP TABLE projects_boost'); | |||||
$this->addSql('DROP TABLE projects_inspiring'); | |||||
$this->addSql('DROP TABLE reminder'); | |||||
$this->addSql('DROP TABLE reminder_user_interface'); | |||||
$this->addSql('DROP TABLE revolts'); | |||||
$this->addSql('DROP TABLE site'); | |||||
$this->addSql('DROP TABLE site_setting'); | |||||
$this->addSql('DROP TABLE territory'); | |||||
$this->addSql('DROP TABLE thematic'); | |||||
$this->addSql('DROP TABLE ticket'); | |||||
$this->addSql('DROP TABLE ticket_message'); | |||||
$this->addSql('DROP TABLE user'); | |||||
$this->addSql('DROP TABLE user_group_user_interface'); | |||||
} | |||||
} |
<?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 Version20210824143117 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->addSql('CREATE TABLE dream (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, thematic_id INT DEFAULT NULL, description LONGTEXT NOT NULL, INDEX IDX_6A5F004FE2920B1 (individual_data_id), INDEX IDX_6A5F004FD9275BF1 (collectif_data_id), INDEX IDX_6A5F004F2395FCED (thematic_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('ALTER TABLE dream ADD CONSTRAINT FK_6A5F004FE2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('ALTER TABLE dream ADD CONSTRAINT FK_6A5F004FD9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)'); | |||||
$this->addSql('ALTER TABLE dream ADD CONSTRAINT FK_6A5F004F2395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id)'); | |||||
$this->addSql('DROP TABLE dreams'); | |||||
} | |||||
public function down(Schema $schema): void | |||||
{ | |||||
// this down() migration is auto-generated, please modify it to your needs | |||||
$this->addSql('CREATE TABLE dreams (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, thematic_id INT DEFAULT NULL, description LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, INDEX IDX_FD07CC0AE2920B1 (individual_data_id), INDEX IDX_FD07CC0AD9275BF1 (collectif_data_id), INDEX IDX_FD07CC0A2395FCED (thematic_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); | |||||
$this->addSql('ALTER TABLE dreams ADD CONSTRAINT FK_FD07CC0A2395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id)'); | |||||
$this->addSql('ALTER TABLE dreams ADD CONSTRAINT FK_FD07CC0AD9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)'); | |||||
$this->addSql('ALTER TABLE dreams ADD CONSTRAINT FK_FD07CC0AE2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('DROP TABLE dream'); | |||||
} | |||||
} |
<?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 Version20210824143619 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->addSql('CREATE TABLE project_boost (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, thematic_id INT DEFAULT NULL, description LONGTEXT NOT NULL, INDEX IDX_45312EF6E2920B1 (individual_data_id), INDEX IDX_45312EF6D9275BF1 (collectif_data_id), INDEX IDX_45312EF62395FCED (thematic_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('ALTER TABLE project_boost ADD CONSTRAINT FK_45312EF6E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('ALTER TABLE project_boost ADD CONSTRAINT FK_45312EF6D9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)'); | |||||
$this->addSql('ALTER TABLE project_boost ADD CONSTRAINT FK_45312EF62395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id)'); | |||||
$this->addSql('DROP TABLE projects_boost'); | |||||
} | |||||
public function down(Schema $schema): void | |||||
{ | |||||
// this down() migration is auto-generated, please modify it to your needs | |||||
$this->addSql('CREATE TABLE projects_boost (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, thematic_id INT DEFAULT NULL, description LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, INDEX IDX_C3E57356E2920B1 (individual_data_id), INDEX IDX_C3E57356D9275BF1 (collectif_data_id), INDEX IDX_C3E573562395FCED (thematic_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); | |||||
$this->addSql('ALTER TABLE projects_boost ADD CONSTRAINT FK_C3E573562395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id)'); | |||||
$this->addSql('ALTER TABLE projects_boost ADD CONSTRAINT FK_C3E57356D9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)'); | |||||
$this->addSql('ALTER TABLE projects_boost ADD CONSTRAINT FK_C3E57356E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('DROP TABLE project_boost'); | |||||
} | |||||
} |
<?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 Version20210824144406 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->addSql('CREATE TABLE project_inspiring (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, thematic_id INT DEFAULT NULL, description LONGTEXT NOT NULL, INDEX IDX_2E8C2C2EE2920B1 (individual_data_id), INDEX IDX_2E8C2C2ED9275BF1 (collectif_data_id), INDEX IDX_2E8C2C2E2395FCED (thematic_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('ALTER TABLE project_inspiring ADD CONSTRAINT FK_2E8C2C2EE2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('ALTER TABLE project_inspiring ADD CONSTRAINT FK_2E8C2C2ED9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)'); | |||||
$this->addSql('ALTER TABLE project_inspiring ADD CONSTRAINT FK_2E8C2C2E2395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id)'); | |||||
$this->addSql('DROP TABLE projects_inspiring'); | |||||
} | |||||
public function down(Schema $schema): void | |||||
{ | |||||
// this down() migration is auto-generated, please modify it to your needs | |||||
$this->addSql('CREATE TABLE projects_inspiring (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, thematic_id INT DEFAULT NULL, description LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, INDEX IDX_E60CAEC6E2920B1 (individual_data_id), INDEX IDX_E60CAEC6D9275BF1 (collectif_data_id), INDEX IDX_E60CAEC62395FCED (thematic_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); | |||||
$this->addSql('ALTER TABLE projects_inspiring ADD CONSTRAINT FK_E60CAEC62395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id)'); | |||||
$this->addSql('ALTER TABLE projects_inspiring ADD CONSTRAINT FK_E60CAEC6D9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)'); | |||||
$this->addSql('ALTER TABLE projects_inspiring ADD CONSTRAINT FK_E60CAEC6E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('DROP TABLE project_inspiring'); | |||||
} | |||||
} |
<?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 Version20210824144602 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->addSql('CREATE TABLE revolt (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, thematic_id INT DEFAULT NULL, description LONGTEXT NOT NULL, INDEX IDX_35051787E2920B1 (individual_data_id), INDEX IDX_35051787D9275BF1 (collectif_data_id), INDEX IDX_350517872395FCED (thematic_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('ALTER TABLE revolt ADD CONSTRAINT FK_35051787E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('ALTER TABLE revolt ADD CONSTRAINT FK_35051787D9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)'); | |||||
$this->addSql('ALTER TABLE revolt ADD CONSTRAINT FK_350517872395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id)'); | |||||
$this->addSql('DROP TABLE revolts'); | |||||
} | |||||
public function down(Schema $schema): void | |||||
{ | |||||
// this down() migration is auto-generated, please modify it to your needs | |||||
$this->addSql('CREATE TABLE revolts (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, thematic_id INT DEFAULT NULL, description LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, INDEX IDX_68E7DC9FE2920B1 (individual_data_id), INDEX IDX_68E7DC9FD9275BF1 (collectif_data_id), INDEX IDX_68E7DC9F2395FCED (thematic_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); | |||||
$this->addSql('ALTER TABLE revolts ADD CONSTRAINT FK_68E7DC9F2395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id)'); | |||||
$this->addSql('ALTER TABLE revolts ADD CONSTRAINT FK_68E7DC9FD9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)'); | |||||
$this->addSql('ALTER TABLE revolts ADD CONSTRAINT FK_68E7DC9FE2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)'); | |||||
$this->addSql('DROP TABLE revolt'); | |||||
} | |||||
} |
use App\Entity\CollectifData; | use App\Entity\CollectifData; | ||||
use App\Entity\Configuration; | use App\Entity\Configuration; | ||||
use App\Type\DreamsType; | |||||
use App\Type\ProjectsBoostType; | |||||
use App\Type\ProjectsInspiringType; | |||||
use App\Type\RevoltsType; | |||||
use App\Type\DreamType; | |||||
use App\Type\ProjectBoostType; | |||||
use App\Type\ProjectInspiringType; | |||||
use App\Type\RevoltType; | |||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Doctrine\ORM\QueryBuilder; | use Doctrine\ORM\QueryBuilder; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection; | use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection; | ||||
$fields[] = AssociationField::new('territory') | $fields[] = AssociationField::new('territory') | ||||
->setTemplatePath('crud/field/association.html.twig'); | ->setTemplatePath('crud/field/association.html.twig'); | ||||
$fields[] = IntegerField::new('nbParticipant'); | $fields[] = IntegerField::new('nbParticipant'); | ||||
$fields[] = TextField::new('nbDreams') | |||||
$fields[] = TextField::new('nbDream') | |||||
->onlyOnIndex(); | ->onlyOnIndex(); | ||||
$fields[] = TextField::new('nbRevolts') | |||||
$fields[] = TextField::new('nbRevolt') | |||||
->onlyOnIndex(); | ->onlyOnIndex(); | ||||
$fields[] = TextField::new('nbProjectsBoost') | |||||
$fields[] = TextField::new('nbProjectBoost') | |||||
->onlyOnIndex(); | ->onlyOnIndex(); | ||||
$fields[] = TextField::new('nbProjectsInspiring') | |||||
$fields[] = TextField::new('nbProjectInspiring') | |||||
->onlyOnIndex(); | ->onlyOnIndex(); | ||||
$fields[] = CollectionField::new('revolts') | |||||
->setFormTypeOption('entry_type', RevoltsType::class) | |||||
$fields[] = CollectionField::new('revolt') | |||||
->setFormTypeOption('entry_type', RevoltType::class) | |||||
->setFormTypeOption('by_reference', false) | ->setFormTypeOption('by_reference', false) | ||||
->setRequired(false) | ->setRequired(false) | ||||
->hideOnIndex(); | ->hideOnIndex(); | ||||
$fields[] = CollectionField::new('dreams') | |||||
->setFormTypeOption('entry_type', DreamsType::class) | |||||
$fields[] = CollectionField::new('dream') | |||||
->setFormTypeOption('entry_type', DreamType::class) | |||||
->setFormTypeOption('by_reference', false) | ->setFormTypeOption('by_reference', false) | ||||
->setRequired(false) | ->setRequired(false) | ||||
->hideOnIndex(); | ->hideOnIndex(); | ||||
$fields[] = CollectionField::new('projectsboost') | |||||
->setFormTypeOption('entry_type', ProjectsBoostType::class) | |||||
$fields[] = CollectionField::new('projectBoost') | |||||
->setFormTypeOption('entry_type', ProjectBoostType::class) | |||||
->setFormTypeOption('by_reference', false) | ->setFormTypeOption('by_reference', false) | ||||
->setRequired(false) | ->setRequired(false) | ||||
->hideOnIndex(); | ->hideOnIndex(); | ||||
$fields[] = CollectionField::new('projectsinspiring') | |||||
->setFormTypeOption('entry_type', ProjectsInspiringType::class) | |||||
$fields[] = CollectionField::new('projectinspiring') | |||||
->setFormTypeOption('entry_type', ProjectInspiringType::class) | |||||
->setFormTypeOption('by_reference', false) | ->setFormTypeOption('by_reference', false) | ||||
->setRequired(false) | ->setRequired(false) | ||||
->hideOnIndex(); | ->hideOnIndex(); |
use App\Entity\CollectifData; | use App\Entity\CollectifData; | ||||
use App\Entity\Configuration; | use App\Entity\Configuration; | ||||
use App\Entity\Dreams; | |||||
use App\Entity\ProjectsBoost; | |||||
use App\Entity\ProjectsInspiring; | |||||
use App\Entity\Revolts; | |||||
use App\Entity\Dream; | |||||
use App\Entity\ProjectBoost; | |||||
use App\Entity\ProjectInspiring; | |||||
use App\Entity\Revolt; | |||||
use App\Entity\Site\Page; | use App\Entity\Site\Page; | ||||
use App\Entity\Territory; | use App\Entity\Territory; | ||||
use App\Entity\Thematic; | use App\Entity\Thematic; | ||||
public function index(): Response | public function index(): Response | ||||
{ | { | ||||
$repoCollectifData = $this->getDoctrine()->getRepository(CollectifData::class); | $repoCollectifData = $this->getDoctrine()->getRepository(CollectifData::class); | ||||
$repoDreams = $this->getDoctrine()->getRepository(Dreams::class); | |||||
$repoRevolts = $this->getDoctrine()->getRepository(Revolts::class); | |||||
$repoProjectsBoost = $this->getDoctrine()->getRepository(ProjectsBoost::class); | |||||
$repoProjectsInsp = $this->getDoctrine()->getRepository(ProjectsInspiring::class); | |||||
$repoDream = $this->getDoctrine()->getRepository(Dream::class); | |||||
$repoRevolt = $this->getDoctrine()->getRepository(Revolt::class); | |||||
$repoProjectBoost = $this->getDoctrine()->getRepository(ProjectBoost::class); | |||||
$repoProjectsInsp = $this->getDoctrine()->getRepository(ProjectInspiring::class); | |||||
$repoUser = $this->getDoctrine()->getRepository(User::class); | $repoUser = $this->getDoctrine()->getRepository(User::class); | ||||
$formUnvalid = $repoCollectifData->findByStatus(0); | $formUnvalid = $repoCollectifData->findByStatus(0); | ||||
$formValid = $repoCollectifData->findByStatus(1); | $formValid = $repoCollectifData->findByStatus(1); | ||||
$dreams = $repoDreams->findAll(); | |||||
$revolts = $repoRevolts->findAll(); | |||||
$projectsBoost = $repoProjectsBoost->findAll(); | |||||
$dream = $repoDream->findAll(); | |||||
$revolt = $repoRevolt->findAll(); | |||||
$projectBoost = $repoProjectBoost->findAll(); | |||||
$projectsInsp = $repoProjectsInsp->findAll(); | $projectsInsp = $repoProjectsInsp->findAll(); | ||||
$animators = $repoUser->findByRole(self::ROLE_ANIMATOR); | $animators = $repoUser->findByRole(self::ROLE_ANIMATOR); | ||||
[ | [ | ||||
'nbFormUnvalid' => count($formUnvalid), | 'nbFormUnvalid' => count($formUnvalid), | ||||
'nbFormValid' => count($formValid), | 'nbFormValid' => count($formValid), | ||||
'nbDreams' => count($dreams), | |||||
'nbRevolts' => count($revolts), | |||||
'nbProjectsBoost' => count($projectsBoost), | |||||
'nbDream' => count($dream), | |||||
'nbRevolt' => count($revolt), | |||||
'nbProjectBoost' => count($projectBoost), | |||||
'nbProjectsInsp' => count($projectsInsp), | 'nbProjectsInsp' => count($projectsInsp), | ||||
'nbAnimator' => count($animators) | 'nbAnimator' => count($animators) | ||||
]); | ]); |
namespace App\Controller\Frontend; | namespace App\Controller\Frontend; | ||||
use App\Entity\Dreams; | |||||
use App\Entity\ProjectsBoost; | |||||
use App\Entity\ProjectsInspiring; | |||||
use App\Entity\Revolts; | |||||
use App\Entity\Dream; | |||||
use App\Entity\ProjectBoost; | |||||
use App\Entity\ProjectInspiring; | |||||
use App\Entity\Revolt; | |||||
use App\Form\ContactForm; | use App\Form\ContactForm; | ||||
use App\Form\IndividualForm; | use App\Form\IndividualForm; | ||||
use App\Form\SearchListForm; | |||||
use App\Repository\DreamStore; | |||||
use App\Repository\ProjectBoostStore; | |||||
use App\Repository\ProjectInspiringStore; | |||||
use App\Repository\RevoltStore; | |||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||||
use Symfony\Component\HttpFoundation\JsonResponse; | use Symfony\Component\HttpFoundation\JsonResponse; | ||||
class DefaultController extends AbstractController | class DefaultController extends AbstractController | ||||
{ | { | ||||
protected $em; | protected $em; | ||||
public function __construct(EntityManagerInterface $em) | |||||
{ | |||||
protected DreamStore $dreamStore; | |||||
protected RevoltStore $revoltStore; | |||||
protected ProjectBoostStore $projectBoostStore; | |||||
protected ProjectInspiringStore $projectInspiringStore; | |||||
public function __construct( | |||||
EntityManagerInterface $em, | |||||
DreamStore $dreamStore, | |||||
RevoltStore $revoltStore, | |||||
ProjectBoostStore $projectBoostStore, | |||||
ProjectInspiringStore $projectInspiringStore | |||||
) { | |||||
$this->em = $em; | $this->em = $em; | ||||
$this->dreamStore = $dreamStore; | |||||
$this->revoltStore = $revoltStore; | |||||
$this->projectBoostStore = $projectBoostStore; | |||||
$this->projectInspiringStore = $projectInspiringStore; | |||||
} | } | ||||
public function home() | public function home() | ||||
); | ); | ||||
} | } | ||||
public function cartoListe() | |||||
public function cartoListe(Request $request) | |||||
{ | { | ||||
$form = $this->createForm(SearchListForm::class); | |||||
$form->handleRequest($request); | |||||
if ($form->isSubmitted() && $form->isValid()) { | |||||
$data = $form->getData(); | |||||
$description = $data['search']; | |||||
$categoryArray = $data['category']; | |||||
$territoryArray = $data['territory']; | |||||
$thematicArray = $data['thematic']; | |||||
dump($data); | |||||
$dreamArray = $revoltArray = $projectBoostArray = $projectInspiringArray = array(); | |||||
if (in_array('dream', $categoryArray)) { | |||||
$dreamArray = $this->dreamStore->filterSearch($description, $territoryArray, $thematicArray); | |||||
dump('DREAMS'); | |||||
dump($dreamArray); | |||||
} | |||||
if (in_array('revolt', $categoryArray)) { | |||||
$revoltArray = $this->revoltStore->filterSearch($description, $territoryArray, $thematicArray); | |||||
dump('REVOLT'); | |||||
dump($revoltArray); | |||||
} | |||||
if (in_array('projectBoost', $categoryArray)) { | |||||
$projectBoostArray = $this->projectBoostStore->filterSearch($description, $territoryArray, $thematicArray); | |||||
dump('PROJECTBOOST'); | |||||
dump($projectBoostArray); | |||||
} | |||||
if (in_array('projectInspiring', $categoryArray)) { | |||||
$projectInspiringArray = $this->projectInspiringStore->filterSearch($description, $territoryArray, $thematicArray); | |||||
dump('PROJECTINSP'); | |||||
dump($projectInspiringArray); | |||||
} | |||||
$resultArray = array_merge($dreamArray, $revoltArray, $projectBoostArray, $projectInspiringArray); | |||||
dump('RESULT'); | |||||
dump($resultArray); | |||||
// foreach ($dreamArray as $dream) { | |||||
// if($dream->getCollectifData()){ | |||||
// dump($dream->getCollectifData()->getTerritory()->getName()); | |||||
// } | |||||
// if($dream->getIndividualData()){ | |||||
// dump($dream->getIndividualData()->getTerritory()->getName()); | |||||
// } | |||||
// } | |||||
die; | |||||
// return $this->redirectToRoute('task_success'); | |||||
} | |||||
return $this->render( | return $this->render( | ||||
'frontend/carto-liste.html.twig', | 'frontend/carto-liste.html.twig', | ||||
[ | [ | ||||
'form' => $form->createView(), | |||||
'nbContrib' => $this->countContrib() | 'nbContrib' => $this->countContrib() | ||||
] | ] | ||||
); | ); | ||||
private function countContrib(): int | private function countContrib(): int | ||||
{ | { | ||||
$dreamRepository = $this->em->getRepository(Dreams::class); | |||||
$revoltRepository = $this->em->getRepository(Revolts::class); | |||||
$projectsBoostRepository = $this->em->getRepository(ProjectsBoost::class); | |||||
$projectsInspiringRepository = $this->em->getRepository(ProjectsInspiring::class); | |||||
$dreamRepository = $this->em->getRepository(Dream::class); | |||||
$revoltRepository = $this->em->getRepository(Revolt::class); | |||||
$projectBoostRepository = $this->em->getRepository(ProjectBoost::class); | |||||
$projectInspiringRepository = $this->em->getRepository(ProjectInspiring::class); | |||||
$dreams = count($dreamRepository->findAll()); | |||||
$revolts = count($revoltRepository->findAll()); | |||||
$projectsBoost = count($projectsBoostRepository->findAll()); | |||||
$projectsInspiring = count($projectsBoostRepository->findAll()); | |||||
$dream = count($dreamRepository->findAll()); | |||||
$revolt = count($revoltRepository->findAll()); | |||||
$projectBoost = count($projectBoostRepository->findAll()); | |||||
$projectInspiring = count($projectBoostRepository->findAll()); | |||||
$nbContrib = $dreams + $revolts + $projectsBoost + $projectsInspiring; | |||||
$nbContrib = $dream + $revolt + $projectBoost + $projectInspiring; | |||||
return $nbContrib; | return $nbContrib; | ||||
} | } |
private $user; | private $user; | ||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=Revolts::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
* @ORM\OneToMany(targetEntity=Revolt::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | */ | ||||
private $revolts; | |||||
private $revolt; | |||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=Dreams::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
* @ORM\OneToMany(targetEntity=Dream::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | */ | ||||
private $dreams; | |||||
private $dream; | |||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=ProjectsBoost::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
* @ORM\OneToMany(targetEntity=ProjectBoost::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | */ | ||||
private $projectsBoost; | |||||
private $projectBoost; | |||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=ProjectsInspiring::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
* @ORM\OneToMany(targetEntity=ProjectInspiring::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | */ | ||||
private $projectsInspiring; | |||||
private $projectInspiring; | |||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity=Territory::class, inversedBy="collectifData") | * @ORM\ManyToOne(targetEntity=Territory::class, inversedBy="collectifData") | ||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->revolts = new ArrayCollection(); | |||||
$this->dreams = new ArrayCollection(); | |||||
$this->projectsBoost = new ArrayCollection(); | |||||
$this->projectsInspiring = new ArrayCollection(); | |||||
$this->revolt = new ArrayCollection(); | |||||
$this->dream = new ArrayCollection(); | |||||
$this->projectBoost = new ArrayCollection(); | |||||
$this->projectInspiring = new ArrayCollection(); | |||||
} | } | ||||
public function __toString() | public function __toString() | ||||
public function getResume() | public function getResume() | ||||
{ | { | ||||
return count($this->getRevolts()) . " révolte(s) - " . count($this->getDreams()) . " rêve(s) - " . count($this->getProjectsBoost()) . " projet(s) boosté(s) - " . count($this->getProjectsInspiring()) . " projets inspirants"; | |||||
return count($this->getRevolt()) . " révolte(s) - " . count($this->getDream()) . " rêve(s) - " . count($this->getProjectBoost()) . " projet(s) boosté(s) - " . count($this->getProjectInspiring()) . " projets inspirants"; | |||||
} | } | ||||
public function getNbDreams():string | |||||
public function getNbDream():string | |||||
{ | { | ||||
return count($this->getDreams()); | |||||
return count($this->getDream()); | |||||
} | } | ||||
public function getNbRevolts():string | |||||
public function getNbRevolt():string | |||||
{ | { | ||||
return count($this->getRevolts()); | |||||
return count($this->getRevolt()); | |||||
} | } | ||||
public function getNbProjectsBoost():string | |||||
public function getNbProjectBoost():string | |||||
{ | { | ||||
return count($this->getProjectsBoost()); | |||||
return count($this->getProjectBoost()); | |||||
} | } | ||||
public function getNbProjectsInspiring():string | |||||
public function getNbProjectInspiring():string | |||||
{ | { | ||||
return count($this->getProjectsInspiring()); | |||||
return count($this->getProjectInspiring()); | |||||
} | } | ||||
public function getId(): ?int | public function getId(): ?int | ||||
} | } | ||||
/** | /** | ||||
* @return Collection|Revolts[] | |||||
* @return Collection|Revolt[] | |||||
*/ | */ | ||||
public function getRevolts(): Collection | |||||
public function getRevolt(): Collection | |||||
{ | { | ||||
return $this->revolts; | |||||
return $this->revolt; | |||||
} | } | ||||
public function addRevolt(Revolts $revolt): self | |||||
public function addRevolt(Revolt $revolt): self | |||||
{ | { | ||||
if (!$this->revolts->contains($revolt)) { | |||||
$this->revolts[] = $revolt; | |||||
if (!$this->revolt->contains($revolt)) { | |||||
$this->revolt[] = $revolt; | |||||
$revolt->setCollectifData($this); | $revolt->setCollectifData($this); | ||||
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
public function removeRevolt(Revolts $revolt): self | |||||
public function removeRevolt(Revolt $revolt): self | |||||
{ | { | ||||
if ($this->revolts->removeElement($revolt)) { | |||||
if ($this->revolt->removeElement($revolt)) { | |||||
// set the owning side to null (unless already changed) | // set the owning side to null (unless already changed) | ||||
if ($revolt->getCollectifData() === $this) { | if ($revolt->getCollectifData() === $this) { | ||||
$revolt->setCollectifData(null); | $revolt->setCollectifData(null); | ||||
} | } | ||||
/** | /** | ||||
* @return Collection|Dreams[] | |||||
* @return Collection|Dream[] | |||||
*/ | */ | ||||
public function getDreams(): Collection | |||||
public function getDream(): Collection | |||||
{ | { | ||||
return $this->dreams; | |||||
return $this->dream; | |||||
} | } | ||||
public function addDream(Dreams $dream): self | |||||
public function addDream(Dream $dream): self | |||||
{ | { | ||||
if (!$this->dreams->contains($dream)) { | |||||
$this->dreams[] = $dream; | |||||
if (!$this->dream->contains($dream)) { | |||||
$this->dream[] = $dream; | |||||
$dream->setCollectifData($this); | $dream->setCollectifData($this); | ||||
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
public function removeDream(Dreams $dream): self | |||||
public function removeDream(Dream $dream): self | |||||
{ | { | ||||
if ($this->dreams->removeElement($dream)) { | |||||
if ($this->dream->removeElement($dream)) { | |||||
// set the owning side to null (unless already changed) | // set the owning side to null (unless already changed) | ||||
if ($dream->getCollectifData() === $this) { | if ($dream->getCollectifData() === $this) { | ||||
$dream->setCollectifData(null); | $dream->setCollectifData(null); | ||||
} | } | ||||
/** | /** | ||||
* @return Collection|ProjectsBoost[] | |||||
* @return Collection|ProjectBoost[] | |||||
*/ | */ | ||||
public function getProjectsBoost(): Collection | |||||
public function getProjectBoost(): Collection | |||||
{ | { | ||||
return $this->projectsBoost; | |||||
return $this->projectBoost; | |||||
} | } | ||||
public function addProjectsBoost(ProjectsBoost $projectsBoost): self | |||||
public function addProjectBoost(ProjectBoost $projectBoost): self | |||||
{ | { | ||||
if (!$this->projectsBoost->contains($projectsBoost)) { | |||||
$this->projectsBoost[] = $projectsBoost; | |||||
$projectsBoost->setCollectifData($this); | |||||
if (!$this->projectBoost->contains($projectBoost)) { | |||||
$this->projectBoost[] = $projectBoost; | |||||
$projectBoost->setCollectifData($this); | |||||
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
public function removeProjectsBoost(ProjectsBoost $projectsBoost): self | |||||
public function removeProjectBoost(ProjectBoost $projectBoost): self | |||||
{ | { | ||||
if ($this->projectsBoost->removeElement($projectsBoost)) { | |||||
if ($this->projectBoost->removeElement($projectBoost)) { | |||||
// set the owning side to null (unless already changed) | // set the owning side to null (unless already changed) | ||||
if ($projectsBoost->getCollectifData() === $this) { | |||||
$projectsBoost->setCollectifData(null); | |||||
if ($projectBoost->getCollectifData() === $this) { | |||||
$projectBoost->setCollectifData(null); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* @return Collection|ProjectsInspiring[] | |||||
* @return Collection|ProjectInspiring[] | |||||
*/ | */ | ||||
public function getProjectsInspiring(): Collection | |||||
public function getProjectInspiring(): Collection | |||||
{ | { | ||||
return $this->projectsInspiring; | |||||
return $this->projectInspiring; | |||||
} | } | ||||
public function addProjectsInspiring(ProjectsInspiring $projectsInspiring): self | |||||
public function addProjectInspiring(ProjectInspiring $projectInspiring): self | |||||
{ | { | ||||
if (!$this->projectsInspiring->contains($projectsInspiring)) { | |||||
$this->projectsInspiring[] = $projectsInspiring; | |||||
$projectsInspiring->setCollectifData($this); | |||||
if (!$this->projectInspiring->contains($projectInspiring)) { | |||||
$this->projectInspiring[] = $projectInspiring; | |||||
$projectInspiring->setCollectifData($this); | |||||
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
public function removeProjectsInspiring(ProjectsInspiring $projectsInspiring): self | |||||
public function removeProjectInspiring(ProjectInspiring $projectInspiring): self | |||||
{ | { | ||||
if ($this->projectsInspiring->removeElement($projectsInspiring)) { | |||||
if ($this->projectInspiring->removeElement($projectInspiring)) { | |||||
// set the owning side to null (unless already changed) | // set the owning side to null (unless already changed) | ||||
if ($projectsInspiring->getCollectifData() === $this) { | |||||
$projectsInspiring->setCollectifData(null); | |||||
if ($projectInspiring->getCollectifData() === $this) { | |||||
$projectInspiring->setCollectifData(null); | |||||
} | } | ||||
} | } | ||||
namespace App\Entity; | namespace App\Entity; | ||||
use App\Repository\RevoltsRepository; | |||||
use App\Repository\DreamRepository; | |||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use App\Doctrine\Extension\DescriptionProjectInterface; | use App\Doctrine\Extension\DescriptionProjectInterface; | ||||
use App\Doctrine\Extension\DescriptionProjectTrait; | use App\Doctrine\Extension\DescriptionProjectTrait; | ||||
use Lc\SovBundle\Doctrine\EntityInterface; | use Lc\SovBundle\Doctrine\EntityInterface; | ||||
/** | /** | ||||
* @ORM\Entity(repositoryClass=RevoltsRepository::class) | |||||
* @ORM\Entity(repositoryClass=DreamRepository::class) | |||||
*/ | */ | ||||
class Revolts implements DescriptionProjectInterface, EntityInterface | |||||
class Dream implements DescriptionProjectInterface, EntityInterface | |||||
{ | { | ||||
use DescriptionProjectTrait; | use DescriptionProjectTrait; | ||||
private $id; | private $id; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="revolts") | |||||
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="dream") | |||||
*/ | */ | ||||
private $individualData; | private $individualData; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity=CollectifData::class, inversedBy="revolts") | |||||
* @ORM\ManyToOne(targetEntity=CollectifData::class, inversedBy="dream") | |||||
*/ | */ | ||||
private $collectifData; | private $collectifData; | ||||
private $introAnswer; | private $introAnswer; | ||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=Revolts::class, mappedBy="individualData") | |||||
* @ORM\OneToMany(targetEntity=Revolt::class, mappedBy="individualData") | |||||
*/ | */ | ||||
private $revolts; | |||||
private $revolt; | |||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=Dreams::class, mappedBy="individualData") | |||||
* @ORM\OneToMany(targetEntity=Dream::class, mappedBy="individualData") | |||||
*/ | */ | ||||
private $dreams; | |||||
private $dream; | |||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=ProjectsBoost::class, mappedBy="individualData") | |||||
* @ORM\OneToMany(targetEntity=ProjectBoost::class, mappedBy="individualData") | |||||
*/ | */ | ||||
private $projectsBoost; | |||||
private $projectBoost; | |||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=ProjectsInspiring::class, mappedBy="individualData") | |||||
* @ORM\OneToMany(targetEntity=ProjectInspiring::class, mappedBy="individualData") | |||||
*/ | */ | ||||
private $projectsInspiring; | |||||
private $projectInspiring; | |||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity=Territory::class, inversedBy="individualData") | * @ORM\ManyToOne(targetEntity=Territory::class, inversedBy="individualData") | ||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->revolts = new ArrayCollection(); | |||||
$this->dreams = new ArrayCollection(); | |||||
$this->projectsBoost = new ArrayCollection(); | |||||
$this->projectsInspiring = new ArrayCollection(); | |||||
$this->revolt = new ArrayCollection(); | |||||
$this->dream = new ArrayCollection(); | |||||
$this->projectBoost = new ArrayCollection(); | |||||
$this->projectInspiring = new ArrayCollection(); | |||||
} | } | ||||
public function __toString() | public function __toString() | ||||
} | } | ||||
/** | /** | ||||
* @return Collection|Revolts[] | |||||
* @return Collection|Revolt[] | |||||
*/ | */ | ||||
public function getRevolts(): Collection | |||||
public function getRevolt(): Collection | |||||
{ | { | ||||
return $this->revolts; | |||||
return $this->revolt; | |||||
} | } | ||||
public function addRevolt(Revolts $revolt): self | |||||
public function addRevolt(Revolt $revolt): self | |||||
{ | { | ||||
if (!$this->revolts->contains($revolt)) { | |||||
$this->revolts[] = $revolt; | |||||
if (!$this->revolt->contains($revolt)) { | |||||
$this->revolt[] = $revolt; | |||||
$revolt->setIndividualData($this); | $revolt->setIndividualData($this); | ||||
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
public function removeRevolt(Revolts $revolt): self | |||||
public function removeRevolt(Revolt $revolt): self | |||||
{ | { | ||||
if ($this->revolts->removeElement($revolt)) { | |||||
if ($this->revolt->removeElement($revolt)) { | |||||
// set the owning side to null (unless already changed) | // set the owning side to null (unless already changed) | ||||
if ($revolt->getIndividualData() === $this) { | if ($revolt->getIndividualData() === $this) { | ||||
$revolt->setIndividualData(null); | $revolt->setIndividualData(null); | ||||
} | } | ||||
/** | /** | ||||
* @return Collection|Dreams[] | |||||
* @return Collection|Dream[] | |||||
*/ | */ | ||||
public function getDreams(): Collection | |||||
public function getDream(): Collection | |||||
{ | { | ||||
return $this->dreams; | |||||
return $this->dream; | |||||
} | } | ||||
public function addDream(Dreams $dream): self | |||||
public function addDream(Dream $dream): self | |||||
{ | { | ||||
if (!$this->dreams->contains($dream)) { | |||||
$this->dreams[] = $dream; | |||||
if (!$this->dream->contains($dream)) { | |||||
$this->dream[] = $dream; | |||||
$dream->setIndividualData($this); | $dream->setIndividualData($this); | ||||
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
public function removeDream(Dreams $dream): self | |||||
public function removeDream(Dream $dream): self | |||||
{ | { | ||||
if ($this->dreams->removeElement($dream)) { | |||||
if ($this->dream->removeElement($dream)) { | |||||
// set the owning side to null (unless already changed) | // set the owning side to null (unless already changed) | ||||
if ($dream->getIndividualData() === $this) { | if ($dream->getIndividualData() === $this) { | ||||
$dream->setIndividualData(null); | $dream->setIndividualData(null); | ||||
} | } | ||||
/** | /** | ||||
* @return Collection|ProjectsBoost[] | |||||
* @return Collection|ProjectBoost[] | |||||
*/ | */ | ||||
public function getProjectsBoost(): Collection | |||||
public function getProjectBoost(): Collection | |||||
{ | { | ||||
return $this->projectsBoost; | |||||
return $this->projectBoost; | |||||
} | } | ||||
public function addProjectsBoost(ProjectsBoost $projectsBoost): self | |||||
public function addProjectBoost(ProjectBoost $projectBoost): self | |||||
{ | { | ||||
if (!$this->projectsBoost->contains($projectsBoost)) { | |||||
$this->projectsBoost[] = $projectsBoost; | |||||
$projectsBoost->setIndividualData($this); | |||||
if (!$this->projectBoost->contains($projectBoost)) { | |||||
$this->projectBoost[] = $projectBoost; | |||||
$projectBoost->setIndividualData($this); | |||||
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
public function removeProjectsBoost(ProjectsBoost $projectsBoost): self | |||||
public function removeProjectBoost(ProjectBoost $projectBoost): self | |||||
{ | { | ||||
if ($this->projectsBoost->removeElement($projectsBoost)) { | |||||
if ($this->projectBoost->removeElement($projectBoost)) { | |||||
// set the owning side to null (unless already changed) | // set the owning side to null (unless already changed) | ||||
if ($projectsBoost->getIndividualData() === $this) { | |||||
$projectsBoost->setIndividualData(null); | |||||
if ($projectBoost->getIndividualData() === $this) { | |||||
$projectBoost->setIndividualData(null); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* @return Collection|ProjectsInspiring[] | |||||
* @return Collection|ProjectInspiring[] | |||||
*/ | */ | ||||
public function getProjectsInspiring(): Collection | |||||
public function getProjectInspiring(): Collection | |||||
{ | { | ||||
return $this->projectsInspiring; | |||||
return $this->projectInspiring; | |||||
} | } | ||||
public function addProjectsInspiring(ProjectsInspiring $projectsInspiring): self | |||||
public function addProjectInspiring(ProjectInspiring $projectInspiring): self | |||||
{ | { | ||||
if (!$this->projectsInspiring->contains($projectsInspiring)) { | |||||
$this->projectsInspiring[] = $projectsInspiring; | |||||
$projectsInspiring->setIndividualData($this); | |||||
if (!$this->projectInspiring->contains($projectInspiring)) { | |||||
$this->projectInspiring[] = $projectInspiring; | |||||
$projectInspiring->setIndividualData($this); | |||||
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
public function removeProjectsInspiring(ProjectsInspiring $projectsInspiring): self | |||||
public function removeProjectInspiring(ProjectInspiring $projectInspiring): self | |||||
{ | { | ||||
if ($this->projectsInspiring->removeElement($projectsInspiring)) { | |||||
if ($this->projectInspiring->removeElement($projectInspiring)) { | |||||
// set the owning side to null (unless already changed) | // set the owning side to null (unless already changed) | ||||
if ($projectsInspiring->getIndividualData() === $this) { | |||||
$projectsInspiring->setIndividualData(null); | |||||
if ($projectInspiring->getIndividualData() === $this) { | |||||
$projectInspiring->setIndividualData(null); | |||||
} | } | ||||
} | } | ||||
namespace App\Entity; | namespace App\Entity; | ||||
use App\Repository\ProjectsBoostRepository; | |||||
use App\Repository\ProjectBoostRepository; | |||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use App\Doctrine\Extension\DescriptionProjectInterface; | use App\Doctrine\Extension\DescriptionProjectInterface; | ||||
use App\Doctrine\Extension\DescriptionProjectTrait; | use App\Doctrine\Extension\DescriptionProjectTrait; | ||||
use Lc\SovBundle\Doctrine\EntityInterface; | use Lc\SovBundle\Doctrine\EntityInterface; | ||||
/** | /** | ||||
* @ORM\Entity(repositoryClass=ProjectsBoostRepository::class) | |||||
* @ORM\Entity(repositoryClass=ProjectBoostRepository::class) | |||||
*/ | */ | ||||
class ProjectsBoost implements DescriptionProjectInterface, EntityInterface | |||||
class ProjectBoost implements DescriptionProjectInterface, EntityInterface | |||||
{ | { | ||||
use DescriptionProjectTrait; | use DescriptionProjectTrait; | ||||
private $id; | private $id; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="projectsBoost") | |||||
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="projectBoost") | |||||
*/ | */ | ||||
private $individualData; | private $individualData; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity=CollectifData::class, inversedBy="projectsBoost") | |||||
* @ORM\ManyToOne(targetEntity=CollectifData::class, inversedBy="projectBoost") | |||||
*/ | */ | ||||
private $collectifData; | private $collectifData; | ||||
namespace App\Entity; | namespace App\Entity; | ||||
use App\Repository\ProjectsInspiringRepository; | |||||
use App\Repository\ProjectInspiringRepository; | |||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use App\Doctrine\Extension\DescriptionProjectInterface; | use App\Doctrine\Extension\DescriptionProjectInterface; | ||||
use App\Doctrine\Extension\DescriptionProjectTrait; | use App\Doctrine\Extension\DescriptionProjectTrait; | ||||
use Lc\SovBundle\Doctrine\EntityInterface; | use Lc\SovBundle\Doctrine\EntityInterface; | ||||
/** | /** | ||||
* @ORM\Entity(repositoryClass=ProjectsInspiringRepository::class) | |||||
* @ORM\Entity(repositoryClass=ProjectInspiringRepository::class) | |||||
*/ | */ | ||||
class ProjectsInspiring implements DescriptionProjectInterface, EntityInterface | |||||
class ProjectInspiring implements DescriptionProjectInterface, EntityInterface | |||||
{ | { | ||||
use DescriptionProjectTrait; | use DescriptionProjectTrait; | ||||
private $id; | private $id; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="projectsInspiring") | |||||
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="projectInspiring") | |||||
*/ | */ | ||||
private $individualData; | private $individualData; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity=CollectifData::class, inversedBy="projectsInspiring") | |||||
* @ORM\ManyToOne(targetEntity=CollectifData::class, inversedBy="projectInspiring") | |||||
*/ | */ | ||||
private $collectifData; | private $collectifData; | ||||
namespace App\Entity; | namespace App\Entity; | ||||
use App\Repository\DreamsRepository; | |||||
use App\Repository\RevoltRepository; | |||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use App\Doctrine\Extension\DescriptionProjectInterface; | use App\Doctrine\Extension\DescriptionProjectInterface; | ||||
use App\Doctrine\Extension\DescriptionProjectTrait; | use App\Doctrine\Extension\DescriptionProjectTrait; | ||||
use Lc\SovBundle\Doctrine\EntityInterface; | use Lc\SovBundle\Doctrine\EntityInterface; | ||||
/** | /** | ||||
* @ORM\Entity(repositoryClass=DreamsRepository::class) | |||||
* @ORM\Entity(repositoryClass=RevoltRepository::class) | |||||
*/ | */ | ||||
class Dreams implements DescriptionProjectInterface, EntityInterface | |||||
class Revolt implements DescriptionProjectInterface, EntityInterface | |||||
{ | { | ||||
use DescriptionProjectTrait; | use DescriptionProjectTrait; | ||||
private $id; | private $id; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="dreams") | |||||
* @ORM\ManyToOne(targetEntity=IndividualData::class, inversedBy="revolt") | |||||
*/ | */ | ||||
private $individualData; | private $individualData; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity=CollectifData::class, inversedBy="dreams") | |||||
* @ORM\ManyToOne(targetEntity=CollectifData::class, inversedBy="revolt") | |||||
*/ | */ | ||||
private $collectifData; | private $collectifData; | ||||
<?php | |||||
namespace App\Form; | |||||
use App\Entity\Territory; | |||||
use App\Entity\Thematic; | |||||
use Symfony\Component\Form\Extension\Core\Type\TextType; | |||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||||
use Symfony\Component\Form\AbstractType; | |||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||||
use Symfony\Component\Form\FormBuilderInterface; | |||||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||||
class SearchListForm extends AbstractType | |||||
{ | |||||
public function buildForm(FormBuilderInterface $builder, array $options) | |||||
{ | |||||
$builder | |||||
->add('search', TextType::class, [ | |||||
'required' => false, | |||||
'attr' => [ | |||||
'placeholder' => 'Saisir des critères par mots clés' | |||||
], | |||||
]) | |||||
->add('territory', EntityType::class, [ | |||||
'label' => 'Lieux', | |||||
'class' => Territory::class, | |||||
'expanded' => true, | |||||
'multiple' => true, | |||||
]) | |||||
->add('category', ChoiceType::class, [ | |||||
'label' => 'Catégorie', | |||||
'expanded' => true, | |||||
'multiple' => true, | |||||
'choices' => [ | |||||
'Nos révoltes' => 'revolt', | |||||
'Nos rêves' => 'dream', | |||||
'Les actions à booster' => 'projectBoost', | |||||
'Les actions inspirantes' => 'projectInspiring' | |||||
] | |||||
]) | |||||
->add('thematic', EntityType::class, [ | |||||
'label' => 'Thématique', | |||||
'class' => Thematic::class, | |||||
'expanded' => true, | |||||
'multiple' => true, | |||||
]) | |||||
->add('search_button', SubmitType::class, [ | |||||
'attr' => ['class' => 'search'], | |||||
]); | |||||
} | |||||
public function configureOptions(OptionsResolver $resolver) | |||||
{ | |||||
$resolver->setDefaults([ | |||||
// Configure your form options here | |||||
]); | |||||
} | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
use App\Entity\Dream; | |||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | |||||
use Doctrine\Persistence\ManagerRegistry; | |||||
/** | |||||
* @method Dream|null find($id, $lockMode = null, $lockVersion = null) | |||||
* @method Dream|null findOneBy(array $criteria, array $orderBy = null) | |||||
* @method Dream[] findAll() | |||||
* @method Dream[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||||
*/ | |||||
class DreamRepository extends ServiceEntityRepository | |||||
{ | |||||
public function __construct(ManagerRegistry $registry) | |||||
{ | |||||
parent::__construct($registry, Dream::class); | |||||
} | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
use Knp\Component\Pager\PaginatorInterface; | |||||
class DreamRepositoryQuery extends SearchRepositoryQuery | |||||
{ | |||||
public function __construct(DreamRepository $repository, PaginatorInterface $paginator) | |||||
{ | |||||
parent::__construct($repository, $paginator); | |||||
} | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
class DreamStore extends SearchStore | |||||
{ | |||||
protected $query; | |||||
public function __construct(DreamRepositoryQuery $query) | |||||
{ | |||||
$this->query = $query; | |||||
} | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
use App\Entity\Dreams; | |||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | |||||
use Doctrine\Persistence\ManagerRegistry; | |||||
/** | |||||
* @method Dreams|null find($id, $lockMode = null, $lockVersion = null) | |||||
* @method Dreams|null findOneBy(array $criteria, array $orderBy = null) | |||||
* @method Dreams[] findAll() | |||||
* @method Dreams[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||||
*/ | |||||
class DreamsRepository extends ServiceEntityRepository | |||||
{ | |||||
public function __construct(ManagerRegistry $registry) | |||||
{ | |||||
parent::__construct($registry, Dreams::class); | |||||
} | |||||
// /** | |||||
// * @return Dreams[] Returns an array of Dreams objects | |||||
// */ | |||||
/* | |||||
public function findByExampleField($value) | |||||
{ | |||||
return $this->createQueryBuilder('d') | |||||
->andWhere('d.exampleField = :val') | |||||
->setParameter('val', $value) | |||||
->orderBy('d.id', 'ASC') | |||||
->setMaxResults(10) | |||||
->getQuery() | |||||
->getResult() | |||||
; | |||||
} | |||||
*/ | |||||
/* | |||||
public function findOneBySomeField($value): ?Dreams | |||||
{ | |||||
return $this->createQueryBuilder('d') | |||||
->andWhere('d.exampleField = :val') | |||||
->setParameter('val', $value) | |||||
->getQuery() | |||||
->getOneOrNullResult() | |||||
; | |||||
} | |||||
*/ | |||||
} |
namespace App\Repository; | namespace App\Repository; | ||||
use App\Entity\ProjectsBoost; | |||||
use App\Entity\ProjectBoost; | |||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | ||||
use Doctrine\Persistence\ManagerRegistry; | use Doctrine\Persistence\ManagerRegistry; | ||||
/** | /** | ||||
* @method ProjectsBoost|null find($id, $lockMode = null, $lockVersion = null) | |||||
* @method ProjectsBoost|null findOneBy(array $criteria, array $orderBy = null) | |||||
* @method ProjectsBoost[] findAll() | |||||
* @method ProjectsBoost[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||||
* @method ProjectBoost|null find($id, $lockMode = null, $lockVersion = null) | |||||
* @method ProjectBoost|null findOneBy(array $criteria, array $orderBy = null) | |||||
* @method ProjectBoost[] findAll() | |||||
* @method ProjectBoost[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||||
*/ | */ | ||||
class ProjectsBoostRepository extends ServiceEntityRepository | |||||
class ProjectBoostRepository extends ServiceEntityRepository | |||||
{ | { | ||||
public function __construct(ManagerRegistry $registry) | public function __construct(ManagerRegistry $registry) | ||||
{ | { | ||||
parent::__construct($registry, ProjectsBoost::class); | |||||
parent::__construct($registry, ProjectBoost::class); | |||||
} | } | ||||
// /** | // /** | ||||
// * @return ProjectsBoost[] Returns an array of ProjectsBoost objects | |||||
// * @return ProjectBoost[] Returns an array of ProjectBoost objects | |||||
// */ | // */ | ||||
/* | /* | ||||
public function findByExampleField($value) | public function findByExampleField($value) | ||||
*/ | */ | ||||
/* | /* | ||||
public function findOneBySomeField($value): ?ProjectsBoost | |||||
public function findOneBySomeField($value): ?ProjectBoost | |||||
{ | { | ||||
return $this->createQueryBuilder('p') | return $this->createQueryBuilder('p') | ||||
->andWhere('p.exampleField = :val') | ->andWhere('p.exampleField = :val') |
<?php | |||||
namespace App\Repository; | |||||
use Knp\Component\Pager\PaginatorInterface; | |||||
class ProjectBoostRepositoryQuery extends SearchRepositoryQuery | |||||
{ | |||||
public function __construct(ProjectBoostRepository $repository, PaginatorInterface $paginator) | |||||
{ | |||||
parent::__construct($repository, $paginator); | |||||
} | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
class ProjectBoostStore extends SearchStore | |||||
{ | |||||
protected $query; | |||||
public function __construct(ProjectBoostRepositoryQuery $query) | |||||
{ | |||||
$this->query = $query; | |||||
} | |||||
} |
namespace App\Repository; | namespace App\Repository; | ||||
use App\Entity\ProjectsInspiring; | |||||
use App\Entity\ProjectInspiring; | |||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | ||||
use Doctrine\Persistence\ManagerRegistry; | use Doctrine\Persistence\ManagerRegistry; | ||||
/** | /** | ||||
* @method ProjectsInspiring|null find($id, $lockMode = null, $lockVersion = null) | |||||
* @method ProjectsInspiring|null findOneBy(array $criteria, array $orderBy = null) | |||||
* @method ProjectsInspiring[] findAll() | |||||
* @method ProjectsInspiring[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||||
* @method ProjectInspiring|null find($id, $lockMode = null, $lockVersion = null) | |||||
* @method ProjectInspiring|null findOneBy(array $criteria, array $orderBy = null) | |||||
* @method ProjectInspiring[] findAll() | |||||
* @method ProjectInspiring[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||||
*/ | */ | ||||
class ProjectsInspiringRepository extends ServiceEntityRepository | |||||
class ProjectInspiringRepository extends ServiceEntityRepository | |||||
{ | { | ||||
public function __construct(ManagerRegistry $registry) | public function __construct(ManagerRegistry $registry) | ||||
{ | { | ||||
parent::__construct($registry, ProjectsInspiring::class); | |||||
parent::__construct($registry, ProjectInspiring::class); | |||||
} | } | ||||
// /** | // /** | ||||
// * @return ProjectsInspiring[] Returns an array of ProjectsInspiring objects | |||||
// * @return ProjectInspiring[] Returns an array of ProjectInspiring objects | |||||
// */ | // */ | ||||
/* | /* | ||||
public function findByExampleField($value) | public function findByExampleField($value) | ||||
*/ | */ | ||||
/* | /* | ||||
public function findOneBySomeField($value): ?ProjectsInspiring | |||||
public function findOneBySomeField($value): ?ProjectInspiring | |||||
{ | { | ||||
return $this->createQueryBuilder('p') | return $this->createQueryBuilder('p') | ||||
->andWhere('p.exampleField = :val') | ->andWhere('p.exampleField = :val') |
<?php | |||||
namespace App\Repository; | |||||
use Knp\Component\Pager\PaginatorInterface; | |||||
class ProjectInspiringRepositoryQuery extends SearchRepositoryQuery | |||||
{ | |||||
public function __construct(ProjectInspiringRepository $repository, PaginatorInterface $paginator) | |||||
{ | |||||
parent::__construct($repository, $paginator); | |||||
} | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
class ProjectInspiringStore extends SearchStore | |||||
{ | |||||
protected $query; | |||||
public function __construct(ProjectInspiringRepositoryQuery $query) | |||||
{ | |||||
$this->query = $query; | |||||
} | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
use App\Entity\Revolt; | |||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | |||||
use Doctrine\Persistence\ManagerRegistry; | |||||
/** | |||||
* @method Revolt|null find($id, $lockMode = null, $lockVersion = null) | |||||
* @method Revolt|null findOneBy(array $criteria, array $orderBy = null) | |||||
* @method Revolt[] findAll() | |||||
* @method Revolt[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||||
*/ | |||||
class RevoltRepository extends ServiceEntityRepository | |||||
{ | |||||
public function __construct(ManagerRegistry $registry) | |||||
{ | |||||
parent::__construct($registry, Revolt::class); | |||||
} | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
use Knp\Component\Pager\PaginatorInterface; | |||||
class RevoltRepositoryQuery extends SearchRepositoryQuery | |||||
{ | |||||
public function __construct(RevoltRepository $repository, PaginatorInterface $paginator) | |||||
{ | |||||
parent::__construct($repository, $paginator); | |||||
} | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
class RevoltStore extends SearchStore | |||||
{ | |||||
protected $query; | |||||
public function __construct(RevoltRepositoryQuery $query) | |||||
{ | |||||
$this->query = $query; | |||||
} | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
use App\Entity\Revolts; | |||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | |||||
use Doctrine\Persistence\ManagerRegistry; | |||||
/** | |||||
* @method Revolts|null find($id, $lockMode = null, $lockVersion = null) | |||||
* @method Revolts|null findOneBy(array $criteria, array $orderBy = null) | |||||
* @method Revolts[] findAll() | |||||
* @method Revolts[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||||
*/ | |||||
class RevoltsRepository extends ServiceEntityRepository | |||||
{ | |||||
public function __construct(ManagerRegistry $registry) | |||||
{ | |||||
parent::__construct($registry, Revolts::class); | |||||
} | |||||
// /** | |||||
// * @return Revolts[] Returns an array of Revolts objects | |||||
// */ | |||||
/* | |||||
public function findByExampleField($value) | |||||
{ | |||||
return $this->createQueryBuilder('r') | |||||
->andWhere('r.exampleField = :val') | |||||
->setParameter('val', $value) | |||||
->orderBy('r.id', 'ASC') | |||||
->setMaxResults(10) | |||||
->getQuery() | |||||
->getResult() | |||||
; | |||||
} | |||||
*/ | |||||
/* | |||||
public function findOneBySomeField($value): ?Revolts | |||||
{ | |||||
return $this->createQueryBuilder('r') | |||||
->andWhere('r.exampleField = :val') | |||||
->setParameter('val', $value) | |||||
->getQuery() | |||||
->getOneOrNullResult() | |||||
; | |||||
} | |||||
*/ | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
use Doctrine\Common\Collections\ArrayCollection; | |||||
use Gedmo\Tree\RepositoryInterface; | |||||
use Knp\Component\Pager\PaginatorInterface; | |||||
use Lc\SovBundle\Repository\AbstractRepositoryQuery; | |||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class SearchRepositoryQuery extends AbstractRepositoryQuery implements RepositoryQueryInterface | |||||
{ | |||||
protected $isJoinCollectifData = false; | |||||
protected $isJoinIndividualData = false; | |||||
public function __construct($repository, PaginatorInterface $paginator) | |||||
{ | |||||
parent::__construct($repository, 'r', $paginator); | |||||
} | |||||
public function filterIsValid() | |||||
{ | |||||
$this->joinCollectifData(); | |||||
$this->joinIndividualData(); | |||||
return $this | |||||
->andWhere('colData.status = 1 OR indivData.status = 1'); | |||||
} | |||||
public function filterByThematic(ArrayCollection $thematicArray): self | |||||
{ | |||||
return $this | |||||
->andWhere('.thematic IN (:thematic)') | |||||
->setParameter(':thematic', $thematicArray); | |||||
} | |||||
public function filterByDescription(string $description): self | |||||
{ | |||||
return $this | |||||
->andWhere('.description LIKE :description') | |||||
->setParameter(':description', '%' . $description . '%'); | |||||
} | |||||
public function filterByTerritory(ArrayCollection $territoryArray): self | |||||
{ | |||||
$this->joinCollectifData(); | |||||
$this->joinIndividualData(); | |||||
return $this | |||||
->andWhere('colData.territory IN (:territory) OR indivData.territory IN (:territory)') | |||||
->setParameter(':territory', $territoryArray); | |||||
} | |||||
public function joinCollectifData(): self | |||||
{ | |||||
if (!$this->isJoinCollectifData) { | |||||
$this->isJoinCollectifData = true; | |||||
return $this | |||||
->leftJoin('.collectifData', 'colData'); | |||||
} | |||||
return $this; | |||||
} | |||||
public function joinIndividualData(): self | |||||
{ | |||||
if (!$this->isJoinIndividualData) { | |||||
$this->isJoinIndividualData = true; | |||||
return $this | |||||
->leftJoin('.individualData', 'indivData'); | |||||
} | |||||
return $this; | |||||
} | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
use Doctrine\Common\Collections\ArrayCollection; | |||||
use Lc\SovBundle\Repository\AbstractStore; | |||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
use Lc\SovBundle\Repository\StoreInterface; | |||||
class SearchStore extends AbstractStore implements StoreInterface | |||||
{ | |||||
public function __construct($query) | |||||
{ | |||||
$this->query = $query; | |||||
} | |||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->orderBy('id'); | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$query->filterIsValid(); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function filterSearch( | |||||
?string $description, | |||||
ArrayCollection $territoryArray, | |||||
ArrayCollection $thematicArray, | |||||
$query = null | |||||
) { | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | |||||
->filterByThematic($thematicArray) | |||||
->filterByTerritory($territoryArray); | |||||
if (!empty($description)) { | |||||
$query->filterByDescription($description); | |||||
} | |||||
return $query->find(); | |||||
} | |||||
} |
namespace App\Type; | namespace App\Type; | ||||
use App\Entity\Dreams; | |||||
use App\Entity\Dream; | |||||
use App\Entity\Thematic; | use App\Entity\Thematic; | ||||
use Lc\SovBundle\Doctrine\EntityManager; | use Lc\SovBundle\Doctrine\EntityManager; | ||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | ||||
use Symfony\Component\Validator\Constraints\NotBlank; | use Symfony\Component\Validator\Constraints\NotBlank; | ||||
class DreamsType extends AbstractType | |||||
class DreamType extends AbstractType | |||||
{ | { | ||||
protected $em; | protected $em; | ||||
'description', | 'description', | ||||
TextareaType::class, | TextareaType::class, | ||||
[ | [ | ||||
'label' => 'form.field.dreams.description', | |||||
'label' => 'form.field.dream.description', | |||||
'constraints' => [ | 'constraints' => [ | ||||
new NotBlank(), | new NotBlank(), | ||||
], | ], | ||||
'thematic', | 'thematic', | ||||
EntityType::class, | EntityType::class, | ||||
[ | [ | ||||
'label' => 'form.field.dreams.thematic', | |||||
'label' => 'form.field.dream.thematic', | |||||
'class' => Thematic::class, | 'class' => Thematic::class, | ||||
'required' => false, | 'required' => false, | ||||
] | ] | ||||
{ | { | ||||
$resolver->setDefaults( | $resolver->setDefaults( | ||||
[ | [ | ||||
'data_class' => $this->em->getEntityName(Dreams::class), | |||||
'data_class' => $this->em->getEntityName(Dream::class), | |||||
] | ] | ||||
); | ); | ||||
} | } |
namespace App\Type; | namespace App\Type; | ||||
use App\Entity\ProjectsBoost; | |||||
use App\Entity\ProjectBoost; | |||||
use App\Entity\Thematic; | use App\Entity\Thematic; | ||||
use Lc\SovBundle\Doctrine\EntityManager; | use Lc\SovBundle\Doctrine\EntityManager; | ||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | ||||
use Symfony\Component\Validator\Constraints\NotBlank; | use Symfony\Component\Validator\Constraints\NotBlank; | ||||
class ProjectsBoostType extends AbstractType | |||||
class ProjectBoostType extends AbstractType | |||||
{ | { | ||||
protected $em; | protected $em; | ||||
'description', | 'description', | ||||
TextareaType::class, | TextareaType::class, | ||||
[ | [ | ||||
'label' => 'form.field.projectsboost.description', | |||||
'label' => 'form.field.projectBoost.description', | |||||
'constraints' => [ | 'constraints' => [ | ||||
new NotBlank(), | new NotBlank(), | ||||
], | ], | ||||
'thematic', | 'thematic', | ||||
EntityType::class, | EntityType::class, | ||||
[ | [ | ||||
'label' => 'form.field.projectsboost.thematic', | |||||
'label' => 'form.field.projectBoost.thematic', | |||||
'class' => Thematic::class, | 'class' => Thematic::class, | ||||
'required' => false, | 'required' => false, | ||||
] | ] | ||||
{ | { | ||||
$resolver->setDefaults( | $resolver->setDefaults( | ||||
[ | [ | ||||
'data_class' => $this->em->getEntityName(ProjectsBoost::class), | |||||
'data_class' => $this->em->getEntityName(ProjectBoost::class), | |||||
] | ] | ||||
); | ); | ||||
} | } |
namespace App\Type; | namespace App\Type; | ||||
use App\Entity\ProjectsInspiring; | |||||
use App\Entity\ProjectInspiring; | |||||
use App\Entity\Thematic; | use App\Entity\Thematic; | ||||
use Lc\SovBundle\Doctrine\EntityManager; | use Lc\SovBundle\Doctrine\EntityManager; | ||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | ||||
use Symfony\Component\Validator\Constraints\NotBlank; | use Symfony\Component\Validator\Constraints\NotBlank; | ||||
class ProjectsInspiringType extends AbstractType | |||||
class ProjectInspiringType extends AbstractType | |||||
{ | { | ||||
protected $em; | protected $em; | ||||
'description', | 'description', | ||||
TextareaType::class, | TextareaType::class, | ||||
[ | [ | ||||
'label' => 'form.field.projectsinspiring.description', | |||||
'label' => 'form.field.projectinspiring.description', | |||||
'constraints' => [ | 'constraints' => [ | ||||
new NotBlank(), | new NotBlank(), | ||||
], | ], | ||||
'thematic', | 'thematic', | ||||
EntityType::class, | EntityType::class, | ||||
[ | [ | ||||
'label' => 'form.field.projectsinspiring.thematic', | |||||
'label' => 'form.field.projectinspiring.thematic', | |||||
'class' => Thematic::class, | 'class' => Thematic::class, | ||||
'required' => false, | 'required' => false, | ||||
] | ] | ||||
{ | { | ||||
$resolver->setDefaults( | $resolver->setDefaults( | ||||
[ | [ | ||||
'data_class' => $this->em->getEntityName(ProjectsInspiring::class), | |||||
'data_class' => $this->em->getEntityName(ProjectInspiring::class), | |||||
] | ] | ||||
); | ); | ||||
} | } |
namespace App\Type; | namespace App\Type; | ||||
use App\Entity\Revolts; | |||||
use App\Entity\Revolt; | |||||
use App\Entity\Thematic; | use App\Entity\Thematic; | ||||
use Lc\SovBundle\Doctrine\EntityManager; | use Lc\SovBundle\Doctrine\EntityManager; | ||||
use Lc\SovBundle\Translation\TranslatorAdmin; | use Lc\SovBundle\Translation\TranslatorAdmin; | ||||
use Symfony\Component\OptionsResolver\OptionsResolver; | use Symfony\Component\OptionsResolver\OptionsResolver; | ||||
use Symfony\Component\Validator\Constraints\NotBlank; | use Symfony\Component\Validator\Constraints\NotBlank; | ||||
class RevoltsType extends AbstractType | |||||
class RevoltType extends AbstractType | |||||
{ | { | ||||
protected $em; | protected $em; | ||||
'description', | 'description', | ||||
TextareaType::class, | TextareaType::class, | ||||
[ | [ | ||||
'label' => 'form.field.revolts.description', | |||||
'label' => 'form.field.revolt.description', | |||||
'constraints' => [ | 'constraints' => [ | ||||
new NotBlank(), | new NotBlank(), | ||||
], | ], | ||||
'thematic', | 'thematic', | ||||
EntityType::class, | EntityType::class, | ||||
[ | [ | ||||
'label' => 'form.field.revolts.thematic', | |||||
'label' => 'form.field.revolt.thematic', | |||||
'class' => Thematic::class, | 'class' => Thematic::class, | ||||
'required' => false, | 'required' => false, | ||||
] | ] | ||||
{ | { | ||||
$resolver->setDefaults( | $resolver->setDefaults( | ||||
[ | [ | ||||
'data_class' => $this->em->getEntityName(Revolts::class), | |||||
'data_class' => $this->em->getEntityName(Revolt::class), | |||||
] | ] | ||||
); | ); | ||||
} | } |
{# </div>#} | {# </div>#} | ||||
{# <div class="row">#} | {# <div class="row">#} | ||||
{# <div class="col-sm-6 col-xs-12">#} | {# <div class="col-sm-6 col-xs-12">#} | ||||
{# {{ minfobox.infobox("Nombre de rêves ", nbDreams, "blue", "far fa-lightbulb") }}#} | |||||
{# {{ minfobox.infobox("Nombre de rêves ", nbDream, "blue", "far fa-lightbulb") }}#} | |||||
{# </div>#} | {# </div>#} | ||||
{# <div class="col-sm-6 col-xs-12">#} | {# <div class="col-sm-6 col-xs-12">#} | ||||
{# {{ minfobox.infobox("Nombre de révoltes ", nbRevolts, "red", "fas fa-bullhorn") }}#} | |||||
{# {{ minfobox.infobox("Nombre de révoltes ", nbRevolt, "red", "fas fa-bullhorn") }}#} | |||||
{# </div>#} | {# </div>#} | ||||
{# </div>#} | {# </div>#} | ||||
{# <div class="row">#} | {# <div class="row">#} | ||||
{# <div class="col-sm-6 col-xs-12">#} | {# <div class="col-sm-6 col-xs-12">#} | ||||
{# {{ minfobox.infobox("Nombre de projets boostés ", nbProjectsBoost, "indigo", "fas fa-thumbs-up") }}#} | |||||
{# {{ minfobox.infobox("Nombre de projets boostés ", nbProjectBoost, "indigo", "fas fa-thumbs-up") }}#} | |||||
{# </div>#} | {# </div>#} | ||||
{# <div class="col-sm-6 col-xs-12">#} | {# <div class="col-sm-6 col-xs-12">#} | ||||
{# {{ minfobox.infobox("Nombre de projets inspirants ", nbProjectsInsp, "blue", "fas fa-smile") }}#} | {# {{ minfobox.infobox("Nombre de projets inspirants ", nbProjectsInsp, "blue", "fas fa-smile") }}#} |
{% block carto %} | {% block carto %} | ||||
<div id="carto-liste"> | <div id="carto-liste"> | ||||
<h1 class="title-liste">La liste simple... et rêvolutionnaire !</h1> | <h1 class="title-liste">La liste simple... et rêvolutionnaire !</h1> | ||||
{{ form_start(form) }} | |||||
{{ form_errors(form) }} | |||||
{{ form_row(form.search) }} | |||||
{{ form_row(form.territory) }} | |||||
{{ form_row(form.category) }} | |||||
{{ form_row(form.thematic) }} | |||||
{{ form_row(form.search_button, { 'label': 'Rechercher' }) }} | |||||
{{ form_end(form) }} | |||||
</div> | </div> | ||||
{% endblock %} | {% endblock %} |
fields: | fields: | ||||
territory: Territoire | territory: Territoire | ||||
nbParticipant: Nombre de participants | nbParticipant: Nombre de participants | ||||
revolts: Les révoltes | |||||
dreams: Les rêves | |||||
projectsboost: Les projets boostés | |||||
projectsinspiring: Les projets inspirants | |||||
revolt: Les révoltes | |||||
dream: Les rêves | |||||
projectBoost: Les projets boostés | |||||
projectinspiring: Les projets inspirants | |||||
resume: Résumé | resume: Résumé | ||||
nbDreams: Rêve(s) | |||||
nbRevolts: Révolte(s) | |||||
nbProjectsBoost: Projet(s) boosté(s) | |||||
nbProjectsInspiring: Projet(s) inspirant(s) | |||||
nbDream: Rêve(s) | |||||
nbRevolt: Révolte(s) | |||||
nbProjectBoost: Projet(s) boosté(s) | |||||
nbProjectInspiring: Projet(s) inspirant(s) | |||||
IndividualData: | IndividualData: | ||||
label: Données individuel | label: Données individuel | ||||
label_plurial: Données du formulaire individuel | label_plurial: Données du formulaire individuel | ||||
label: Configuration | label: Configuration | ||||
form: | form: | ||||
field: | field: | ||||
dreams: | |||||
dream: | |||||
description: Description | description: Description | ||||
thematic: Thématique | thematic: Thématique | ||||
projectsboost: | |||||
projectBoost: | |||||
description: Description | description: Description | ||||
thematic: Thématique | thematic: Thématique | ||||
projectsinspiring: | |||||
projectinspiring: | |||||
description: Description | description: Description | ||||
thematic: Thématique | thematic: Thématique | ||||
revolts: | |||||
revolt: | |||||
description: Description | description: Description | ||||
thematic: Thématique | thematic: Thématique |