pull/1/head
root 2018-05-07 11:01:23 +02:00
parent b3e997332c
commit 25fc19b66c
16 changed files with 1788 additions and 1 deletions

View File

@ -15,3 +15,7 @@ APP_SECRET=6be4566096577fa91471d270525115fe
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name
###< doctrine/doctrine-bundle ###
###> nelmio/cors-bundle ###
CORS_ALLOW_ORIGIN=^https?://localhost:?[0-9]*$
###< nelmio/cors-bundle ###

View File

@ -4,6 +4,7 @@
"require": {
"php": "^7.1.3",
"ext-iconv": "*",
"api-platform/api-pack": "^1.1",
"symfony/console": "^4.0",
"symfony/flex": "^1.0",
"symfony/framework-bundle": "^4.0",

1389
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,4 +7,8 @@ return [
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
];

View File

@ -0,0 +1,184 @@
api_platform:
# The title of the API.
title: 'Am I late'
# The description of the API.
description: 'Are you late at HETIC ? Obviously yes.'
# The version of the API.
version: '0.1.1'
# Specify a name converter to use.
name_converter: ~
# Specify a path name generator to use.
path_segment_name_generator: 'api_platform.path_segment_name_generator.underscore'
eager_loading:
# To enable or disable eager loading.
enabled: true
# Fetch only partial data according to serialization groups.
# If enabled, Doctrine ORM entities will not work as expected if any of the other fields are used.
fetch_partial: false
# Max number of joined relations before EagerLoading throws a RuntimeException.
max_joins: 30
# Force join on every relation.
# If disabled, it will only join relations having the EAGER fetch mode.
force_eager: true
# Enable the FOSUserBundle integration.
enable_fos_user: false
# Enable the Nelmio Api doc integration.
enable_nelmio_api_doc: false
# Enable the Swagger documentation and export.
enable_swagger: true
# Enable Swagger ui.
enable_swagger_ui: true
# Enable the entrypoint.
enable_entrypoint: true
# Enable the docs.
enable_docs: true
oauth:
# To enable or disable oauth.
enabled: false
# The oauth client id.
clientId: ''
# The oauth client secret.
clientSecret: ''
# The oauth type.
type: 'oauth2'
# The oauth flow grant type.
flow: 'application'
# The oauth token url.
tokenUrl: '/oauth/v2/token'
# The oauth authentication url.
authorizationUrl: '/oauth/v2/auth'
# The oauth scopes.
scopes: []
graphql:
enabled: false
graphiql:
enabled: true
swagger:
# The swagger api keys.
api_keys: []
collection:
# The default order of results.
order: 'ASC'
# The name of the query parameter to order results.
order_parameter_name: 'order'
pagination:
# To enable or disable pagination for all resource collections by default.
enabled: true
# To allow the client to enable or disable the pagination.
client_enabled: false
# To allow the client to set the number of items per page.
client_items_per_page: false
# The default number of items per page.
items_per_page: 30
# The maximum number of items per page.
maximum_items_per_page: 50
# The default name of the parameter handling the page number.
page_parameter_name: 'page'
# The name of the query parameter to enable or disable pagination.
enabled_parameter_name: 'pagination'
# The name of the query parameter to set the number of items per page.
items_per_page_parameter_name: 'itemsPerPage'
# To allow partial pagination for all resource collections.
# This improves performances by skipping the `COUNT` query.
partial: true
# To allow the client to enable or disable the partial pagination.
client_partial: true
# The name of the query parameter to enable or disable the partial pagination.
partial_parameter_name: 'partial' # Default value
mapping:
# The list of paths with files or directories where the bundle will look for additional resource files.
paths: []
# The list of your resources class directories. Defaults to the directories of the mapping paths but might differ.
resource_class_directories:
- '%kernel.project_dir%/src/Entity'
http_cache:
# Automatically generate etags for API responses.
etag: true
# Default value for the response max age.
max_age: 3600
# Default value for the response shared (proxy) max age.
shared_max_age: 3600
# Default values of the "Vary" HTTP header.
vary: ['Accept']
# To make all responses public by default.
public: ~
invalidation:
# To enable the tags-based cache invalidation system.
enabled: false
# URLs of the Varnish servers to purge using cache tags when a resource is updated.
varnish_urls: []
# The list of exceptions mapped to their HTTP status code.
exception_to_status:
# With a status code.
Symfony\Component\Serializer\Exception\ExceptionInterface: 400
# The list of enabled formats. The first one will be the default.
formats:
jsonld:
mime_types: ['application/ld+json']
json:
mime_types: ['application/json']
html:
mime_types: ['text/html']
# ...
# The list of enabled error formats. The first one will be the default.
error_formats:
jsonproblem:
mime_types: ['application/problem+json']
jsonld:
mime_types: ['application/ld+json']
# ...

View File

@ -0,0 +1,9 @@
nelmio_cors:
defaults:
origin_regex: true
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
allow_headers: ['Content-Type', 'Authorization']
max_age: 3600
paths:
'^/': ~

View File

@ -0,0 +1,24 @@
security:
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
in_memory: { memory: ~ }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: true
# activate different ways to authenticate
# http_basic: true
# https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
# form_login: true
# https://symfony.com/doc/current/security/form_login_setup.html
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }

