Affichage de fausse de données
This commit is contained in:
44
migrations/Version20240605084350.php
Normal file
44
migrations/Version20240605084350.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?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 Version20240605084350 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 post (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, species_id INTEGER DEFAULT NULL, found_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
|
||||||
|
, publication_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
|
||||||
|
, latitude DOUBLE PRECISION DEFAULT NULL, longitude DOUBLE PRECISION DEFAULT NULL, altitude DOUBLE PRECISION DEFAULT NULL, commentary CLOB NOT NULL, CONSTRAINT FK_5A8A6C8DB2A1D860 FOREIGN KEY (species_id) REFERENCES species (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_5A8A6C8DB2A1D860 ON post (species_id)');
|
||||||
|
$this->addSql('CREATE TABLE species (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, scientific_name VARCHAR(255) NOT NULL, vernacular_name VARCHAR(255) NOT NULL, region VARCHAR(255) NOT NULL)');
|
||||||
|
$this->addSql('CREATE TABLE messenger_messages (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, body CLOB NOT NULL, headers CLOB NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
|
||||||
|
, available_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
|
||||||
|
, delivered_at DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
|
||||||
|
)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('DROP TABLE post');
|
||||||
|
$this->addSql('DROP TABLE species');
|
||||||
|
$this->addSql('DROP TABLE messenger_messages');
|
||||||
|
}
|
||||||
|
}
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Repository\SpeciesRepository;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
@@ -9,10 +10,11 @@ use Symfony\Component\Routing\Attribute\Route;
|
|||||||
class SpeciesController extends AbstractController
|
class SpeciesController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/species', name: 'app_species')]
|
#[Route('/species', name: 'app_species')]
|
||||||
public function index(): Response
|
public function index(SpeciesRepository $repository): Response
|
||||||
{
|
{
|
||||||
|
$species = $repository->findAll();
|
||||||
return $this->render('species/index.html.twig', [
|
return $this->render('species/index.html.twig', [
|
||||||
'controller_name' => 'SpeciesController',
|
'species' => $species,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{% extends 'base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
{% block title %}Hello SpeciesController!{% endblock %}
|
{% block title %}Herbarium - Espèces{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<style>
|
<style>
|
||||||
@@ -9,12 +9,21 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="example-wrapper">
|
<div class="example-wrapper">
|
||||||
<h1>Hello {{ controller_name }}! ✅</h1>
|
<h1>Liste des espèces</h1>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
{% for specie in species %}
|
||||||
|
<dt>
|
||||||
|
<a href="">
|
||||||
|
🌿 {{ specie.getVernacularName }}
|
||||||
|
</a>
|
||||||
|
</dt>
|
||||||
|
<dd >
|
||||||
|
🔬 Nom Scientifique : {{ specie.getScientificName }}<br/>
|
||||||
|
📍 Region : {{ specie.getRegion }}
|
||||||
|
</dd><br/>
|
||||||
|
{% endfor %}
|
||||||
|
</dl>
|
||||||
|
|
||||||
This friendly message is coming from:
|
|
||||||
<ul>
|
|
||||||
<li>Your controller at <code>C:/wamp64/www/Symfony/herbarium/src/Controller/SpeciesController.php</code></li>
|
|
||||||
<li>Your template at <code>C:/wamp64/www/Symfony/herbarium/templates/species/index.html.twig</code></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Reference in New Issue
Block a user