hadeli / lpcanvas Goto Github PK
View Code? Open in Web Editor NEWTemplate for LP
Template for LP
Jouer la commande suivante à la racine de votre projet
composer require symfony/serializer-pack
App\Entity\User
$id
-> int
$firstName
-> string
$lastName
-> string
$birthDate
-> \DateTime
$updatedAt
-> \DateTime
App\Controller\UserController
Symfony\Bundle\FrameworkBundle\Controller\AbstractController
/user/{lastName}/{firstName}
lastName
-> string
firstName
-> string
Doit construire un objet User
qui contient les données reçu par le controller
Renvoie le json
avec $this->json($data);
Regarder le retour json
App\Services\Normalizer\UserSerializer
Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface
La serialisation doit renvoyer les données suivantes :
{
"id": 4,
"firstName": "Bob",
"lastName": "Bobby",
"birthDate": "2000-05-04"
}
App\Controller\UserController
Symfony\Bundle\FrameworkBundle\Controller\AbstractController
/user/list
Renvoie une liste de User
HelloController
dans le dossier src/HelloController
helloAction
qui renvoie une JsonResponse
. Le contenu importe peuroutes.yaml
numberAction
$number
JsonResponse
contenant $number
numberAction
$number
. C'est obligatoirement un nombreJsonResponse
contenant $number
putAction
JsonResponse
contenant ce que vous voulezPUT
plane.yaml
plane.yaml
dans le dossier config/routes
/
GET
/
PUT
/{id}
GET
id
-> int
/{id}
PATCH
id
-> int
/{id}
DELETE
id
-> int
config/routes.yaml
config/routes.yaml
, importer le fichier plane.yaml
. Voici une exempleboat:
resource: './routes/boat.yaml'
prefix: /boat
Dans votre controller PlaneController
, créer les actions correspondantes à toutes les routes citées dans la première partie
Ces routes doivent renvoyer des codes HTTP logiques (Pas que des 200
)
curl -i -X GET http://localhost:8000/plane/
curl -i -X PUT -d name='Le Gros Avion' model='A380' code='QUANTUM' manufacturer='BOB' http://localhost:8000/plane/5
curl -i -X PATCH -d name='Le Pas Si Gros Avion' http://localhost:8000/plane/5
curl -i -X DELETE http://localhost:8000/plane/5
Jouer la commande suivante à la racine de votre projet
composer require symfony/orm-pack
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
--
-- Host: 127.0.0.1 Database: example
-- ------------------------------------------------------
-- Server version 8.0.18
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `airport`
--
DROP TABLE IF EXISTS `airport`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `airport` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(5) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `airport`
--
LOCK TABLES `airport` WRITE;
/*!40000 ALTER TABLE `airport` DISABLE KEYS */;
/*!40000 ALTER TABLE `airport` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `flight`
--
DROP TABLE IF EXISTS `flight`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `flight` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`departure_airport` int(11) DEFAULT NULL,
`arrival_airport` int(11) DEFAULT NULL,
`departure_datetime` datetime DEFAULT NULL,
`arrival_departure` datetime DEFAULT NULL,
`main_pilot` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `flight_arrival_fk` (`arrival_airport`),
KEY `flight_departure_fk` (`departure_airport`),
KEY `flight_pilot_fk` (`main_pilot`),
CONSTRAINT `flight_arrival_fk` FOREIGN KEY (`arrival_airport`) REFERENCES `airport` (`id`),
CONSTRAINT `flight_departure_fk` FOREIGN KEY (`departure_airport`) REFERENCES `airport` (`id`),
CONSTRAINT `flight_pilot_fk` FOREIGN KEY (`main_pilot`) REFERENCES `pilot` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `flight`
--
LOCK TABLES `flight` WRITE;
/*!40000 ALTER TABLE `flight` DISABLE KEYS */;
/*!40000 ALTER TABLE `flight` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pilot`
--
DROP TABLE IF EXISTS `pilot`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pilot` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(100) DEFAULT NULL,
`last_name` varchar(100) DEFAULT NULL,
`birth_date` date DEFAULT NULL,
`hiring_date` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pilot`
--
LOCK TABLES `pilot` WRITE;
/*!40000 ALTER TABLE `pilot` DISABLE KEYS */;
/*!40000 ALTER TABLE `pilot` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `plane`
--
DROP TABLE IF EXISTS `plane`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `plane` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`model` varchar(25) DEFAULT NULL,
`code` varchar(50) DEFAULT NULL,
`manufacturer` varchar(5) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `plane`
--
LOCK TABLES `plane` WRITE;
/*!40000 ALTER TABLE `plane` DISABLE KEYS */;
/*!40000 ALTER TABLE `plane` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-12-11 6:51:08
App\Entity
AirportController
GET
/airport
GET
/airport/{id}
DELETE
/airport/{id}
FlightController
GET
/flight
GET
/flight/{id}
DELETE
/flight/{id}
PilotController
GET
/pilot
GET
/pilot/{id}
DELETE
/pilot/{id}
PlaneController
GET
/plane
GET
/plane/{id}
DELETE
/plane/{id}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.