Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Ajout resume
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodac committed Mar 27, 2018
1 parent 34bd3b3 commit 7dd341b
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/Entity/Parties.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class Parties
*/
private $user ;

/**
* @ORM\OneToOne(targetEntity="App\Entity\Resume")
*/
private $resume;

/**
* @return mixed
*/
Expand Down
70 changes: 70 additions & 0 deletions src/Entity/Resume.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity(repositoryClass="App\Repository\ResumeRepository")
*/
class Resume
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;

/**
* @ORM\Column(type="string")
*/
private $titre;

/**
* @return mixed
*/
public function getTitre()
{
return $this->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;
}
}
43 changes: 43 additions & 0 deletions src/Form/ResumeType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* Created by PhpStorm.
* User: WEBENOO
* Date: 26/03/2018
* Time: 20:39
*/

namespace App\Form;


use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

class ResumeType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->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'
]
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
Expand All @@ -34,13 +37,16 @@ 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');
$this->addSql('DROP TABLE categories');
$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');
}
}
50 changes: 50 additions & 0 deletions src/Repository/ResumeRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace App\Repository;

use App\Entity\Resume;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;

/**
* @method Resume|null find($id, $lockMode = null, $lockVersion = null)
* @method Resume|null findOneBy(array $criteria, array $orderBy = null)
* @method Resume[] findAll()
* @method Resume[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ResumeRepository extends ServiceEntityRepository
{
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, Resume::class);
}

// /**
// * @return Resume[] Returns an array of Resume 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): ?Resume
{
return $this->createQueryBuilder('r')
->andWhere('r.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}
10 changes: 9 additions & 1 deletion templates/Partie/partie.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@
</div>
<div class="Resume">
<div id="Resume">

<div>
{{ form(formresume) }}
</div>
<div>
{% for resumes in resume %}
{{ resumes.titre }}
{{ resumes.contenu }}
{% endfor %}
</div>
</div>
</div>
<div class="Perso">
Expand Down

0 comments on commit 7dd341b

Please sign in to comment.