Commit eb2195b9 by Julien Jorry

in dev 2 : apiplatform / errors / add classification bundle

parent 36fc65fd
......@@ -7,12 +7,12 @@
"ext-iconv": "*",
"api-platform/api-pack": "^1.2",
"doctrine/annotations": "^1.8",
"friendsofsymfony/rest-bundle": "^2.4",
"friendsofsymfony/user-bundle": "^2.1",
"geocoder-php/cache-provider": "^4.1",
"geocoder-php/google-maps-provider": "^4.3",
"geocoder-php/nominatim-provider": "^5.0",
"knplabs/knp-paginator-bundle": "^2.8",
"lexik/jwt-authentication-bundle": "^2.6",
"lexik/translation-bundle": "~4.0",
"liip/imagine-bundle": "^2.1",
"nelmio/api-doc-bundle": "^3.3",
......@@ -21,36 +21,38 @@
"pixassociates/sortable-behavior-bundle": "^1.5",
"prodigious/sonata-menu-bundle": "^3.0",
"sensio/framework-extra-bundle": "^5.1",
"sonata-project/admin-bundle": "^3.40",
"sonata-project/block-bundle": "^3.12",
"sonata-project/admin-bundle": "^3.65",
"sonata-project/block-bundle": "^3.18",
"sonata-project/classification-bundle": "^3.11",
"sonata-project/doctrine-orm-admin-bundle": "^3.6",
"sonata-project/easy-extends-bundle": "^2.5",
"sonata-project/formatter-bundle": "^4.1",
"sonata-project/intl-bundle": "^2.5",
"sonata-project/media-bundle": "^3.16",
"sonata-project/media-bundle": "^3.24",
"sonata-project/translation-bundle": "^2.4",
"sonata-project/user-bundle": "^4.3",
"stof/doctrine-extensions-bundle": "^1.3",
"symfony/apache-pack": "^1.0",
"symfony/asset": "4.3.*",
"symfony/cache": "4.3.*",
"symfony/console": "4.3.*",
"symfony/expression-language": "4.3.*",
"symfony/asset": "4.4.*",
"symfony/cache": "4.4.*",
"symfony/console": "4.4.*",
"symfony/expression-language": "4.4.*",
"symfony/flex": "^1.1",
"symfony/form": "4.3.*",
"symfony/framework-bundle": "4.3.*",
"symfony/form": "4.4.*",
"symfony/framework-bundle": "4.4.*",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "*",
"symfony/process": "4.3.*",
"symfony/security-bundle": "4.3.*",
"symfony/process": "4.4.*",
"symfony/security-bundle": "4.4.*",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "4.3.*",
"symfony/twig-bundle": "4.3.*",
"symfony/validator": "4.3.*",
"symfony/web-link": "4.3.*",
"symfony/translation": "4.4.*",
"symfony/twig-bundle": "4.4.*",
"symfony/twig-pack": "^1.0",
"symfony/validator": "4.4.*",
"symfony/web-link": "4.4.*",
"symfony/webpack-encore-bundle": "^1.7",
"symfony/yaml": "4.3.*",
"symfony/yaml": "4.4.*",
"vich/uploader-bundle": "^1.8",
"willdurand/geocoder-bundle": "^5.0"
},
......@@ -58,16 +60,16 @@
"doctrine/doctrine-fixtures-bundle": "^3.0",
"hautelook/alice-bundle": "^2.3",
"sensiolabs/security-checker": "^5.0",
"symfony/browser-kit": "4.3.*",
"symfony/css-selector": "4.3.*",
"symfony/browser-kit": "4.4.*",
"symfony/css-selector": "4.4.*",
"symfony/debug-pack": "*",
"symfony/dotenv": "4.3.*",
"symfony/dotenv": "4.4.*",
"symfony/maker-bundle": "^1.0",
"symfony/phpunit-bridge": "4.3.*",
"symfony/phpunit-bridge": "4.4.*",
"symfony/profiler-pack": "*",
"symfony/test-pack": "^1.0",
"symfony/var-dumper": "4.3.*",
"symfony/web-server-bundle": "4.3.*"
"symfony/var-dumper": "4.4.*",
"symfony/web-server-bundle": "4.4.*"
},
"config": {
"preferred-install": {
......@@ -112,7 +114,7 @@
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.3.*"
"require": "4.4.*"
}
}
}
......@@ -31,7 +31,6 @@ return [
Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true],
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true],
Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true],
Hautelook\AliceBundle\HautelookAliceBundle::class => ['dev' => true, 'test' => true],
......@@ -48,4 +47,8 @@ return [
Knp\Bundle\MarkdownBundle\KnpMarkdownBundle::class => ['all' => true],
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
Sonata\FormatterBundle\SonataFormatterBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Sonata\ClassificationBundle\SonataClassificationBundle::class => ['all' => true],
App\Application\Sonata\ClassificationBundle\ApplicationSonataClassificationBundle::class => ['all' => true],
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
];
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-256-CBC,A349B77C39020ABC46D4DF9CDD9B5915
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
-----END RSA PRIVATE KEY-----
api_platform:
enable_fos_user: true
mapping:
paths: ['%kernel.project_dir%/src/Entity']
# App\Entity\Adherent:
# get: ~
# post: ~
# put: ~
# App\Entity\Page:
# get: ~
# post: ~
# put: ~
# App\Entity\Comptoir:
# get: ~
# post: ~
# put: ~
# App\Entity\Cotisation:
# get: ~
# post: ~
# put: ~
# App\Entity\CotisationAdherent:
# get: ~
# post: ~
# put: ~
# App\Entity\CotisationPrestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\CotisationInfos:
# get: ~
# post: ~
# put: ~
# App\Entity\Document:
# get: ~
# post: ~
# put: ~
# App\Entity\EmailToken:
# get: ~
# post: ~
# put: ~
# App\Entity\Faq:
# get: ~
# post: ~
# put: ~
# App\Entity\Flux:
# get: ~
# post: ~
# put: ~
# App\Entity\Geoloc:
# get: ~
# post: ~
# put: ~
# App\Entity\Groupe:
# get: ~
# post: ~
# put: ~
# App\Entity\GroupePrestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\Lien:
# get: ~
# post: ~
# put: ~
# App\Entity\Message:
# get: ~
# post: ~
# put: ~
# App\Entity\News:
# get: ~
# post: ~
# put: ~
# App\Entity\Page:
# get: ~
# post: ~
# put: ~
# App\Entity\Prestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\Rubrique:
# get: ~
# post: ~
# put: ~
# App\Entity\Siege:
# get: ~
# App\Entity\Transaction:
# get: ~
# post: ~
# put: ~
# App\Entity\TransactionAdherentPrestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\TransactionPrestataireAdherent:
# get: ~
# post: ~
# put: ~
# App\Entity\TransactionPrestatairePrestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\Transfert:
# get: ~
# post: ~
# put: ~
# App\Entity\TransfertComptoirGroupe:
# get: ~
# post: ~
# put: ~
# App\Entity\TransfertGroupeComptoir:
# get: ~
# post: ~
# put: ~
# App\Entity\TransfertPrestataireComptoir:
# get: ~
# post: ~
# put: ~
# App\Entity\TransfertSiegeGroupe:
# get: ~
# post: ~
# put: ~
# App\Entity\TypePrestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\User:
# get: ~
# post: ~
# put: ~
# App\Entity\Usergroup:
# get: ~
# post: ~
# put: ~
# Exemple :
# App\Entity\Book:
# itemOperations:
# get:
......
......@@ -18,19 +18,25 @@ doctrine:
json: Sonata\Doctrine\Types\JsonType
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
dql:
string_functions:
str_to_date: App\DQL\StrToDate
filters:
softdeleteable:
class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
enabled: true
entity_managers:
default:
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
ApplicationSonataClassificationBundle: ~
SonataClassificationBundle: ~
ApplicationSonataMediaBundle: ~
SonataMediaBundle: ~
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
dql:
string_functions:
str_to_date: App\DQL\StrToDate
filters:
softdeleteable:
class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
enabled: true
# # Read the documentation: https://symfony.com/doc/master/bundles/FOSRestBundle/index.html
# fos_rest:
# param_fetcher_listener: true
# allowed_methods_listener: true
# routing_loader: true
# view:
# view_response_listener: true
# format_listener:
# rules:
# - { path: ^/api, prefer_extension: true, fallback_format: json, priorities: [ json, html ] }
fos_rest:
param_fetcher_listener: true
body_listener: true
format_listener: true
view:
view_response_listener: force
body_converter:
enabled: true
validate: true
exception:
codes:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
'App\Exception\BadRequestDataException': HTTP_BAD_REQUEST
messages:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': true
'App\Exception\BadRequestDataException': true
# exception_controller: 'fos_rest.exception.controller:showAction'
# format_listener: ~
# rules:
# - { path: ^/api, prefer_extension: true, fallback_format: json, priorities: [ json, html ] }
#- { path: '^/', priorities: ['json'], fallback_format: 'json', prefer_extension: true }
sensio_framework_extra:
# view: { annotations: true }
router: { annotations: true }
request: { converters: true }
twig:
exception_controller: 'FOS\RestBundle\Controller\ExceptionController::showAction'
# FROM https://www.sgalinski.de/typo3-agentur/technik/how-to-create-a-basic-rest-api-in-symfony/
# fos_rest:
# param_fetcher_listener: true
# view:
# view_response_listener: 'force'
# formats:
# xml: true
# json: true
# templating_formats:
# html: true
# format_listener:
# rules:
# - { path: ^/, priorities: [ json, xml, html ], fallback_format: ~, prefer_extension: true }
# exception:
# codes:
# 'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
# 'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
# 'SGalinski\TypoScriptBackendBundle\Exception\BadRequestDataException': HTTP_BAD_REQUEST
# messages:
# 'Symfony\Component\Routing\Exception\ResourceNotFoundException': true
# 'SGalinski\TypoScriptBackendBundle\Exception\BadRequestDataException': true
# allowed_methods_listener: true
# access_denied_listener:
# json: true
# body_listener: true
# disable_csrf_role: ROLE_API
\ No newline at end of file
framework:
form: { enabled: true }
templating: { engines: ['twig'] }
secret: '%env(APP_SECRET)%'
#default_locale: en
......@@ -16,6 +17,8 @@ framework:
php_errors:
log: true
serializer: { enable_annotations: true }
cache:
# Put the unique name of your app here: the prefix seed
# is used to compute stable namespaces for cache keys.
......
lexik_jwt_authentication:
secret_key: '%env(resolve:JWT_SECRET_KEY)%'
public_key: '%env(resolve:JWT_PUBLIC_KEY)%'
pass_phrase: '%env(JWT_PASSPHRASE)%'
# nelmio_api_doc:
# areas:
# path_patterns: # an array of regexps
# - ^/api(?!/doc$)
# host_patterns:
# - ^api\.
# documentation:
# host: api.example.com
# schemes: [http, https]
# info:
# title: My App
# description: This is an awesome app!
# version: 1.0.0
# securityDefinitions:
# Bearer:
# type: apiKey
# description: 'Value: Bearer {jwt}'
# name: Authorization
# in: header
# security:
# - Bearer: []
# Optional!
nelmio_api_doc:
# models: { use_jms: true }
documentation:
info:
title: MLC
description: Application de gesiton de Monnaie Locale Complémentaire
version: 1.0.0
version: 2.3.0
security_definitions:
api_key:
type: apiKey
......
......@@ -29,6 +29,10 @@ security:
fos_userbundle:
id: fos_user.user_provider.username_email
in_memory: { memory: ~ }
entity_provider:
entity:
class: App\Entity\User
property: username
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
......@@ -79,6 +83,14 @@ security:
switch_user:
provider: fos_userbundle
# access_denied_handler: App\Security\AccessDeniedHandler
api:
pattern: ^/api
stateless: true
anonymous: false
provider: entity_provider
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt
......@@ -112,5 +124,6 @@ security:
# Change these rules to adapt them to your needs
# - { path: ^/admin/, role: [ROLE_SUPER_ADMIN, ROLE_SONATA_ADMIN, ROLE_ADMIN_SIEGE, ROLE_REDACTEUR, ROLE_TRESORIER, ROLE_CONTROLEUR, ROLE_GESTION_GROUPE, ROLE_COMPTOIR, ROLE_CONTACT] }
- { path: ^/admin/, role: [ROLE_ADMIN] }
- { path: ^/api, roles: IS_AUTHENTICATED_FULLY }
- { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
sonata_classification:
class:
category: App\Application\Sonata\ClassificationBundle\Entity\Category
collection: App\Application\Sonata\ClassificationBundle\Entity\Collection
context: App\Application\Sonata\ClassificationBundle\Entity\Context
tag: App\Application\Sonata\ClassificationBundle\Entity\Tag
media: App\Application\Sonata\MediaBundle\Entity\Media
......@@ -2,6 +2,7 @@ sonata_media:
db_driver: doctrine_orm
class:
media: App\Application\Sonata\MediaBundle\Entity\Media
category: App\Application\Sonata\ClassificationBundle\Entity\Category
gallery: App\Application\Sonata\MediaBundle\Entity\Gallery
gallery_has_media: App\Application\Sonata\MediaBundle\Entity\GalleryHasMedia
default_context: default
......
......@@ -2,7 +2,7 @@ controllers:
resource: ../../src/Controller/
type: annotation
rest_controllers:
resource: ../../src/Controller/Rest/
type: annotation
prefix: /api
# rest_controllers:
# resource: ../../src/Controller/Rest/
# type: annotation
# prefix: /api
......@@ -131,7 +131,7 @@ App\Entity\Prestataire:
iban: '<text(10)>'
statut: '<text(10)>'
siret: '<text(10)>'
users: ['@user_prestataire']
users: ['@userprestataire']
typeprestataire: '@typepresta<numberBetween(1,2)>'
rubriques: '1x @rubrique<numberBetween(1,21)>'
groupe: '@groupe<numberBetween(1, 10)>'
......@@ -209,7 +209,7 @@ App\Entity\CotisationAdherent:
montant: 10
moyen: 'espece'
expediteur: '@adherent1'
destinataire: '@siege_1'
destinataire: '@prestatairemlc'
createdAt: '<dateTimeBetween("-200 days", "now")>'
cotisation{2..11}:
operateur: '@usera<current()>'
......@@ -220,7 +220,7 @@ App\Entity\CotisationAdherent:
montant: 10
moyen: 'cb'
expediteur: '@adherent<current()>'
destinataire: '@siege_1'
destinataire: '@prestatairemlc'
createdAt: '<dateTimeBetween("-200 days", "now")>'
App\Entity\CotisationPrestataire:
cotisationp{2..32}:
......@@ -232,7 +232,7 @@ App\Entity\CotisationPrestataire:
montant: 10
moyen: 'cb'
expediteur: '@prestataire<current()>'
destinataire: '@siege_1'
destinataire: '@prestatairemlc'
createdAt: '<dateTimeBetween("-200 days", "now")>'
App\Entity\User:
......
......@@ -9,6 +9,12 @@
>
<php>
<ini name="error_reporting" value="-1" />
<!-- ###+ lexik/jwt-authentication-bundle ### -->
<env name="JWT_SECRET_KEY" value="%kernel.project_dir%/config/jwt/private.pem"/>
<env name="JWT_PUBLIC_KEY" value="%kernel.project_dir%/config/jwt/public.pem"/>
<env name="JWT_PASSPHRASE" value="5dcea5f3b1917d7a4829199d10e219c9"/>
<!-- ###- lexik/jwt-authentication-bundle ### -->
</php>
<testsuites>
......
......@@ -34,9 +34,7 @@ class CotisationAdmin extends AbstractAdmin
{
protected $baseRouteName = 'cotisation';
protected $baseRoutePattern = 'cotisation';
protected $em;
protected $security;
protected $container;
protected $translator;
protected $datagridValues = [
......@@ -44,11 +42,9 @@ class CotisationAdmin extends AbstractAdmin
'_sort_by' => 'createdAt',
];
public function setSecurity(Security $security, ContainerInterface $container, EntityManagerInterface $em)
public function setSecurity(Security $security)
{
$this->em = $em;
$this->security = $security;
$this->container = $container;
}
/**
......@@ -70,16 +66,17 @@ class CotisationAdmin extends AbstractAdmin
{
$cotisation = $this->getSubject();
$now = new \DateTime();
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$formMapper
->with('Cotisation', ['class' => 'col-md-8'])
->add('parenttype', HiddenType::class, array(
'data' => 'cotisation'
))
->add('destinataire', HiddenType::class, array(
'data' => 1,
'data' => $em->getRepository(Prestataire::class)->findBy(array('mlc' => true)),
'data_class' => null,
'entity_class' => Siege::class,
'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager()
'entity_class' => Prestataire::class,
'em' => $em
))
->add('cotisationInfos.annee', null, array(
'label' => 'Année',
......
<?php
namespace App\Controller;
use FOS\RestBundle\Controller\FOSRestController;
use App\Exception\BadRequestDataException;
namespace App\Application\Sonata\ClassificationBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Class ExceptionFOSRestController passes the error messages to FOSRest-registered exception.
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* @package SGalinski\TypoScriptBackendBundle\Controller
* References:
* @link http://symfony.com/doc/current/book/bundles.html
*/
abstract class ExceptionFOSRestController extends FOSRestController
class ApplicationSonataClassificationBundle extends Bundle
{
/**
* Makes response from given exception.
*
* @param \Exception $exception
* @throws BadRequestDataException
* {@inheritdoc}
*/
protected function throwFosrestSupportedException(\Exception $exception)
public function getParent()
{
throw new BadRequestDataException($exception->getMessage());
return 'SonataClassificationBundle';
}
}
<?php
namespace App\Application\Sonata\ClassificationBundle\Document;
use Sonata\ClassificationBundle\Document\BaseCategory as BaseCategory;
/**
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* References:
* @link http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html
*/
class Category extends BaseCategory
{
/**
* @var int $id
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
<?php
namespace App\Application\Sonata\ClassificationBundle\Document;
use Sonata\ClassificationBundle\Document\BaseTag as BaseTag;
/**
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* References:
* @link http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html
*/
class Tag extends BaseTag
{
/**
* @var int $id
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
<?php
namespace App\Application\Sonata\ClassificationBundle\Entity;
use Sonata\ClassificationBundle\Entity\BaseCategory as BaseCategory;
/**
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
*/
class Category extends BaseCategory
{
/**
* @var int $id
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
<?php
namespace App\Application\Sonata\ClassificationBundle\Entity;
use Sonata\ClassificationBundle\Entity\BaseCollection as BaseCollection;
/**
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
*/
class Collection extends BaseCollection
{
/**
* @var int $id
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
<?php
namespace App\Application\Sonata\ClassificationBundle\Entity;
use Sonata\ClassificationBundle\Entity\BaseContext as BaseContext;
/**
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
*/
class Context extends BaseContext
{
/**
* @var int $id
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
<?php
namespace App\Application\Sonata\ClassificationBundle\Entity;
use Sonata\ClassificationBundle\Entity\BaseTag as BaseTag;
/**
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
*/
class Tag extends BaseTag
{
/**
* @var int $id
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mongo-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mongo-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mongo-mapping
http://doctrine-project.org/schemas/orm/doctrine-mongo-mapping.xsd">
<document name="App\Application\Sonata\ClassificationBundle\Document\Category" collection="classificationCategory">
<id fieldName="id" id="true" />
</document>
</doctrine-mongo-mapping>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( https://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="App\Application\Sonata\ClassificationBundle\Entity\Category"
table="classification__category"
repository-class="Doctrine\ORM\EntityRepository">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( https://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="App\Application\Sonata\ClassificationBundle\Entity\Collection"
table="classification__collection"
repository-class="Doctrine\ORM\EntityRepository">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( https://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="App\Application\Sonata\ClassificationBundle\Entity\Context"
table="classification__context"
repository-class="Doctrine\ORM\EntityRepository">
<id name="id" type="string" column="id">
<generator strategy="NONE"/>
</id>
</entity>
</doctrine-mapping>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mongo-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mongo-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mongo-mapping
http://doctrine-project.org/schemas/orm/doctrine-mongo-mapping.xsd">
<document name="App\Application\Sonata\ClassificationBundle\Document\Tag" collection="newsTag">
<id fieldName="id" id="true" />
</document>
</doctrine-mongo-mapping>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( https://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="App\Application\Sonata\ClassificationBundle\Entity\Tag"
table="classification__tag"
repository-class="Doctrine\ORM\EntityRepository">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!-- This file has been generated by the SonataEasyExtendsBundle: https://sonata-project.org/bundles/easy-extends -->
<class name="App\Application\Sonata\ClassificationBundle\Document\Category" exclusion-policy="all" xml-root-name="_category">
<property xml-attribute-map="true" name="id" type="integer" expose="true" since-version="1.0" groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!-- This file has been generated by the SonataEasyExtendsBundle: https://sonata-project.org/bundles/easy-extends -->
<class name="App\Application\Sonata\ClassificationBundle\Document\Tag" exclusion-policy="all" xml-root-name="_tag">
<property xml-attribute-map="true" name="id" type="integer" expose="true" since-version="1.0" groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!-- This file has been generated by the SonataEasyExtendsBundle: https://sonata-project.org/bundles/easy-extends -->
<class name="App\Application\Sonata\ClassificationBundle\Entity\Category" exclusion-policy="all" xml-root-name="_category">
<property xml-attribute-map="true" name="id" type="integer" expose="true" since-version="1.0" groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!-- This file has been generated by the SonataEasyExtendsBundle: https://sonata-project.org/bundles/easy-extends -->
<class name="App\Application\Sonata\ClassificationBundle\Entity\Collection" exclusion-policy="all" xml-root-name="_collection">
<property xml-attribute-map="true" name="id" type="integer" expose="true" since-version="1.0" groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!-- This file has been generated by the SonataEasyExtendsBundle: https://sonata-project.org/bundles/easy-extends -->
<class name="App\Application\Sonata\ClassificationBundle\Entity\Context" exclusion-policy="all" xml-root-name="_context">
<property xml-attribute-map="true" name="id" type="integer" expose="true" since-version="1.0" groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!-- This file has been generated by the SonataEasyExtendsBundle: https://sonata-project.org/bundles/easy-extends -->
<class name="App\Application\Sonata\ClassificationBundle\Entity\Tag" exclusion-policy="all" xml-root-name="_tag">
<property xml-attribute-map="true" name="id" type="integer" expose="true" since-version="1.0" groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>
......@@ -11,16 +11,34 @@ use App\Form\Type\TransactionPrestataireAdherentFormType;
use Doctrine\ORM\EntityManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\RouterInterface;
class PrestatairesController extends AbstractController
{
private $em;
private $router;
public function __construct(EntityManagerInterface $em)
public function __construct(EntityManagerInterface $em, RouterInterface $router)
{
$this->em = $em;
$this->router = $router;
}
/**
* @Route("/prestataire/{slug}", name="show_prestataire")
*/
public function showPrestaAction(Prestataire $prestataire)
{
if ($prestataire->isMlc()) {
// Ne pas montrer la page du prestataire recevant les cotisations !
return new RedirectResponse($this->router->generate('index'));
}
return $this->render('presta/show.html.twig', array(
'presta' => $prestataire
));
}
/**
......@@ -84,14 +102,4 @@ class PrestatairesController extends AbstractController
'rubrique' => $rubrique
));
}
/**
* @Route("/prestataire/{slug}", name="show_prestataire")
*/
public function showPrestaAction(Prestataire $prestataire)
{
return $this->render('presta/show.html.twig', array(
'presta' => $prestataire
));
}
}
<?php
namespace App\Controller\Rest;
use App\Controller\ExceptionFOSRestController;
use App\Entity\Groupe;
use App\Entity\User;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Nelmio\ApiDocBundle\Annotation\Model;
use Nelmio\ApiDocBundle\Annotation\Security;
use Swagger\Annotations as SWG;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
/**
*
* Types de transfert : (Les transferts dans la structure sont les flux de billets détenus par les opérateurs.)
*
* - SIEGE => GROUPES LOCAUX (Transfert du siège au groupe)
* - GROUPES LOCAUX => COMPTOIRS (Transfert du groupe au comptoir)
* - COMPTOIRS => GROUPES LOCAUX (Transfert du comptoir au groupe)
* - COMPTOIRS => ADHERENTS (Diffusion de monnaie papier auprès des adhérents)
* - COMPTOIRS => PRESTATAIRES (Diffusion de monnaie papier auprès des prestataires)
* - PRESTATAIRES => COMPTOIRS (Reconversion)
*
*
* Types de transaction :
*
* - PRESTATAIRES => ADHERENTS (Virement vers un adherent)
* - PRESTATAIRES => PRESTATAIRES (Virement entre prestataires)
* - ADHERENTS => PRESTATAIRES (Paiement numérique)
*
*/
class FluxController extends ExceptionFOSRestController
{
/**
* Transfert du siège au groupe
*
* @Route("/transfert/siege/groupe/{}", methods={"GET"})
* @SWG\Response(
* response=200,
* description="Transfert du siège au groupe",
* @SWG\Schema(
* type="string"
* )
* )
* @SWG\Parameter(
* name="user",
* in="query",
* type="integer",
* description="The user"
* )
* @SWG\Tag(name="Utilisateurs")
* Security("is_granted('add_tr_sie_grp', user)")
*/
public function tranfertSiegeGroupeAction(User $user, Groupe $groupe)
{
try {
$view = $this->createView();
$view->setData('yes');
return $this->handleView($view);
//return new JsonResponse('yes');
} catch (\Exception $e) {
$this->throwFosrestSupportedException($exception);
}
}
protected function tranfert(User $operateur, $expediteur, $destinataire)
{
//TODO
}
}
<?php
namespace App\Controller\Rest;
use App\Controller\ExceptionFOSRestController;
use App\Entity\User;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Nelmio\ApiDocBundle\Annotation\Model;
use Nelmio\ApiDocBundle\Annotation\Security;
use Swagger\Annotations as SWG;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
class RestController extends ExceptionFOSRestController
{
/**
* Renvoi le type d'utilisateur
*
* @Route("/api/{user}/type", methods={"GET"})
* @SWG\Response(
* response=200,
* description="Returns the type of user",
* @SWG\Schema(
* type="string"
* )
* )
* @SWG\Parameter(
* name="order",
* in="query",
* type="string",
* description="The field used to order rewards"
* )
* @SWG\Tag(name="Utilisateurs")
*/
public function fetchUserTypeAction(User $user)
{
try {
return new JsonResponse('yes');
// return 'yes';
} catch (\Exception $e) {
$this->throwFosrestSupportedException($exception);
}
}
}
......@@ -7,8 +7,14 @@ use App\Entity\EntityTrait\GeolocEntityTrait;
use App\Entity\EntityTrait\HasEcompteEntity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity(repositoryClass="App\Repository\AdherentRepository")
* @ORM\Table(name="adherent")
*/
......
......@@ -11,8 +11,14 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="comptoir")
......
......@@ -10,8 +10,14 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity
* @ORM\Table(name="contact_prestataire")
*/
......
......@@ -2,6 +2,7 @@
namespace App\Entity;
use App\Entity\Prestataire;
use App\Entity\CotisationInfos;
use App\Enum\MoyenEnum;
use Doctrine\ORM\Mapping as ORM;
......@@ -15,8 +16,8 @@ use Symfony\Component\Validator\Constraints as Assert;
class Cotisation extends Flux
{
/**
* @ORM\OneToOne(targetEntity="Siege")
* @ORM\JoinColumn(name="siege_id", referencedColumnName="id", nullable=true)
* @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=true)
*/
protected $destinataire;
......@@ -37,6 +38,12 @@ class Cotisation extends Flux
public function operate($em)
{
// Récupérer l'unique Prestataire/Association qui reçoit les cotisations !
// $destinataires = $em->getRepository(Prestataire::class)->findBy(array('mlc' => true));
// if (count($destinataires) > 1 || count($destinataires) <= 0) {
// throw new \Exception("[FLUX] Opération impossible ! Prestataire recevant la monnaie locale non configuré !");
// }
// $destinataire = $destinataires[0];
$compteExp = $this->getExpediteur()->getEcompte() - $this->getMontant();
if ($this->getMoyen() == MoyenEnum::MOYEN_MLC) {
if ($compteExp < 0) {
......
......@@ -4,8 +4,14 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* TRANSACTION
* - Cotisation d'un adhérent
*
......
......@@ -4,8 +4,14 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* Cotisation d'un utilisateur
*
* @ORM\Entity
......
......@@ -4,8 +4,14 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* TRANSACTION
* - Cotisation d'un prestataire
*
......
......@@ -7,8 +7,14 @@ use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="document")
......
......@@ -4,6 +4,7 @@ namespace App\Entity\EntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups;
trait ContactEmailTelTrait
{
......@@ -11,6 +12,7 @@ trait ContactEmailTelTrait
* @var null|string
*
* @ORM\Column(name="tel", type="string", length=20, nullable=true)
* @Groups({"read", "write"})
*/
protected $tel;
......@@ -18,6 +20,7 @@ trait ContactEmailTelTrait
* @var null|string
*
* @ORM\Column(name="email", type="string", length=100, nullable=true)
* @Groups({"read", "write"})
*/
protected $email;
......@@ -42,4 +45,4 @@ trait ContactEmailTelTrait
$this->email = $email;
return $this;
}
}
\ No newline at end of file
}
......@@ -4,6 +4,7 @@ namespace App\Traits;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Serializer\Annotation\Groups;
trait DeleteableEntityTrait
{
......@@ -11,6 +12,7 @@ trait DeleteableEntityTrait
* @var \DateTime $deletedAt
*
* @ORM\Column(name="deletedAt", type="datetime", nullable=true)
* @Groups({"read", "write"})
*/
private $deletedAt;
......
......@@ -4,6 +4,7 @@ namespace App\Entity\EntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups;
trait EnablableEntityTrait
{
......@@ -11,6 +12,7 @@ trait EnablableEntityTrait
* @var boolean
* @Assert\Type("bool")
* @ORM\Column(type="boolean")
* @Groups({"read", "write"})
*/
protected $enabled = true;
......@@ -24,6 +26,4 @@ trait EnablableEntityTrait
$this->enabled = $enabled;
return $this;
}
}
\ No newline at end of file
}
......@@ -6,6 +6,7 @@ use App\Entity\Geoloc;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups;
trait GeolocEntityTrait
{
......@@ -13,6 +14,7 @@ trait GeolocEntityTrait
* @var Geoloc
*
* @ORM\OneToOne(targetEntity="Geoloc", cascade={"persist"}, orphanRemoval=true)
* @Groups({"read", "write"})
*/
private $geoloc;
......
......@@ -5,6 +5,7 @@ namespace App\Entity\EntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups;
trait HasCompteEntity
{
......@@ -13,6 +14,7 @@ trait HasCompteEntity
* @var int
*
* @ORM\Column(name="compte", type="decimal", precision=12, scale=2)
* @Groups({"read"})
*/
private $compte = 0;
......
......@@ -5,6 +5,7 @@ namespace App\Entity\EntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups;
trait HasEcompteEntity
{
......@@ -13,6 +14,7 @@ trait HasEcompteEntity
* @var int
*
* @ORM\Column(name="ecompte", type="decimal", precision=12, scale=2)
* @Groups({"read"})
*/
private $ecompte = 0;
......
......@@ -5,6 +5,7 @@ namespace App\Entity\EntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups;
trait NameSlugContentEntityTrait
{
......@@ -14,6 +15,7 @@ trait NameSlugContentEntityTrait
* @ORM\Column(length=150)
* @Assert\NotBlank
* @Assert\Length(max=150)
* @Groups({"read", "write"})
*/
protected $name;
......@@ -22,6 +24,7 @@ trait NameSlugContentEntityTrait
*
* @Gedmo\Slug(fields={"name"})
* @ORM\Column(length=150, unique=true)
* @Groups({"read"})
*/
protected $slug;
......@@ -29,6 +32,7 @@ trait NameSlugContentEntityTrait
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
* @Groups({"read", "write"})
*/
private $content;
......@@ -91,4 +95,4 @@ trait NameSlugContentEntityTrait
$this->slug = $slug;
return $this;
}
}
\ No newline at end of file
}
......@@ -8,8 +8,14 @@ use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity(repositoryClass="App\Repository\EtatPrestataireRepository")
*/
class EtatPrestataire
......
......@@ -7,8 +7,14 @@ use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="faq")
......
......@@ -9,8 +9,14 @@ use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* FLUX = TRANSFERT ou TRANSACTION ou COTISATIONS
* @ORM\Entity(repositoryClass="App\Repository\FluxRepository")
* @ORM\HasLifecycleCallbacks()
......@@ -34,12 +40,14 @@ abstract class Flux
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
* @Groups({"read"})
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="flux", cascade={"all"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
* @Groups({"read", "write"})
*/
protected $operateur;
......@@ -49,6 +57,7 @@ abstract class Flux
*
* @ORM\Column(name="role", type="string", length=200)
* @Assert\NotBlank
* @Groups({"read", "write"})
*/
protected $role;
......@@ -58,6 +67,7 @@ abstract class Flux
*
* @ORM\Column(name="type", type="string", length=200)
* @Assert\NotBlank
* @Groups({"read", "write"})
*/
protected $type;
......@@ -67,6 +77,7 @@ abstract class Flux
*
* @ORM\Column(name="parenttype", type="string", length=20)
* @Assert\NotBlank
* @Groups({"read", "write"})
*/
protected $parenttype;
......@@ -79,6 +90,7 @@ abstract class Flux
* @Assert\GreaterThan(
* value = 0
* )
* @Groups({"read", "write"})
*/
protected $montant;
......@@ -87,6 +99,7 @@ abstract class Flux
*
* @ORM\Column(name="moyen", type="string", length=100)
* @Assert\NotBlank
* @Groups({"read", "write"})
*/
private $moyen;
......@@ -95,6 +108,7 @@ abstract class Flux
*
* @ORM\Column(name="reference", type="string", length=255, nullable=true)
* @Assert\NotBlank
* @Groups({"read", "write"})
*/
protected $reference;
......
......@@ -6,8 +6,14 @@ use App\Entity\EntityTrait\EnablableEntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity
* @ORM\Table(name="geoloc")
*/
......@@ -21,6 +27,7 @@ class Geoloc
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue
* @Groups({"read"})
*/
protected $id;
......@@ -28,13 +35,15 @@ class Geoloc
* @var null|string
*
* @ORM\Column(name="adresse", type="string", length=255, nullable=true)
*/
* @Groups({"read", "write"})
*/
private $adresse;
/**
* @var null|int
*
* @ORM\Column(name="cpostal", type="string", length=10, nullable=true)
* @Groups({"read", "write"})
*/
private $cpostal;
......@@ -42,6 +51,7 @@ class Geoloc
* @var null|string
*
* @ORM\Column(name="ville", type="string", length=100, nullable=true)
* @Groups({"read", "write"})
*/
private $ville;
......@@ -49,6 +59,7 @@ class Geoloc
* @var null|float
*
* @ORM\Column(name="lat", type="decimal", precision=10, scale=8, nullable=true)
* @Groups({"read", "write"})
*/
private $lat;
......@@ -56,10 +67,10 @@ class Geoloc
* @var null|float
*
* @ORM\Column(name="lon", type="decimal", precision=10, scale=8, nullable=true)
* @Groups({"read", "write"})
*/
private $lon;
/**
* @return int
*/
......
......@@ -10,8 +10,14 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity
* @ORM\Table(name="geoloc_prestataire")
*/
......@@ -26,6 +32,7 @@ class GeolocPrestataire
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
* @Groups({"read"})
*/
private $id;
......
......@@ -4,8 +4,14 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity(repositoryClass="App\Repository\GlobalParameterRepository")
*/
class GlobalParameter
......
......@@ -10,8 +10,14 @@ use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity
* @ORM\Table(name="groupe")
*/
......
......@@ -11,8 +11,14 @@ use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity
* @ORM\Table(name="groupeprestaire")
*/
......
<?php
namespace App\Entity;
use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="lien")
*/
class Lien
{
use TimestampableEntity,
EnablableEntityTrait,
NameSlugContentEntityTrait;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string
*
* @ORM\Column(name="url", type="string", length=255)
*/
private $url;
/**
* @var null|User
*
* @ORM\ManyToOne(targetEntity="User", inversedBy="liens")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
*/
private $user;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getUrl(): string
{
return $this->url;
}
/**
* @param string $url
* @return Lien
*/
public function setUrl(string $url)
{
$this->url = $url;
return $this;
}
/**
* @param null|User $user
* @return $this
*/
public function setUser(?User $user)
{
$this->user = $user;
return $this;
}
/**
* @return null|User
*/
public function getUser(): ?User
{
return $this->user;
}
}
......@@ -8,8 +8,14 @@ use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity(repositoryClass="App\Repository\NewsRepository")
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="news")
......
......@@ -8,8 +8,14 @@ use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity
* @ORM\Table(name="page")
*/
......
......@@ -13,8 +13,14 @@ use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Mapping\Annotation\Slug;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity(repositoryClass="App\Repository\PrestataireRepository")
* @ORM\Table(name="prestataire")
*/
......@@ -31,6 +37,7 @@ class Prestataire
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue
* @Groups({"read"})
*/
protected $id;
......@@ -38,6 +45,7 @@ class Prestataire
* @var string
*
* @ORM\Column(name="raison", type="string", length=100)
* @Groups({"read", "write"})
*/
private $raison;
......@@ -45,6 +53,7 @@ class Prestataire
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
* @Groups({"read", "write"})
*/
private $description;
......@@ -53,6 +62,7 @@ class Prestataire
*
* @Gedmo\Slug(fields={"raison"})
* @ORM\Column(length=100, unique=true)
* @Groups({"read"})
*/
protected $slug;
......@@ -60,6 +70,7 @@ class Prestataire
* @var string
*
* @ORM\Column(name="metier", type="string", length=100, nullable=true)
* @Groups({"read", "write"})
*/
private $metier;
......@@ -67,6 +78,7 @@ class Prestataire
* @var null|string
*
* @ORM\Column(name="statut", type="string", length=50, nullable=true)
* @Groups({"read", "write"})
*/
private $statut;
......@@ -74,12 +86,14 @@ class Prestataire
* @var null|string
*
* @ORM\Column(name="responsable", type="string", length=200, nullable=true)
* @Groups({"read", "write"})
*/
private $responsable;
/**
* @ORM\Column(name="iban", type="string", length=100, nullable=true)
* Assert\Iban(message="L'IBAN(International Bank Account Number) est invalide.")
* @Groups({"read", "write"})
*/
private $iban;
......@@ -87,6 +101,7 @@ class Prestataire
* @var string
*
* @ORM\Column(name="siret", type="string", length=50)
* @Groups({"read", "write"})
*/
private $siret;
......@@ -95,6 +110,7 @@ class Prestataire
*
* @ORM\Column(name="web", type="string", length=255, nullable=true)
* @Assert\Url(message = "L'adresse : '{{ value }}' est invalide.")
* @Groups({"read", "write"})
*/
private $web;
......@@ -104,6 +120,7 @@ class Prestataire
* @var bool
*
* @ORM\Column(name="mlc", type="boolean", nullable=false, options={"default" : false})
* @Groups({"read"})
*/
private $mlc = false;
......@@ -111,6 +128,7 @@ class Prestataire
* @var null|string (champ libre)
*
* @ORM\Column(name="horaires", type="string", length=255, nullable=true)
* @Groups({"read", "write"})
*/
private $horaires;
......@@ -118,12 +136,14 @@ class Prestataire
* @var TypePrestataire
*
* @ORM\ManyToOne(targetEntity="TypePrestataire", cascade={"persist"}, inversedBy="prestataires")
* @Groups({"read", "write"})
*/
private $typeprestataire;
/**
* @var ArrayCollection|Rubrique[]
* @ORM\ManyToMany(targetEntity="Rubrique", mappedBy="prestataires", cascade={"persist"}, fetch="EXTRA_LAZY")
* @Groups({"read", "write"})
*/
private $rubriques;
......@@ -131,18 +151,21 @@ class Prestataire
* @var \Application\Sonata\MediaBundle\Entity\Media
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id", nullable=true)
* @Groups({"read", "write"})
*/
protected $media;
/**
* @var ArrayCollection|GeolocPrestataire[]
* @ORM\OneToMany(targetEntity="GeolocPrestataire", cascade={"persist"}, mappedBy="prestataire")
* @Groups({"read", "write"})
*/
private $geolocs;
/**
* @var ArrayCollection|ContactPrestataire[]
* @ORM\OneToMany(targetEntity="ContactPrestataire", cascade={"persist"}, mappedBy="prestataire")
* @Groups({"read", "write"})
*/
private $contacts;
......@@ -150,6 +173,7 @@ class Prestataire
* @var ArrayCollection|User[]
*
* @ORM\ManyToMany(targetEntity="User", inversedBy="prestataires", cascade={"persist"})
* @Groups({"read", "write"})
*/
protected $users;
......@@ -158,6 +182,7 @@ class Prestataire
*
* @ORM\ManyToOne(targetEntity="Groupe", inversedBy="prestataires", cascade={"persist"})
* @Assert\NotBlank
* @Groups({"read", "write"})
*/
private $groupe;
......@@ -166,13 +191,15 @@ class Prestataire
* @var ArrayCollection|Groupeprestataire[]
* @ORM\ManyToMany(targetEntity="Groupeprestataire", cascade={"persist"}, mappedBy="prestataires")
* @ORM\JoinTable(name="groupes_prestataires")
* @Groups({"read", "write"})
*/
private $groupeprestataires;
/**
* EtatPrestataire $etats
* EtatPrestataire $etats
* @var ArrayCollection|EtatPrestataire[]
* @ORM\ManyToMany(targetEntity="EtatPrestataire", cascade={"persist"}, mappedBy="prestataires", fetch="EXTRA_LAZY")
* @Groups({"read", "write"})
*/
private $etats;
......
......@@ -8,8 +8,14 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity
* @ORM\Table(name="rubrique")
*/
......
......@@ -7,8 +7,14 @@ use App\Entity\EntityTrait\EnablableEntityTrait;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity
* @ORM\Table(name="typepresta")
*/
......
......@@ -10,8 +10,15 @@ use Gedmo\Mapping\Annotation as Gedmo;
use Sonata\UserBundle\Entity\BaseUser as BaseUser;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
use FOS\UserBundle\Model\UserInterface;
/**
* @ApiResource(
* normalizationContext={"groups"={"user", "user:read"}},
* denormalizationContext={"groups"={"user", "user:write"}}
* )
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
* @ORM\Table(name="user")
* @UniqueEntity(
......@@ -26,18 +33,36 @@ class User extends BaseUser
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
* @Groups({"user:read"})
*/
protected $id;
/**
* @Groups({"user"})
*/
protected $email;
/**
* @Groups({"user:write"})
*/
protected $plainPassword;
/**
* @Groups({"user"})
*/
protected $username;
/**
* @var null|string
*
* @ORM\Column(name="etat", type="string", length=10, nullable=true)
* @Groups({"user"})
*/
protected $etat;
/**
* @ORM\Column(type="string", length=15, nullable=true)
* @Groups({"user"})
*/
protected $mobile;
......@@ -109,6 +134,7 @@ class User extends BaseUser
/**
* @ORM\Column(name="apiKey", type="string", length=255, nullable=true)
* @Groups({"user:read"})
*/
private $apiKey;
......@@ -130,6 +156,7 @@ class User extends BaseUser
* joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id")}
* )
* @Groups({"user"})
*/
protected $groups;
......@@ -138,6 +165,7 @@ class User extends BaseUser
* @var bool
*
* @ORM\Column(name="alertemailflux", type="boolean", options={"default" : true})
* @Groups({"user"})
*/
protected $alertemailflux = true;
......@@ -147,7 +175,6 @@ class User extends BaseUser
$this->imports = new ArrayCollection();
$this->faqs = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->cotisations = new ArrayCollection();
$this->flux = new ArrayCollection();
$this->emailTokens = new ArrayCollection();
$this->prestataires = new ArrayCollection();
......@@ -170,6 +197,11 @@ class User extends BaseUser
return $this->apiKey;
}
public function isUser(?UserInterface $user = null): bool
{
return $user instanceof self && $user->id === $this->id;
}
public function createApiKey()
{
$bytes = random_bytes(64);
......@@ -321,49 +353,6 @@ class User extends BaseUser
}
/**
* @return Cotisation[]|ArrayCollection
*/
public function getCotisations()
{
if (count($this->flux) > 0) {
$return = new ArrayCollection();
foreach ($this->flux as $flux) {
if ($flux->getParenttype() == 'cotisation') {
$return->add($flux);
}
}
return $return;
}
return new ArrayCollection();
}
/**
* @param $cotisation
* @return $this
*/
public function addCotisation($cotisation): self
{
if (!$this->flux->contains($cotisation)) {
$cotisation->setOperateur($this);
$this->flux->add($cotisation);
}
return $this;
}
/**
* @param Cotisation $cotisation
* @return $this
*/
public function removeCotisation(Cotisation $cotisation): self
{
throw new \LogicException('User::removeCotisation : This code should not be reached!');
// if ($this->cotisations->contains($cotisation)) {
// $this->cotisations->removeElement($cotisation);
// }
return $this;
}
/**
* @return Flux[]|ArrayCollection
*/
public function getFlux()
......
<?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 Version20200421145001 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE classification__collection (id INT AUTO_INCREMENT NOT NULL, context VARCHAR(255) DEFAULT NULL, media_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_A406B56AE25D857E (context), INDEX IDX_A406B56AEA9FDD75 (media_id), UNIQUE INDEX tag_collection (slug, context), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE classification__category (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, context VARCHAR(255) DEFAULT NULL, media_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, position INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_43629B36727ACA70 (parent_id), INDEX IDX_43629B36E25D857E (context), INDEX IDX_43629B36EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE classification__tag (id INT AUTO_INCREMENT NOT NULL, context VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_CA57A1C7E25D857E (context), UNIQUE INDEX tag_context (slug, context), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE classification__context (id VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE classification__collection ADD CONSTRAINT FK_A406B56AE25D857E FOREIGN KEY (context) REFERENCES classification__context (id)');
$this->addSql('ALTER TABLE classification__collection ADD CONSTRAINT FK_A406B56AEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE classification__category ADD CONSTRAINT FK_43629B36727ACA70 FOREIGN KEY (parent_id) REFERENCES classification__category (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE classification__category ADD CONSTRAINT FK_43629B36E25D857E FOREIGN KEY (context) REFERENCES classification__context (id)');
$this->addSql('ALTER TABLE classification__category ADD CONSTRAINT FK_43629B36EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE classification__tag ADD CONSTRAINT FK_CA57A1C7E25D857E FOREIGN KEY (context) REFERENCES classification__context (id)');
$this->addSql('ALTER TABLE media__media ADD category_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE media__media ADD CONSTRAINT FK_5C6DD74E12469DE2 FOREIGN KEY (category_id) REFERENCES classification__category (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_5C6DD74E12469DE2 ON media__media (category_id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE classification__category DROP FOREIGN KEY FK_43629B36727ACA70');
$this->addSql('ALTER TABLE media__media DROP FOREIGN KEY FK_5C6DD74E12469DE2');
$this->addSql('ALTER TABLE classification__collection DROP FOREIGN KEY FK_A406B56AE25D857E');
$this->addSql('ALTER TABLE classification__category DROP FOREIGN KEY FK_43629B36E25D857E');
$this->addSql('ALTER TABLE classification__tag DROP FOREIGN KEY FK_CA57A1C7E25D857E');
$this->addSql('DROP TABLE classification__collection');
$this->addSql('DROP TABLE classification__category');
$this->addSql('DROP TABLE classification__tag');
$this->addSql('DROP TABLE classification__context');
$this->addSql('DROP INDEX IDX_5C6DD74E12469DE2 ON media__media');
$this->addSql('ALTER TABLE media__media DROP category_id');
}
}
<?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 Version20200422111240 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TABLE lien');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE lien (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, url VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, name VARCHAR(150) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, slug VARCHAR(150) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, content LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci`, UNIQUE INDEX UNIQ_A532B4B5989D9B62 (slug), INDEX IDX_A532B4B5A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE lien ADD CONSTRAINT FK_A532B4B5A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
}
}
......@@ -3,9 +3,9 @@
namespace App\Security;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
......@@ -16,18 +16,12 @@ use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
class EmailTokenAuthenticator extends AbstractGuardAuthenticator
{
private $em;
private $router;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
public function setRouter(Router $router)
{
$this->router = $router;
}
/**
* Called on every request to decide if this authenticator should be
* used for the request. Returning false will cause this authenticator
......@@ -61,7 +55,9 @@ class EmailTokenAuthenticator extends AbstractGuardAuthenticator
public function checkCredentials($credentials, UserInterface $user)
{
$emailToken = $user->getEmailToken($credentials['token']);
$token = $credentials['token'];
$emailToken = $this->em->getRepository('App\Entity\EmailToken')
->findOneByToken($token);
$now = new \DateTime();
return $now < $emailToken->getExpiredAt();
......@@ -70,12 +66,20 @@ class EmailTokenAuthenticator extends AbstractGuardAuthenticator
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
{
//Redirect with no emailToken
return new RedirectResponse($this->router->generate($request->get('_route'), $request->get('_route_params')));
return null;
}
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
return new RedirectResponse($this->router->generate('index'));
$data = [
// you may want to customize or obfuscate the message first
'message' => strtr($exception->getMessageKey(), $exception->getMessageData())
// or to translate this message
// $this->translator->trans($exception->getMessageKey(), $exception->getMessageData())
];
return new JsonResponse($data, Response::HTTP_UNAUTHORIZED);
}
/**
......
......@@ -101,15 +101,6 @@
"doctrine/reflection": {
"version": "v1.0.0"
},
"easycorp/easy-log-handler": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "70062abc2cd58794d2a90274502f81b55cd9951b"
}
},
"egulias/email-validator": {
"version": "2.1.6"
},
......@@ -122,15 +113,6 @@
"friendsofsymfony/ckeditor-bundle": {
"version": "1.2.0"
},
"friendsofsymfony/rest-bundle": {
"version": "2.2",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "master",
"version": "2.2",
"ref": "258300d52be6ad59b32a888d5ddafbf9638540ff"
}
},
"friendsofsymfony/user-bundle": {
"version": "v2.1.2"
},
......@@ -254,6 +236,21 @@
"kriswallsmith/buzz": {
"version": "v0.16.1"
},
"lcobucci/jwt": {
"version": "3.3.1"
},
"lexik/jwt-authentication-bundle": {
"version": "2.5",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "2.5",
"ref": "5b2157bcd5778166a5696e42f552ad36529a07a6"
},
"files": [
"config/packages/lexik_jwt_authentication.yaml"
]
},
"lexik/translation-bundle": {
"version": "v4.0.13"
},
......@@ -275,6 +272,9 @@
"myclabs/deep-copy": {
"version": "1.8.1"
},
"namshi/jose": {
"version": "7.2.3"
},
"nelmio/alice": {
"version": "3.2",
"recipe": {
......@@ -416,6 +416,22 @@
"sonata-project/cache": {
"version": "2.0.1"
},
"sonata-project/classification-bundle": {
"version": "3.7",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "master",
"version": "3.7",
"ref": "e79fbb2e8658677e5d5d9199db7d2735332c4b7d"
},
"files": [
"config/packages/sonata_classification.yaml",
"src/Entity/SonataClassificationCategory.php",
"src/Entity/SonataClassificationCollection.php",
"src/Entity/SonataClassificationContext.php",
"src/Entity/SonataClassificationTag.php"
]
},
"sonata-project/core-bundle": {
"version": "3.9",
"recipe": {
......@@ -542,6 +558,9 @@
"symfony/dotenv": {
"version": "v4.1.7"
},
"symfony/error-handler": {
"version": "v4.4.7"
},
"symfony/event-dispatcher": {
"version": "v4.1.7"
},
......@@ -629,12 +648,18 @@
"ref": "e637a1337f5faf0b2529b1c9a47de5e8286679f0"
}
},
"symfony/polyfill-intl-grapheme": {
"version": "v1.15.0"
},
"symfony/polyfill-intl-icu": {
"version": "v1.10.0"
},
"symfony/polyfill-intl-idn": {
"version": "v1.13.1"
},
"symfony/polyfill-intl-normalizer": {
"version": "v1.15.0"
},
"symfony/polyfill-mbstring": {
"version": "v1.10.0"
},
......@@ -701,6 +726,9 @@
"symfony/stopwatch": {
"version": "v4.1.7"
},
"symfony/string": {
"version": "v5.0.7"
},
"symfony/swiftmailer-bundle": {
"version": "2.5",
"recipe": {
......@@ -740,6 +768,9 @@
"ref": "369b5b29dc52b2c190002825ae7ec24ab6f962dd"
}
},
"symfony/twig-pack": {
"version": "v1.0.0"
},
"symfony/validator": {
"version": "4.1",
"recipe": {
......@@ -806,6 +837,12 @@
"ref": "ddb2e0a77773b7fd75d8d649545f174e664500ab"
}
},
"twig/extra-bundle": {
"version": "v3.0.3"
},
"twig/string-extra": {
"version": "v3.0.3"
},
"twig/twig": {
"version": "v2.5.0"
},
......@@ -833,9 +870,6 @@
"ref": "b272ad4fbfcd45a20e7cbfdc4ad1b0e27a62fd3b"
}
},
"willdurand/jsonp-callback-validator": {
"version": "v1.1.0"
},
"willdurand/negotiation": {
"version": "v2.3.1"
},
......
{% extends 'common/layout.html.twig' %}
{% block content %}
<h1>Oups ! Il y a eu une erreur !</h1>
<br/><br/><br/><br/>
<p>The server returned a "{{ status_code }} {{ status_text }}".</p>
<div class='row'>
<div class='col-xs-6 text-center'>
<h1>Oups ! Il y a eu une erreur !</h1>
<br/><br/><br/><br/>
<p>The server returned a "{{ status_code }} {{ status_text }}".</p>
</div>
</div>
{% endblock content %}
\ No newline at end of file
......@@ -601,6 +601,26 @@
<source>CONFIGURATION DU KOHINOS</source>
<target>CONFIGURATION DU KOHINOS</target>
</trans-unit>
<trans-unit id="ygSdBiB" resname="TABLEAU DE BORD">
<source>TABLEAU DE BORD</source>
<target>TABLEAU DE BORD</target>
</trans-unit>
<trans-unit id="50QN04T" resname="GLOBAL">
<source>GLOBAL</source>
<target>GLOBAL</target>
</trans-unit>
<trans-unit id="ol5d0mD" resname="GROUPES">
<source>GROUPES</source>
<target>GROUPES</target>
</trans-unit>
<trans-unit id="mS2KPNp" resname="COMPTOIRS">
<source>COMPTOIRS</source>
<target>COMPTOIRS</target>
</trans-unit>
<trans-unit id="UxVhOkJ" resname="COTISATIONS">
<source>COTISATIONS</source>
<target>COTISATIONS</target>
</trans-unit>
</body>
</file>
</xliff>
......@@ -617,6 +617,26 @@
<source>CONFIGURATION DU KOHINOS</source>
<target>CONFIGURATION DU KOHINOS</target>
</trans-unit>
<trans-unit id="ygSdBiB" resname="TABLEAU DE BORD">
<source>TABLEAU DE BORD</source>
<target>TABLEAU DE BORD</target>
</trans-unit>
<trans-unit id="50QN04T" resname="GLOBAL">
<source>GLOBAL</source>
<target>GLOBAL</target>
</trans-unit>
<trans-unit id="ol5d0mD" resname="GROUPES">
<source>GROUPES</source>
<target>GROUPES</target>
</trans-unit>
<trans-unit id="mS2KPNp" resname="COMPTOIRS">
<source>COMPTOIRS</source>
<target>COMPTOIRS</target>
</trans-unit>
<trans-unit id="UxVhOkJ" resname="COTISATIONS">
<source>COTISATIONS</source>
<target>COTISATIONS</target>
</trans-unit>
</body>
</file>
</xliff>
......@@ -369,6 +369,22 @@
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>This value should be between {{ min }} and {{ max }}.</target>
</trans-unit>
<trans-unit id="7g313cV" resname="This value is not a valid hostname.">
<source>This value is not a valid hostname.</source>
<target>This value is not a valid hostname.</target>
</trans-unit>
<trans-unit id="xwtBimR" resname="The number of elements in this collection should be a multiple of {{ compared_value }}.">
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<target>The number of elements in this collection should be a multiple of {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="FDRZr.s" resname="This value should satisfy at least one of the following constraints:">
<source>This value should satisfy at least one of the following constraints:</source>
<target>This value should satisfy at least one of the following constraints:</target>
</trans-unit>
<trans-unit id="WwY0IGI" resname="Each element of this collection should satisfy its own set of constraints.">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>Each element of this collection should satisfy its own set of constraints.</target>
</trans-unit>
<trans-unit id=".SEaaBa" resname="This form should not contain extra fields.">
<source>This form should not contain extra fields.</source>
<target>This form should not contain extra fields.</target>
......
......@@ -369,6 +369,22 @@
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Cette valeur doit être comprise entre {{ min }} et {{ max }}.</target>
</trans-unit>
<trans-unit id="7g313cV" resname="This value is not a valid hostname.">
<source>This value is not a valid hostname.</source>
<target>Cette valeur n'est pas un nom d'hôte valide.</target>
</trans-unit>
<trans-unit id="xwtBimR" resname="The number of elements in this collection should be a multiple of {{ compared_value }}.">
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<target>Le nombre d'éléments de cette collection doit être un multiple de {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="FDRZr.s" resname="This value should satisfy at least one of the following constraints:">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Cette valeur doit satisfaire à au moins une des contraintes suivantes :</target>
</trans-unit>
<trans-unit id="WwY0IGI" resname="Each element of this collection should satisfy its own set of constraints.">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>Chaque élément de cette collection doit satisfaire à son propre jeu de contraintes.</target>
</trans-unit>
<trans-unit id=".SEaaBa" resname="This form should not contain extra fields.">
<source>This form should not contain extra fields.</source>
<target>Ce formulaire ne doit pas contenir des champs supplémentaires.</target>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment