diff --git a/src/Entity/Parties.php b/src/Entity/Parties.php index 63c7e48..bb6b954 100644 --- a/src/Entity/Parties.php +++ b/src/Entity/Parties.php @@ -39,6 +39,11 @@ class Parties */ private $user ; + /** + * @ORM\OneToOne(targetEntity="App\Entity\Resume") + */ + private $resume; + /** * @return mixed */ diff --git a/src/Entity/Resume.php b/src/Entity/Resume.php new file mode 100644 index 0000000..bc1224c --- /dev/null +++ b/src/Entity/Resume.php @@ -0,0 +1,70 @@ +titre; + } + + /** + * @param mixed $titre + */ + public function setTitre($titre): void + { + $this->titre = $titre; + } + + /** + * @return mixed + */ + public function getContenu() + { + return $this->contenu; + } + + /** + * @param mixed $contenu + */ + public function setContenu($contenu): void + { + $this->contenu = $contenu; + } + + /** + * @ORM\Column(type="string") + */ + private $contenu; + + /** + * @ORM\OneToOne(targetEntity="App\Entity\Parties") + */ + private $partie; + + public function getId() + { + return $this->id; + } +} diff --git a/src/Form/ResumeType.php b/src/Form/ResumeType.php new file mode 100644 index 0000000..12fd63a --- /dev/null +++ b/src/Form/ResumeType.php @@ -0,0 +1,43 @@ +add('titre',TextType::class , [ + 'required' => true, + 'label' => 'Titre du résumé', + 'attr' => [ + 'class' => 'titre' + ] + ]) + ->add('contenu',TextareaType::class,[ + 'required' => true, + 'label' => 'Contenu de votre resumé', + 'attr' =>[ + 'class' => 'contenu' + ] + ]) + ->add('envoi' ,SubmitType::class,[ + 'attr' => [ + 'class' => 'send' + ] + ]); + } +} \ No newline at end of file diff --git a/src/Migrations/Version20180325124433.php b/src/Migrations/Version20180326183741.php similarity index 74% rename from src/Migrations/Version20180325124433.php rename to src/Migrations/Version20180326183741.php index 157921f..89e03b2 100644 --- a/src/Migrations/Version20180325124433.php +++ b/src/Migrations/Version20180326183741.php @@ -8,7 +8,7 @@ /** * Auto-generated Migration: Please modify to your needs! */ -class Version20180325124433 extends AbstractMigration +class Version20180326183741 extends AbstractMigration { public function up(Schema $schema) { @@ -19,12 +19,15 @@ public function up(Schema $schema) $this->addSql('CREATE TABLE categories (id INT AUTO_INCREMENT NOT NULL, categorielibelle VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); $this->addSql('CREATE TABLE chat (id INT AUTO_INCREMENT NOT NULL, partie_id INT DEFAULT NULL, pseudo VARCHAR(255) NOT NULL, message VARCHAR(255) NOT NULL, date INT NOT NULL, UNIQUE INDEX UNIQ_659DF2AAE075F7A4 (partie_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); $this->addSql('CREATE TABLE fiche_personnages (id INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, image VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, caracteristique VARCHAR(255) NOT NULL, competence VARCHAR(255) NOT NULL, inventaire VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); - $this->addSql('CREATE TABLE parties (id INT AUTO_INCREMENT NOT NULL, categorie_id INT NOT NULL, user_id INT NOT NULL, nom VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_43631805BCF5E72D (categorie_id), INDEX IDX_43631805A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); + $this->addSql('CREATE TABLE parties (id INT AUTO_INCREMENT NOT NULL, categorie_id INT NOT NULL, user_id INT NOT NULL, resume_id INT DEFAULT NULL, nom VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, INDEX IDX_43631805BCF5E72D (categorie_id), INDEX IDX_43631805A76ED395 (user_id), UNIQUE INDEX UNIQ_43631805D262AF09 (resume_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); + $this->addSql('CREATE TABLE resume (id INT AUTO_INCREMENT NOT NULL, partie_id INT DEFAULT NULL, titre VARCHAR(255) NOT NULL, contenu VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_60C1D0A0E075F7A4 (partie_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); $this->addSql('CREATE TABLE users (id INT AUTO_INCREMENT NOT NULL, login VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:array)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); $this->addSql('ALTER TABLE actualites ADD CONSTRAINT FK_75315B6DA76ED395 FOREIGN KEY (user_id) REFERENCES users (id)'); $this->addSql('ALTER TABLE chat ADD CONSTRAINT FK_659DF2AAE075F7A4 FOREIGN KEY (partie_id) REFERENCES parties (id)'); $this->addSql('ALTER TABLE parties ADD CONSTRAINT FK_43631805BCF5E72D FOREIGN KEY (categorie_id) REFERENCES categories (id)'); $this->addSql('ALTER TABLE parties ADD CONSTRAINT FK_43631805A76ED395 FOREIGN KEY (user_id) REFERENCES users (id)'); + $this->addSql('ALTER TABLE parties ADD CONSTRAINT FK_43631805D262AF09 FOREIGN KEY (resume_id) REFERENCES resume (id)'); + $this->addSql('ALTER TABLE resume ADD CONSTRAINT FK_60C1D0A0E075F7A4 FOREIGN KEY (partie_id) REFERENCES parties (id)'); } public function down(Schema $schema) @@ -34,6 +37,8 @@ public function down(Schema $schema) $this->addSql('ALTER TABLE parties DROP FOREIGN KEY FK_43631805BCF5E72D'); $this->addSql('ALTER TABLE chat DROP FOREIGN KEY FK_659DF2AAE075F7A4'); + $this->addSql('ALTER TABLE resume DROP FOREIGN KEY FK_60C1D0A0E075F7A4'); + $this->addSql('ALTER TABLE parties DROP FOREIGN KEY FK_43631805D262AF09'); $this->addSql('ALTER TABLE actualites DROP FOREIGN KEY FK_75315B6DA76ED395'); $this->addSql('ALTER TABLE parties DROP FOREIGN KEY FK_43631805A76ED395'); $this->addSql('DROP TABLE actualites'); @@ -41,6 +46,7 @@ public function down(Schema $schema) $this->addSql('DROP TABLE chat'); $this->addSql('DROP TABLE fiche_personnages'); $this->addSql('DROP TABLE parties'); + $this->addSql('DROP TABLE resume'); $this->addSql('DROP TABLE users'); } } diff --git a/src/Repository/ResumeRepository.php b/src/Repository/ResumeRepository.php new file mode 100644 index 0000000..c9f70c8 --- /dev/null +++ b/src/Repository/ResumeRepository.php @@ -0,0 +1,50 @@ +createQueryBuilder('r') + ->andWhere('r.exampleField = :val') + ->setParameter('val', $value) + ->orderBy('r.id', 'ASC') + ->setMaxResults(10) + ->getQuery() + ->getResult() + ; + } + */ + + /* + public function findOneBySomeField($value): ?Resume + { + return $this->createQueryBuilder('r') + ->andWhere('r.exampleField = :val') + ->setParameter('val', $value) + ->getQuery() + ->getOneOrNullResult() + ; + } + */ +} diff --git a/templates/Partie/partie.html.twig b/templates/Partie/partie.html.twig index a6e08bb..b4df9d9 100644 --- a/templates/Partie/partie.html.twig +++ b/templates/Partie/partie.html.twig @@ -60,7 +60,15 @@