View File

@ -0,0 +1,7 @@
framework:
default_locale: '%locale%'
translator:
paths:
- '%kernel.project_dir%/translations'
fallbacks:
- '%locale%'

View File

@ -0,0 +1,4 @@
twig:
paths: ['%kernel.project_dir%/templates']
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'

View File

@ -0,0 +1,4 @@
api_platform:
resource: .
type: api_platform
prefix: /api

View File

@ -0,0 +1,3 @@
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error

View File

@ -1,6 +1,7 @@
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: 'en'
services:
# default configuration for services in *this* file

View File

@ -0,0 +1,50 @@
<?php
namespace App\Repository;
use App\Entity\Response;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
/**
* @method Response|null find($id, $lockMode = null, $lockVersion = null)
* @method Response|null findOneBy(array $criteria, array $orderBy = null)
* @method Response[] findAll()
* @method Response[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ResponseRepository extends ServiceEntityRepository
{
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, Response::class);
}
// /**
// * @return Response[] Returns an array of Response 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): ?Response
{
return $this->createQueryBuilder('r')
->andWhere('r.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

View File

@ -1,4 +1,16 @@
{
"api-platform/api-pack": {
"version": "1.1.0"
},
"api-platform/core": {
"version": "2.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "2.1",
"ref": "b50f8aa321cc40c380dda7605aa5cef66f476802"
}
},
"doctrine/annotations": {
"version": "1.0",
"recipe": {
@ -59,6 +71,15 @@
"jdorn/sql-formatter": {
"version": "v1.2.17"
},
"nelmio/cors-bundle": {
"version": "1.5",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.5",
"ref": "7b6cbc842f8cd3d550815247d12294f6f304a8c4"
}
},
"nikic/php-parser": {
"version": "v4.0.1"
},
@ -68,6 +89,15 @@
"ocramius/proxy-manager": {
"version": "2.1.1"
},
"phpdocumentor/reflection-common": {
"version": "1.0.1"
},
"phpdocumentor/reflection-docblock": {
"version": "4.3.0"
},
"phpdocumentor/type-resolver": {
"version": "0.4.0"
},
"psr/cache": {
"version": "1.0.1"
},
@ -80,6 +110,9 @@
"psr/simple-cache": {
"version": "1.0.1"
},
"symfony/asset": {
"version": "v4.0.9"
},
"symfony/cache": {
"version": "v4.0.9"
},
@ -110,6 +143,9 @@
"symfony/event-dispatcher": {
"version": "v4.0.9"
},
"symfony/expression-language": {
"version": "v4.0.9"
},
"symfony/filesystem": {
"version": "v4.0.9"
},
@ -140,6 +176,9 @@
"symfony/http-kernel": {
"version": "v4.0.9"
},
"symfony/inflector": {
"version": "v4.0.9"
},
"symfony/lts": {
"version": "4-dev"
},
@ -161,6 +200,12 @@
"symfony/process": {
"version": "v4.0.9"
},
"symfony/property-access": {
"version": "v4.0.9"
},
"symfony/property-info": {
"version": "v4.0.9"
},
"symfony/routing": {
"version": "4.0",
"recipe": {
@ -170,6 +215,45 @@
"ref": "cda8b550123383d25827705d05a42acf6819fe4e"
}
},
"symfony/security": {
"version": "v4.0.9"
},
"symfony/security-bundle": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "f8a63faa0d9521526499c0a8f403c9964ecb0527"
}
},
"symfony/serializer": {
"version": "v4.0.9"
},
"symfony/translation": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "6bcd6c570c017ea6ae5a7a6a027c929fd3542cd8"
}
},
"symfony/twig-bridge": {
"version": "v4.0.9"
},
"symfony/twig-bundle": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "f75ac166398e107796ca94cc57fa1edaa06ec47f"
}
},
"symfony/validator": {
"version": "v4.0.9"
},
"symfony/web-server-bundle": {
"version": "3.3",
"recipe": {
@ -182,6 +266,15 @@
"symfony/yaml": {
"version": "v4.0.9"
},
"twig/twig": {
"version": "v2.4.8"
},
"webmozart/assert": {
"version": "1.3.0"
},
"willdurand/negotiation": {
"version": "v2.3.1"
},
"zendframework/zend-code": {
"version": "3.3.0"
},

12
templates/base.html.twig Normal file
View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>

0
translations/.gitignore vendored Normal file
View File