Commit f6557a8f by Julien Jorry

BIG UPDATE 2

parent 56945a49
......@@ -5,6 +5,7 @@
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"friendsofsymfony/ckeditor-bundle": "^2.0",
"friendsofsymfony/rest-bundle": "^2.4",
"friendsofsymfony/user-bundle": "^2.1",
"knplabs/knp-paginator-bundle": "^2.8",
......@@ -15,26 +16,29 @@
"sonata-project/admin-bundle": "^3.40",
"sonata-project/block-bundle": "^3.12",
"sonata-project/doctrine-orm-admin-bundle": "^3.6",
"sonata-project/easy-extends-bundle": "^2.5",
"sonata-project/media-bundle": "^3.16",
"sonata-project/user-bundle": "^4.2",
"stof/doctrine-extensions-bundle": "^1.3",
"symfony/asset": "4.1.*",
"symfony/console": "4.1.*",
"symfony/expression-language": "4.1.*",
"symfony/apache-pack": "^1.0",
"symfony/asset": "4.2.*",
"symfony/console": "4.2.*",
"symfony/expression-language": "4.2.*",
"symfony/flex": "^1.1",
"symfony/form": "4.1.*",
"symfony/framework-bundle": "4.1.*",
"symfony/form": "4.2.*",
"symfony/framework-bundle": "4.2.*",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "*",
"symfony/process": "4.1.*",
"symfony/security-bundle": "4.1.*",
"symfony/process": "4.2.*",
"symfony/security-bundle": "4.2.*",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "4.1.*",
"symfony/twig-bundle": "4.1.*",
"symfony/validator": "4.1.*",
"symfony/web-link": "4.1.*",
"symfony/translation": "4.2.*",
"symfony/twig-bundle": "4.2.*",
"symfony/validator": "4.2.*",
"symfony/web-link": "4.2.*",
"symfony/webpack-encore-bundle": "^1.0",
"symfony/yaml": "4.1.*",
"symfony/yaml": "4.2.*",
"vich/uploader-bundle": "^1.8"
},
"require-dev": {
......@@ -42,12 +46,12 @@
"hautelook/alice-bundle": "^2.3",
"sensiolabs/security-checker": "^5.0",
"symfony/debug-pack": "*",
"symfony/dotenv": "4.1.*",
"symfony/dotenv": "4.2.*",
"symfony/maker-bundle": "^1.0",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/var-dumper": "4.1.*",
"symfony/web-server-bundle": "4.1.*"
"symfony/var-dumper": "4.2.*",
"symfony/web-server-bundle": "4.2.*"
},
"config": {
"preferred-install": {
......@@ -92,7 +96,7 @@
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.1.*"
"require": "4.2.*"
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
if (!array_key_exists('APP_ENV', $_SERVER)) {
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] ?? null;
}
if ('prod' !== $_SERVER['APP_ENV']) {
if (!class_exists(Dotenv::class)) {
throw new RuntimeException('The "APP_ENV" environment variable is not set to "prod". Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
}
(new Dotenv())->loadEnv(dirname(__DIR__).'/.env');
}
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $_SERVER['APP_ENV'] ?: $_ENV['APP_ENV'] ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
......@@ -35,4 +35,8 @@ return [
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],
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
Sonata\MediaBundle\SonataMediaBundle::class => ['all' => true],
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
App\Application\Sonata\MediaBundle\ApplicationSonataMediaBundle::class => ['all' => true],
];
jms_serializer:
visitors:
json:
options:
- JSON_PRETTY_PRINT
- JSON_UNESCAPED_SLASHES
- JSON_PRESERVE_ZERO_FRACTION
......@@ -9,12 +9,10 @@ doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.7'
charset: utf8mb4
charset: utf8
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
charset: utf8
collate: utf8_general_ci
url: '%env(resolve:DATABASE_URL)%'
types:
json: Sonata\Doctrine\Types\JsonType
......@@ -35,4 +33,4 @@ doctrine:
filters:
softdeleteable:
class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
enabled: true
\ No newline at end of file
enabled: true
# Read the documentation: https://symfony.com/doc/current/bundles/FOSCKEditorBundle/index.html
twig:
form_themes:
- '@FOSCKEditor/Form/ckeditor_widget.html.twig'
fos_ck_editor:
default_config: default
configs:
default:
# default toolbar plus Format button
# toolbar:
# - [Bold, Italic, Underline, -, Cut, Copy, Paste,
# PasteText, PasteFromWord, -, Undo, Redo, -,
# NumberedList, BulletedList, -, Outdent, Indent, -,
# Blockquote, -, Image, Link, Unlink, Table]
# - [Format, Maximize, Source]
# filebrowserBrowseRoute: admin_sonata_media_media_ckeditor_browser
# filebrowserImageBrowseRoute: admin_sonata_media_media_ckeditor_browser
# # Display images by default when clicking the image dialog browse button
# filebrowserImageBrowseRouteParameters:
# provider: sonata.media.provider.image
# filebrowserUploadMethod: form
# filebrowserUploadRoute: admin_sonata_media_media_ckeditor_upload
# filebrowserUploadRouteParameters:
# provider: sonata.media.provider.file
# # Upload file as image when sending a file from the image dialog
# filebrowserImageUploadRoute: admin_sonata_media_media_ckeditor_upload
# filebrowserImageUploadRouteParameters:
# provider: sonata.media.provider.image
# context: my-context # Optional, to upload in a custom context
# format: my-big # Optional, media format or original size returned to editor
\ No newline at end of file
jms_serializer:
visitors:
xml:
format_output: '%kernel.debug%'
# metadata:
# auto_detection: false
# directories:
# any-name:
# namespace_prefix: "My\\FooBundle"
# path: "@MyFooBundle/Resources/config/serializer"
# another-name:
# namespace_prefix: "My\\BarBundle"
# path: "@MyBarBundle/Resources/config/serializer"
jms_serializer:
visitors:
json:
options:
- JSON_UNESCAPED_SLASHES
- JSON_PRESERVE_ZERO_FRACTION
......@@ -36,7 +36,6 @@ security:
# -> custom firewall for the admin area of the URL
admin:
pattern: /admin(.*)
context: user
form_login:
provider: fos_userbundle
login_path: /admin/login
......@@ -48,6 +47,9 @@ security:
path: /admin/logout
target: /admin/login
anonymous: true
switch_user:
provider: fos_userbundle
context: mlc_context
# -> end custom configuration
main:
pattern: ^/
......@@ -68,6 +70,9 @@ security:
domain: ~
user_provider: fos_userbundle
always_remember_me: true
context: mlc_context
switch_user:
provider: fos_userbundle
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt
......@@ -82,7 +87,7 @@ security:
ROLE_COMPTOIR: ROLE_USER
ROLE_CONTACT: ROLE_USER
ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_SONATA_ADMIN, ROLE_ALLOWED_TO_SWITCH]
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
......
......@@ -6,6 +6,8 @@ sonata_user:
group: App\Entity\Usergroup
profile:
default_avatar: 'images/admin/default_avatar.png' # Default avatar displayed if the user doesn't have one
impersonating:
route: sonata_admin_dashboard
sonata_block:
default_contexts: [sonata_page_bundle]
blocks:
......
......@@ -5,6 +5,43 @@ sonata_admin:
role_super_admin: ROLE_SUPER_ADMIN
title: 'MLC Admin'
title_logo: /images/admin/logo.png
templates:
layout: '@SonataAdmin/standard_layout.html.twig'
#outer_list_rows_mosaic: '@SonataAdmin/list_outer_rows_mosaic.html.twig'
# ajax: '@SonataAdmin/ajax_layout.html.twig'
# list: '@SonataAdmin/CRUD/list.html.twig'
# show: '@SonataAdmin/CRUD/show.html.twig'
# show_compare: '@SonataAdmin/CRUD/show_compare.html.twig'
# edit: '@SonataAdmin/CRUD/edit.html.twig'
# history: '@SonataAdmin/CRUD/history.html.twig'
# preview: '@SonataAdmin/CRUD/preview.html.twig'
# delete: '@SonataAdmin/CRUD/delete.html.twig'
# batch: '@SonataAdmin/CRUD/list__batch.html.twig'
# acl: '@SonataAdmin/CRUD/acl.html.twig'
# action: '@SonataAdmin/CRUD/action.html.twig'
# select: '@SonataAdmin/CRUD/list__select.html.twig'
# filter: '@SonataAdmin/Form/filter_admin_fields.html.twig'
# dashboard: '@SonataAdmin/Core/dashboard.html.twig'
# search: '@SonataAdmin/Core/search.html.twig'
# batch_confirmation: '@SonataAdmin/CRUD/batch_confirmation.html.twig'
# inner_list_row: '@SonataAdmin/CRUD/list_inner_row.html.twig'
# base_list_field: '@SonataAdmin/CRUD/base_list_field.html.twig'
# list_block: '@SonataAdmin/Block/block_admin_list.html.twig'
# user_block: '@SonataAdmin/Core/user_block.html.twig'
# add_block: '@SonataAdmin/Core/add_block.html.twig'
# pager_links: '@SonataAdmin/Pager/links.html.twig'
# pager_results: '@SonataAdmin/Pager/results.html.twig'
# tab_menu_template: '@SonataAdmin/Core/tab_menu_template.html.twig'
# history_revision_timestamp: '@SonataAdmin/CRUD/history_revision_timestamp.html.twig'
# short_object_description: '@SonataAdmin/Helper/short-object-description.html.twig'
# search_result_block: '@SonataAdmin/Block/block_search_result.html.twig'
# action_create: '@SonataAdmin/CRUD/dashboard__action_create.html.twig'
# button_acl: '@SonataAdmin/Button/acl_button.html.twig'
# button_create: '@SonataAdmin/Button/create_button.html.twig'
# button_edit: '@SonataAdmin/Button/edit_button.html.twig'
# button_history: '@SonataAdmin/Button/history_button.html.twig'
# button_list: '@SonataAdmin/Button/list_button.html.twig'
# button_show: '@SonataAdmin/Button/show_button.html.twig'
dashboard:
# DASHBOARD de l'admin
#
......
sonata_media:
db_driver: doctrine_orm
class:
media: App\Application\Sonata\MediaBundle\Entity\Media
gallery: App\Application\Sonata\MediaBundle\Entity\Gallery
gallery_has_media: App\Application\Sonata\MediaBundle\Entity\GalleryHasMedia
default_context: default
contexts:
default:
providers:
- sonata.media.provider.dailymotion
- sonata.media.provider.youtube
- sonata.media.provider.image
- sonata.media.provider.file
- sonata.media.provider.vimeo
formats:
small: { width: 100 , quality: 70}
big: { width: 500 , quality: 70}
actualites:
providers:
- sonata.media.provider.youtube
- sonata.media.provider.image
formats:
small: { width: 100 , quality: 95}
big: { width: 500 , quality: 90}
document:
providers:
- sonata.media.provider.file
comptoir:
providers:
- sonata.media.provider.image
formats:
small: { width: 100 , quality: 95}
big: { width: 500 , quality: 90}
groupe:
providers:
- sonata.media.provider.image
formats:
small: { width: 100 , quality: 95}
big: { width: 500 , quality: 90}
prestataire:
providers:
- sonata.media.provider.image
- sonata.media.provider.file
formats:
small: { width: 100 , quality: 95}
big: { width: 500 , quality: 90}
cdn:
server:
path: /upload/media
filesystem:
local:
# Directory for uploads should be writable
directory: "%kernel.project_dir%/public/upload/media"
create: false
twig:
default_path: '%kernel.project_dir%/templates'
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
strict_variables: '%kernel.debug%'
\ No newline at end of file
......@@ -6,4 +6,9 @@ vich_uploader:
uri_prefix: /images/annonces
upload_destination: '%kernel.project_dir%/public/images/annonces'
# delete_on_update: true
# delete_on_remove: true
logo:
uri_prefix: /images/logo
upload_destination: '%kernel.project_dir%/public/images/logo'
# delete_on_update: true
# delete_on_remove: true
\ No newline at end of file
sonata_media_gallery:
resource: '@SonataMediaBundle/Resources/config/routing/gallery.xml'
prefix: /media/gallery
sonata_media:
resource: '@SonataMediaBundle/Resources/config/routing/media.xml'
prefix: /media
......@@ -41,11 +41,16 @@ services:
App\Controller\RegistrationController:
autowire: false
app.hidden_entity_type_extension:
class: App\Form\HiddenEntityExtension
tags:
- { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\HiddenType }
# Configuration de l'admin
admin.adherent.gerer:
class: App\Admin\AdherentAdmin
# arguments: [~, App\Entity\OBJECT, 'PixSortableBehaviorBundle:SortableAdmin']
arguments: [~, App\Entity\Adherent, ~]
arguments: [~, App\Entity\User, ~]
tags:
- name: sonata.admin
manager_type: orm
......@@ -55,6 +60,8 @@ services:
# - label: "Adhérents"
# - label_catalogue: "App"
public: true
calls:
- [ setUserManager, ['@fos_user.user_manager']]
admin.adherent.cotisations:
class: App\Admin\CotisationAdherentAdmin
......@@ -68,13 +75,15 @@ services:
admin.prestataire.gerer:
class: App\Admin\PrestataireAdmin
arguments: [~, App\Entity\Prestataire, ~]
arguments: [~, App\Entity\User, ~]
tags:
- name: sonata.admin
manager_type: orm
group: "Prestataire"
label: "Gérer"
public: true
calls:
- [ setUserManager, ['@fos_user.user_manager']]
admin.prestataire.cotisations:
class: App\Admin\CotisationPrestataireAdmin
......@@ -96,13 +105,42 @@ services:
label: "Gérer"
public: true
admin.comptoir.gerer:
class: App\Admin\ComptoirAdmin
arguments: [~, App\Entity\Comptoir, ~]
tags:
- name: sonata.admin
manager_type: orm
group: "Comptoir"
label: "Gérer"
public: true
admin.groupepresta.gerer:
class: App\Admin\GroupeprestataireAdmin
arguments: [~, App\Entity\Groupeprestataire, ~]
tags:
- name: sonata.admin
manager_type: orm
group: "Amap / Marché"
group: "Prestataire"
label: "Groupes"
public: true
admin.document.gerer:
class: App\Admin\DocumentAdmin
arguments: [~, App\Entity\Document, ~]
tags:
- name: sonata.admin
manager_type: orm
group: "Document"
label: "Gérer"
public: true
admin.rubrique.gerer:
class: App\Admin\RubriqueAdmin
arguments: [~, App\Entity\Rubrique, ~]
tags:
- name: sonata.admin
manager_type: orm
group: "Rubrique"
label: "Gérer"
public: true
App\Entity\User:
user{1..15}:
username: <userName()>
email: <email()>
plainPassword: 'test'
enabled: true
groups: ['@usergroup_adherent']
App\Entity\Adherent:
adherent{1..15}:
ecompte: '0'
user: '@user<current()>'
App\Entity\User:
user{1..15}:
username: <userName()>
email: <email()>
plainPassword: 'test'
enabled: true
groups: ['@usergroup_prestataire']
App\Entity\Prestataire:
prestataire{1..15}:
raison: <text(10)>
metier: <text(10)>
iban: <text(10)>
statut: <text(10)>
siret: <text(10)>
user: '@user<current()>'
typeprestataire: '@typepresta_prestataire'
App\Entity\User:
user{1..15}:
username: <userName()>
email: <email()>
plainPassword: 'test'
enabled: true
groups: ['@usergroup_prestataire']
App\Entity\Prestataire:
prestataire{1..15}:
raison: <text(10)>
metier: <text(10)>
iban: <text(10)>
statut: <text(10)>
siret: <text(10)>
user: '@user<current()>'
typeprestataire: '@typepresta_partenaire'
......@@ -28,58 +28,68 @@ App\Entity\Comptoir:
geoloc (unique): '@geoloc*'
App\Entity\Groupeprestataire:
amap{1..10}:
__construct: []
type: 'amap'
name: <text(10)>
horaires: "<dayOfWeek()> de <time('H')>h à <time('H')>h"
enabled: true
geoloc: '@geoloc*'
tel: '<phoneNumber()>'
email: <email()>
prestataires: '5x @prestataire*'
marche{1..10}:
__construct: []
type: 'marche'
name: <text(10)>
horaires: "<dayOfWeek()> de time('H')h à time('H')h"
enabled: true
geoloc: '@geoloc*'
tel: '<phoneNumber()>'
email: <email()>
prestataires: '5x @prestataire*'
grppresta_1:
name: 'AMAP'
grppresta_2:
name: 'MARCHÉ'
App\Entity\TypePrestataire:
typepresta_prestataire:
name: 'Prestataire'
typepresta_partenaire:
name: 'Partenaire'
typepresta_amap:
name: 'Amap'
typepresta_marche:
name: 'Marché'
App\Entity\Usergroup:
usergroup_adherent:
__construct: ['Adherent', 'ROLE_ADHERENT']
__construct: ['Adherent', ['ROLE_ADHERENT']]
usergroup_prestataire:
__construct: ['Prestataire', 'ROLE_PRESTATAIRE']
__construct: ['Prestataire', ['ROLE_PRESTATAIRE']]
usergroup_adminsiege:
__construct: ['Administrateur du Siege', 'ROLE_ADMIN_SIEGE']
__construct: ['Administrateur du Siege', ['ROLE_ADMIN_SIEGE']]
usergroup_redacteur:
__construct: ['Rédacteur', 'ROLE_REDACTEUR']
__construct: ['Rédacteur', ['ROLE_REDACTEUR']]
usergroup_tresorier:
__construct: ['Trésorier', 'ROLE_TRESORIER']
__construct: ['Trésorier', ['ROLE_TRESORIER']]
usergroup_gestiongroupe:
__construct: ['Gestionnaire de Groupe', 'ROLE_GESTION_GROUPE']
__construct: ['Gestionnaire de Groupe', ['ROLE_GESTION_GROUPE']]
usergroup_comptoir:
__construct: ['Comptoir', 'ROLE_COMPTOIR']
__construct: ['Comptoir', ['ROLE_COMPTOIR']]
usergroup_contact:
__construct: ['Contact', 'ROLE_CONTACT']
__construct: ['Contact', ['ROLE_CONTACT']]
usergroup_admin:
__construct: ['Admin', 'ROLE_ADMIN']
__construct: ['Admin', ['ROLE_ADMIN']]
usergroup_superadmin:
__construct: ['Super Admin', 'ROLE_SUPER_ADMIN']
__construct: ['Super Admin', ['ROLE_SUPER_ADMIN']]
App\Entity\Adherent:
adherent{1..11}:
ecompte: <randomFloat(2, 0, 50)>
# user (unique): '@user<numberBetween(1,10)>'
App\Entity\Prestataire:
prestataire{1..21}:
raison: <text(10)>
responsable: <text(10)>
metier: <text(10)>
iban: <text(10)>
statut: <text(10)>
siret: <text(10)>
geoloc (unique): '@geoloc*'
# user (unique): '@user<numberBetween(11,30)>'
typeprestataire: '@typepresta_prestataire'
prestataire{22..32}:
raison: <text(10)>
responsable: <text(10)>
metier: <text(10)>
iban: <text(10)>
statut: <text(10)>
siret: <text(10)>
geoloc (unique): '@geoloc*'
# user (unique): '@user<numberBetween(11,30)>'
typeprestataire: '@typepresta_prestataire'
groupeprestataires: ['@grppresta_*']
horaires: "<dayOfWeek()> de <time('H')>h à <time('H')>h"
App\Entity\User:
usersuperadmin:
......@@ -91,65 +101,82 @@ App\Entity\User:
roles: ['ROLE_SUPER_ADMIN']
useradmin:
username: 'user_admin'
email: <email()>
email: 'admin@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_admin']
roles: ['ROLE_ADMIN']
usercontact:
username: 'user_contact'
email: <email()>
email: 'contact@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_contact']
roles: ['ROLE_CONTACT']
usercomptoir:
username: 'user_comptoir'
email: <email()>
email: 'comptoir@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_comptoir']
roles: ['ROLE_COMPTOIR']
usergestiongroupe:
username: 'user_gestiongroupe'
email: <email()>
email: 'groupe@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_gestiongroupe']
roles: ['ROLE_GESTION_GROUPE']
usertresorier:
username: 'user_tresorier'
email: <email()>
email: 'tresorier@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_tresorier']
roles: ['ROLE_TRESORIER']
userredacteur:
username: 'user_redacteur'
email: <email()>
email: 'redacteur@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_redacteur']
roles: ['ROLE_REDACTEUR']
useradminsiege:
username: 'user_adminsiege'
email: <email()>
email: 'siege@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_adminsiege']
roles: ['ROLE_ADMIN_SIEGE']
userprestataire:
username: 'user_prestataire'
email: <email()>
email: 'prestataire@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_prestataire']
roles: ['ROLE_PRESTATAIRE']
prestataire: '@prestataire1'
useradherent:
username: 'user_adherent'
email: 'adherent@doume.test'
plainPassword: 'test'
enabled: true
# groups: ['@usergroup_adherent']
roles: ['ROLE_ADHERENT']
adherent: '@adherent1'
user{1..10}:
username: 'a<userName()>'
email: <email()>
plainPassword: 'test'
enabled: true
groups: ['@usergroup_adherent']
# groups: ['@usergroup_adherent']
roles: ['ROLE_ADHERENT']
adherent (unique): '@adherent<numberBetween(2,11)>'
user{11..30}:
username: 'b<userName()>'
email: <email()>
plainPassword: 'test'
enabled: true
# groups: ['@usergroup_prestataire']
roles: ['ROLE_PRESTATAIRE']
prestataire (unique): '@prestataire<numberBetween(2,21)>'
This source diff could not be displayed because it is too large. You can view the blob instead.
[Sun Dec 02 16:50:19.789465 2018] [authz_core:error] [pid 74805] [client ::1:53101] AH01630: client denied by server configuration: /Users/julien/Desktop/DOUME/ledellin/public/
[Sun Dec 02 16:50:21.791092 2018] [authz_core:error] [pid 74803] [client 127.0.0.1:53102] AH01630: client denied by server configuration: /Users/julien/Desktop/DOUME/ledellin/public/admin
[Sun Dec 02 16:51:01.047349 2018] [authz_core:error] [pid 74804] [client 127.0.0.1:53109] AH01630: client denied by server configuration: /Users/julien/Desktop/DOUME/ledellin/public/admin
[Sun Dec 02 16:52:03.660281 2018] [authz_core:error] [pid 74806] [client ::1:53133] AH01630: client denied by server configuration: /Users/julien/Desktop/DOUME/ledellin/public/
[Sun Dec 02 16:52:09.671524 2018] [authz_core:error] [pid 74807] [client 127.0.0.1:53140] AH01630: client denied by server configuration: /Users/julien/Desktop/DOUME/ledellin/public/
[Sun Dec 02 16:52:18.073495 2018] [authz_core:error] [pid 74810] [client 127.0.0.1:53141] AH01630: client denied by server configuration: /Users/julien/Desktop/DOUME/ledellin/public/index.php
[Sun Dec 02 17:46:26.101100 2018] [authz_core:error] [pid 1975] [client 127.0.0.1:51635] AH01630: client denied by server configuration: /Users/julien/Desktop/DOUME/ledellin/public/admin
[Sun Dec 02 17:46:30.763401 2018] [authz_core:error] [pid 1975] [client 127.0.0.1:51635] AH01630: client denied by server configuration: /Users/julien/Desktop/DOUME/ledellin/public/admin
[Sun Dec 02 17:46:33.536014 2018] [authz_core:error] [pid 1975] [client 127.0.0.1:51635] AH01630: client denied by server configuration: /Users/julien/Desktop/DOUME/ledellin/public/admina
[Sun Dec 02 17:46:35.705658 2018] [authz_core:error] [pid 1975] [client 127.0.0.1:51635] AH01630: client denied by server configuration: /Users/julien/Desktop/DOUME/ledellin/public/
[Sun Dec 02 17:49:53.486817 2018] [php7:warn] [pid 2116] [client 127.0.0.1:51665] PHP Warning: require(/Users/julien/Desktop/DOUME/ledellin/config/bootstrap.php): failed to open stream: No such file or directory in /Users/julien/Desktop/DOUME/ledellin/public/index.php on line 7
[Sun Dec 02 17:49:53.487364 2018] [php7:error] [pid 2116] [client 127.0.0.1:51665] PHP Fatal error: require(): Failed opening required '/Users/julien/Desktop/DOUME/ledellin/config/bootstrap.php' (include_path='.:/usr/local/Cellar/php@7.1/7.1.22/share/php@7.1/pear') in /Users/julien/Desktop/DOUME/ledellin/public/index.php on line 7
[Sun Dec 02 17:51:07.820729 2018] [php7:error] [pid 2117] [client 127.0.0.1:51672] PHP Fatal error: Uncaught Error: Call to undefined method Symfony\\Component\\Dotenv\\Dotenv::loadEnv() in /Users/julien/Desktop/DOUME/ledellin/config/bootstrap.php:16\nStack trace:\n#0 /Users/julien/Desktop/DOUME/ledellin/public/index.php(7): require()\n#1 {main}\n thrown in /Users/julien/Desktop/DOUME/ledellin/config/bootstrap.php on line 16
[Fri Dec 07 16:57:33.662956 2018] [php7:error] [pid 30009] [client 127.0.0.1:56785] PHP Fatal error: Method App\\Entity\\Comptoir::__toString() must not throw an exception, caught TypeError: Return value of App\\Entity\\Comptoir::__toString() must be of the type string, null returned in /Users/julien/Desktop/DOUME/ledellin/vendor/twig/twig/lib/Twig/Extension/Core.php on line 0, referer: http://www.doume.test/admin/app/comptoir/list
[Fri Dec 07 16:58:57.309991 2018] [php7:error] [pid 11590] [client 127.0.0.1:56788] PHP Fatal error: Method App\\Entity\\Comptoir::__toString() must not throw an exception, caught TypeError: Return value of App\\Entity\\Comptoir::getId() must be of the type integer, null returned in /Users/julien/Desktop/DOUME/ledellin/vendor/twig/twig/lib/Twig/Extension/Core.php on line 0, referer: http://www.doume.test/admin/app/comptoir/list
[Fri Dec 07 17:22:03.920201 2018] [php7:error] [pid 30009] [client 127.0.0.1:56883] PHP Fatal error: Cannot declare class App\\Controller\\AdminController, because the name is already in use in /Users/julien/Desktop/DOUME/ledellin/src/Controller/AdminoldController.php on line 9, referer: http://www.doume.test/admin/app/comptoir/list
[Wed Jan 09 17:40:41.454606 2019] [php7:error] [pid 91126] [client 127.0.0.1:64703] PHP Fatal error: Method App\\Entity\\Document::__toString() must not throw an exception, caught TypeError: Return value of App\\Entity\\Document::__toString() must be of the type string, null returned in /Users/julien/Desktop/DOUME/ledellin/vendor/twig/twig/lib/Twig/Extension/Core.php on line 0, referer: http://www.doume.test/admin/app/document/list
[Wed Jan 09 17:41:18.728866 2019] [php7:error] [pid 91127] [client 127.0.0.1:64708] PHP Fatal error: Method App\\Entity\\Document::__toString() must not throw an exception, caught TypeError: Return value of App\\Entity\\Document::__toString() must be of the type string, null returned in /Users/julien/Desktop/DOUME/ledellin/vendor/twig/twig/lib/Twig/Extension/Core.php on line 0, referer: http://www.doume.test/admin/app/document/list
[Wed Jan 09 19:26:37.905339 2019] [php7:error] [pid 20965] [client 127.0.0.1:54948] PHP Fatal error: Method App\\Entity\\Groupe::__toString() must not throw an exception, caught TypeError: Return value of App\\Entity\\Groupe::__toString() must be of the type string, null returned in /Users/julien/Desktop/DOUME/ledellin/vendor/twig/twig/lib/Twig/Extension/Core.php on line 0, referer: http://www.doume.test/admin/app/groupe/list
[Wed Jan 09 19:44:38.386620 2019] [php7:error] [pid 20965] [client 127.0.0.1:59475] PHP Fatal error: Class App\\Form\\EntityToIdTransformer contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Symfony\\Component\\Form\\DataTransformerInterface::reverseTransform) in /Users/julien/Desktop/DOUME/ledellin/src/Form/EntityToIdTransformer.php on line 9, referer: http://www.doume.test/admin/app/groupe/list
[Wed Jan 09 20:05:19.917664 2019] [php7:error] [pid 25864] [client 127.0.0.1:64672] PHP Fatal error: Method App\\Entity\\Rubrique::__toString() must not throw an exception, caught TypeError: Return value of App\\Entity\\Rubrique::__toString() must be of the type string, null returned in /Users/julien/Desktop/DOUME/ledellin/vendor/twig/twig/lib/Twig/Extension/Core.php on line 0, referer: http://www.doume.test/admin/app/rubrique/list
# Use the front controller as index file. It serves as a fallback solution when
# every other rewrite/redirect fails (e.g. in an aliased environment without
# mod_rewrite). Additionally, this reduces the matching process for the
# start page (path "/") because otherwise Apache will apply the rewriting rules
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
DirectoryIndex index.php
ini_set('memory_limit', '1024M');
# By default, Apache does not evaluate symbolic links if you did not enable this
# feature in your server configuration. Uncomment the following line if you
# install assets as symlinks or if you experience problems related to symlinks
# when compiling LESS/Sass/CoffeScript assets.
# Options FollowSymlinks
# Disabling MultiViews prevents unwanted negotiation, e.g. "/index" should not resolve
# to the front controller "/index.php" but be rewritten to "/index.php/index".
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
# Determine the RewriteBase automatically and set it as environment variable.
# If you are using Apache aliases to do mass virtual hosting or installed the
# project in a subdirectory, the base path will be prepended to allow proper
# resolution of the index.php file and to redirect to the correct URI. It will
# work in environments without path prefix as well, providing a safe, one-size
# fits all solution. But as you do not need it in this case, you can comment
# the following 2 lines to eliminate the overhead.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
# Sets the HTTP_AUTHORIZATION header removed by Apache
RewriteCond %{HTTP:Authorization} .
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect to URI without front controller to prevent duplicate content
# (with and without `/index.php`). Only do this redirect on the initial
# rewrite by Apache and not on subsequent cycles. Otherwise we would get an
# endless redirect loop (request -> rewrite to front controller ->
# redirect -> request -> ...).
# So in case you get a "too many redirects" error or you always get redirected
# to the start page because your Apache does not expose the REDIRECT_STATUS
# environment variable, you have 2 choices:
# - disable this feature by commenting the following 2 lines or
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
# following RewriteCond (best solution)
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
# Rewrite all other queries to the front controller.
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
# When mod_rewrite is not available, we instruct a temporary redirect of
# the start page to the front controller explicitly so that the website
# and the generated links can still be used.
RedirectMatch 307 ^/$ /index.php/
# RedirectTemp cannot be used instead
</IfModule>
</IfModule>
......@@ -4,9 +4,7 @@ use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/vendor/autoload.php';
Kernel::bootstrapEnv();
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
......@@ -19,10 +17,10 @@ if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ??
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts(explode(',', $trustedHosts));
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], $_SERVER['APP_DEBUG']);
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
......
......@@ -2,9 +2,12 @@
namespace App\Admin;
use App\Admin\UserAdmin;
use Knp\Menu\ItemInterface;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormEvent;
......@@ -12,11 +15,12 @@ use Symfony\Component\Form\FormEvents;
class AdherentAdmin extends UserAdmin
{
protected $baseRouteName = 'adherent';
protected $baseRoutePattern = 'adherent';
public function configure()
{
parent::configure();
// $this->classnameLabel = "Utilisateurs";
}
/**
......@@ -31,6 +35,34 @@ class AdherentAdmin extends UserAdmin
protected function configureListFields(ListMapper $listMapper): void
{
parent::configureListFields($listMapper);
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('username')
->addIdentifier('email')
->addIdentifier('adherent.ecompte', null, array('label' => 'Ecompte'))
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.User', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
->addIdentifier('createdAt')
;
if ($this->isGranted('ROLE_ALLOWED_TO_SWITCH')) {
$listMapper
->addIdentifier('impersonating', 'string', ['template' => '@SonataUser/Admin/Field/impersonating.html.twig'])
;
}
}
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('delete');
}
/**
* {@inheritdoc}
*/
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$query->andWhere($query->getRootAliases()[0] . '.adherent IS NOT NULL');
return $query;
}
}
......@@ -2,13 +2,21 @@
namespace App\Admin;
use App\Entity\Geoloc;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
class ComptoirAdmin extends AbstractAdmin
{
protected $datagridValues = [
'_sort_order' => 'ASC',
'_sort_by' => 'name',
];
/**
* {@inheritdoc}
*/
......@@ -22,6 +30,28 @@ class ComptoirAdmin extends AbstractAdmin
protected function configureFormFields(FormMapper $formMapper)
{
$comptoir = $this->getSubject();
$geoloc = new Geoloc();
$comptoir->setGeoloc($geoloc);
$formMapper
->with('Comptoir', ['class' => 'col-md-8'])
->add('groupe')
->add('name')
->add('email')
->add('tel')
->end()
->with('Geoloc', ['class' => 'col-md-4'])
->add('geoloc.adresse', null, array('label' => 'Adresse'))
->add('geoloc.cpostal', null, array('label' => 'Code postal'))
->add('geoloc.ville', null, array('label' => 'Ville'))
->add('geoloc.lat', null, array('label' => 'Latitude'))
->add('geoloc.lon', null, array('label' => 'Longitude'))
->end()
;
}
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('delete');
}
/**
......@@ -29,5 +59,13 @@ class ComptoirAdmin extends AbstractAdmin
*/
protected function configureListFields(ListMapper $listMapper)
{
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('name')
->addIdentifier('email')
->addIdentifier('geoloc.addresse')
->addIdentifier('tel')
->addIdentifier('updatedAt')
;
}
}
......@@ -4,10 +4,14 @@ namespace App\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
class CotisationAdherentAdmin extends CotisationAdmin
{
protected $baseRouteName = 'cotisation_adherent';
protected $baseRoutePattern = 'cotisation_adherent';
/**
* {@inheritdoc}
*/
......@@ -35,8 +39,21 @@ class CotisationAdherentAdmin extends CotisationAdmin
*/
protected function configureFormFields(FormMapper $formMapper): void
{
$formMapper
->with('Cotisation', ['class' => 'col-md-8'])
->add('user', null, array('label' => 'Utilisateur'), array('admin_code' => 'admin.adherent.gerer'))
->end()
;
parent::configureFormFields($formMapper);
$cotisation = $this->getSubject();
}
/**
* {@inheritdoc}
*/
protected function configureRoutes(RouteCollection $collection)
{
parent::configureRoutes($collection);
// $collection->add('create', );
}
/**
......
......@@ -5,10 +5,14 @@ namespace App\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
class CotisationAdmin extends AbstractAdmin
{
protected $baseRouteName = 'cotisation';
protected $baseRoutePattern = 'cotisation';
/**
* {@inheritdoc}
*/
......@@ -22,6 +26,40 @@ class CotisationAdmin extends AbstractAdmin
protected function configureFormFields(FormMapper $formMapper)
{
$cotisation = $this->getSubject();
$formMapper
->with('Cotisation', ['class' => 'col-md-8'])
// ->add('user', null, array('label' => 'Utilisateur'), array('admin_code' => 'admin.adherent.gerer'))
->add('type', null, array('label' => 'Type'))
->add('annee', null, array('label' => 'Année'))
->add('montant', null, array('label' => 'Montant'))
->add('moyen', null, array('label' => 'Moyen'))
->add('recu', null, array('label' => 'Reçu'))
->end()
->with('Date', ['class' => 'col-md-4'])
->add('debut', null, array(
'label' => 'Date de début',
'data' => new \DateTime(),
'widget' => 'single_text',
'html5' => false,
'attr' => ['class' => 'js-datepicker'],
)
)
->add('fin', null, array(
'label' => 'Date de fin',
'data' => new \DateTime('+ 1 year'),
'widget' => 'single_text',
'html5' => false,
'attr' => ['class' => 'js-datepicker'],
)
)
->end()
;
}
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('edit');
$collection->remove('delete');
}
/**
......@@ -29,5 +67,16 @@ class CotisationAdmin extends AbstractAdmin
*/
protected function configureListFields(ListMapper $listMapper)
{
unset($this->listModes['mosaic']);
$listMapper
// ->addIdentifier('user')
->addIdentifier('type')
->addIdentifier('annee')
->addIdentifier('debut')
->addIdentifier('fin')
->addIdentifier('montant')
->addIdentifier('moyen')
->addIdentifier('createdAt')
;
}
}
......@@ -4,10 +4,14 @@ namespace App\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
class CotisationPrestataireAdmin extends CotisationAdmin
{
protected $baseRouteName = 'cotisation_prestataire';
protected $baseRoutePattern = 'cotisation_prestataire';
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
......@@ -31,8 +35,20 @@ class CotisationPrestataireAdmin extends CotisationAdmin
*/
protected function configureFormFields(FormMapper $formMapper): void
{
$formMapper
->with('Cotisation', ['class' => 'col-md-8'])
->add('user', null, array('label' => 'Utilisateur'), array('admin_code' => 'admin.prestataire.gerer'))
->end()
;
parent::configureFormFields($formMapper);
$cotisation = $this->getSubject();
}
/**
* {@inheritdoc}
*/
protected function configureRoutes(RouteCollection $collection)
{
parent::configureRoutes($collection);
}
/**
......@@ -42,5 +58,4 @@ class CotisationPrestataireAdmin extends CotisationAdmin
{
parent::configureListFields($listMapper);
}
}
......@@ -2,19 +2,16 @@
namespace App\Admin;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
class DocumentAdmin extends AbstractAdmin
{
/**
* {@inheritdoc}
*/
protected function configureShowFields(ShowMapper $showMapper)
{
}
/**
* {@inheritdoc}
......@@ -22,6 +19,16 @@ class DocumentAdmin extends AbstractAdmin
protected function configureFormFields(FormMapper $formMapper)
{
$document = $this->getSubject();
$formMapper
->add('name', TextType::class, array(
'label' => 'Titre :'
))
->add('text', CKEditorType::class, array(
'label' => 'Texte',
'required' => false,
))
->add('media', MediaType::class, array('provider' => 'sonata.media.provider.image', 'context' => 'document'))
;
}
/**
......@@ -29,5 +36,11 @@ class DocumentAdmin extends AbstractAdmin
*/
protected function configureListFields(ListMapper $listMapper)
{
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('name', null, array('label' => 'Titre'))
->addIdentifier('text', 'html', array('label' => 'Text'))
->addIdentifier('media', null, array('label' => 'Fichier'))
;
}
}
<?php
namespace App\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
class GlobalConfigurationAdmin extends AbstractAdmin
{
/**
* {@inheritdoc}
*/
protected function configureShowFields(ShowMapper $showMapper)
{
}
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$document = $this->getSubject();
}
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('delete');
}
/**
* {@inheritdoc}
*/
protected function configureListFields(ListMapper $listMapper)
{
}
}
......@@ -2,13 +2,26 @@
namespace App\Admin;
use App\Entity\Comptoir;
use App\Entity\Siege;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
class GroupeAdmin extends AbstractAdmin
{
protected $datagridValues = [
'_sort_order' => 'ASC',
'_sort_by' => 'name',
];
/**
* {@inheritdoc}
*/
......@@ -23,15 +36,74 @@ class GroupeAdmin extends AbstractAdmin
{
$groupe = $this->getSubject();
$formMapper
->add('siege')
->add('comptoir')
->with("Creation d'un groupe")
->add('siege', HiddenType::class, array(
'data' => 1,
'data_class' => null,
'entity_class' => Siege::class,
'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager()
))
->add('name', TextType::class, array(
'label' => 'Nom du groupe :',
'required' => true
))
->add('comptoirs', CollectionType::class, array(
'label' => 'Comptoirs',
'entry_type' => EntityType::class,
'entry_options' => array(
'class' => Comptoir::class,
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Comptoir::class)->findAll(),
'choice_label' => 'slug',
'placeholder' => 'Comptoir',
'required' => false,
'label' => false),
'by_reference' => false,
'allow_add' => true,
'allow_delete' => true
))
->add('enabled', CheckboxType::class, array(
'label' => 'Activé ?',
'required' => false,
'label_attr' => array('class' => 'checkbox-inline')
))
->end()
;
}
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('delete');
}
/**
* {@inheritdoc}
*/
protected function configureListFields(ListMapper $listMapper)
{
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('name', null, array('label' => 'Nom du groupe'))
->add(
'getPrestatairesCount',
null,
[
'label' => 'Nb prestataires',
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'id'],
'sort_parent_association_mappings' => [],
]
)
->add(
'getComptoirsCount',
null,
[
'label' => 'Nb comptoirs',
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'id'],
'sort_parent_association_mappings' => [],
]
)
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Groupeprestataire', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
;
}
}
......@@ -3,9 +3,12 @@
namespace App\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
class GroupeprestataireAdmin extends AbstractAdmin
{
......@@ -28,7 +31,28 @@ class GroupeprestataireAdmin extends AbstractAdmin
*/
protected function configureFormFields(FormMapper $formMapper)
{
$comptoir = $this->getSubject();
$groupepresta = $this->getSubject();
$formMapper
->add('name', TextType::class, array(
'label' => 'Nom du groupe :',
'required' => true
))
->add('enabled', CheckboxType::class, array(
'label' => 'Activé ?',
'required' => false,
'label_attr' => array('class' => 'checkbox-inline')
))
;
}
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
// $datagridMapper
// ->add('phone')
// ->add('email', null, [
// 'show_filter' => true
// ])
// ;
}
/**
......@@ -36,5 +60,40 @@ class GroupeprestataireAdmin extends AbstractAdmin
*/
protected function configureListFields(ListMapper $listMapper)
{
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('name', null, array('label' => 'Nom du groupe'))
->add(
'getPrestatairesCount',
null,
[
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'id'],
'sort_parent_association_mappings' => [],
]
)
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Groupeprestataire', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
;
}
// @TODO : NE FONCTIONNE PAS : pour pouvoir classer par nombre de prestataires !
// voir https://github.com/sonata-project/SonataDoctrineORMAdminBundle/issues/297
// public function createQuery($context = 'list')
// {
// $query = parent::createQuery($context);
// if ('list' === $context) {
// $rootAlias = $query->getRootAliases()[0];
// $parameters = $this->getFilterParameters();
// if ('getPrestatairesCount' === $parameters['_sort_by']) {
// $query->select('o', 'DISTINCT o');
// $query
// ->leftJoin($rootAlias.'.prestataires', 'gpr')
// // ->leftJoin('groupes_prestataires.prestataires', 'pr')
// ->groupBy($rootAlias.'.id')
// ->orderBy('COUNT(gpr.id)', $parameters['_sort_order'])
// ;
// }
// }
// return $query;
// }
}
......@@ -3,9 +3,12 @@
namespace App\Admin;
use App\Admin\UserAdmin;
use FOS\UserBundle\Model\UserManagerInterface;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormEvent;
......@@ -13,11 +16,12 @@ use Symfony\Component\Form\FormEvents;
class PrestataireAdmin extends UserAdmin
{
protected $baseRouteName = 'prestataire';
protected $baseRoutePattern = 'prestataire';
public function configure()
{
parent::configure();
// $this->classnameLabel = "Utilisateurs";
}
/**
......@@ -25,12 +29,93 @@ class PrestataireAdmin extends UserAdmin
*/
protected function configureFormFields(FormMapper $formMapper): void
{
$formMapper
->tab('Prestataire')
->with('General', ['class' => 'col-md-6'])
->add('prestataire.raison', TextType::class, array(
'label' => 'Raison :',
'required' => true
))
->add('prestataire.statut', TextType::class, array(
'label' => 'Statut :',
'required' => false
))
->add('prestataire.siret', TextType::class, array(
'label' => 'SIRET :',
'required' => true
))
->add('prestataire.iban', TextType::class, array(
'label' => 'IBAN :',
'required' => true
))
->end()
->with('Responsable', ['class' => 'col-md-6'])
->add('prestataire.metier', TextType::class, array(
'label' => 'Métier :',
'required' => true
))
->add('prestataire.responsable', TextType::class, array(
'label' => 'Responsable :',
'required' => false
))
->end()
->with('Image', ['class' => 'col-md-6'])
->add('media', MediaType::class, array(
'provider' => 'sonata.media.provider.image',
'context' => 'prestataire'
))
->end()
->end()
;
parent::configureFormFields($formMapper);
$user = $this->getSubject();
}
/**
* @param UserManagerInterface $userManager
*/
public function setUserManager(UserManagerInterface $userManager): void
{
$this->userManager = $userManager;
}
/**
* @return UserManagerInterface
*/
public function getUserManager()
{
return $this->userManager;
}
protected function configureListFields(ListMapper $listMapper): void
{
parent::configureListFields($listMapper);
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('username')
->addIdentifier('email')
->addIdentifier('prestataire.raison')
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.User', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
->addIdentifier('createdAt')
;
if ($this->isGranted('ROLE_ALLOWED_TO_SWITCH')) {
$listMapper
->addIdentifier('impersonating', 'string', ['template' => '@SonataUser/Admin/Field/impersonating.html.twig'])
;
}
}
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('delete');
}
/**
* {@inheritdoc}
*/
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$query->andWhere($query->getRootAliases()[0] . '.prestataire IS NOT NULL');
return $query;
}
}
<?php
namespace App\Admin;
use App\Entity\Comptoir;
use App\Entity\Prestataire;
use App\Entity\Siege;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
class RubriqueAdmin extends AbstractAdmin
{
protected $datagridValues = [
'_sort_order' => 'ASC',
'_sort_by' => 'name',
];
/**
* {@inheritdoc}
*/
protected function configureShowFields(ShowMapper $showMapper)
{
}
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$groupe = $this->getSubject();
$formMapper
->with("Creation d'une rubrique")
->add('name', TextType::class, array(
'label' => 'Nom :',
'required' => true
))
->add('prestataires', CollectionType::class, array(
'label' => 'Prestataires',
'entry_type' => EntityType::class,
'entry_options' => array(
'class' => Prestataire::class,
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true)),
// 'choice_label' => 'name',
'placeholder' => 'Choisir un prestataire',
'required' => false,
'label' => false),
'by_reference' => false,
'allow_add' => true,
'allow_delete' => true
))
->add('enabled', CheckboxType::class, array(
'label' => 'Activé ?',
'required' => false,
'label_attr' => array('class' => 'checkbox-inline')
))
->end()
;
}
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('delete');
}
/**
* {@inheritdoc}
*/
protected function configureListFields(ListMapper $listMapper)
{
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('name', null, array('label' => 'Nom du groupe'))
->add(
'getPrestatairesCount',
null,
[
'label' => 'Nb prestataires',
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'id'],
'sort_parent_association_mappings' => [],
]
)
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Groupeprestataire', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
;
}
}
......@@ -15,6 +15,9 @@ use Symfony\Component\Form\FormEvents;
class UserAdmin extends SonataUserAdmin
{
protected $baseRouteName = 'user';
protected $baseRoutePattern = 'user';
protected $datagridValues = [
// reverse order (default = 'ASC')
'_sort_order' => 'DESC',
......@@ -44,7 +47,15 @@ class UserAdmin extends SonataUserAdmin
protected function configureListFields(ListMapper $listMapper): void
{
parent::configureListFields($listMapper);
// unset($this->listModes['mosaic']);
unset($this->listModes['mosaic']);
// $listMapper
// ->addIdentifier('username', null, array('label' => 'Username'))
// ->addIdentifier('email', null, array('label' => 'Email'));
}
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('delete');
}
/**
......@@ -63,11 +74,17 @@ class UserAdmin extends SonataUserAdmin
/**
* {@inheritdoc}
*/
protected function configureRoutes(RouteCollection $collection)
{
// $collection->remove('create');
// if (!$this->isGranted('ROLE_SUPER_ADMIN')) {
// $collection->clearExcept([]);
// }
}
// protected function configureRoutes(RouteCollection $collection)
// {
// // $collection->remove('create');
// // if (!$this->isGranted('ROLE_SUPER_ADMIN')) {
// // $collection->clearExcept([]);
// // }
// if ($this->isChild()) {
// return;
// }
// // This is the route configuration as a parent
// // $collection->clear();
// }
}
<?php
namespace App\Application\Sonata\MediaBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* References:
* @link http://symfony.com/doc/current/book/bundles.html
*/
class ApplicationSonataMediaBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function getParent()
{
return 'SonataMediaBundle';
}
}
\ No newline at end of file
<?php
namespace App\Application\Sonata\MediaBundle\Document;
use Sonata\MediaBundle\Document\BaseGallery as BaseGallery;
/**
* 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 Gallery extends BaseGallery
{
/**
* @var int $id
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
\ No newline at end of file
<?php
namespace App\Application\Sonata\MediaBundle\Document;
use Sonata\MediaBundle\Document\BaseMedia as BaseMedia;
/**
* 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 Media extends BaseMedia
{
/**
* @var int $id
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
\ No newline at end of file
<?php
namespace App\Application\Sonata\MediaBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Sonata\MediaBundle\Entity\BaseGallery as BaseGallery;
/**
* 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
*
* @ORM\Entity
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="gallerie")
*/
class Gallery extends BaseGallery
{
/**
* @var int
*
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
<?php
namespace App\Application\Sonata\MediaBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Sonata\MediaBundle\Entity\BaseGalleryHasMedia as BaseGalleryHasMedia;
/**
* 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
*
* @ORM\Entity
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="gallerie_has_media")
*/
class GalleryHasMedia extends BaseGalleryHasMedia
{
/**
* @var int
*
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
<?php
namespace App\Application\Sonata\MediaBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Sonata\MediaBundle\Entity\BaseMedia as BaseMedia;
/**
* 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
*
* @ORM\Entity
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="media")
*/
class Media extends BaseMedia
{
/**
* @var int
*
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
<?php
namespace App\Application\Sonata\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseGallery as BaseGallery;
/**
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* References:
* @link http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html
*/
class Gallery extends BaseGallery
{
/**
* @var int $id
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
\ No newline at end of file
<?php
namespace App\Application\Sonata\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseGalleryHasMedia as BaseGalleryHasMedia;
/**
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* References:
* @link http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html
*/
class GalleryHasMedia extends BaseGalleryHasMedia
{
/**
* @var int $id
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
\ No newline at end of file
<?php
namespace App\Application\Sonata\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseGalleryHasMediaRepository;
/**
* 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/query-builder-api.html
*/
class GalleryHasMediaRepository extends BaseGalleryHasMediaRepository
{
}
<?php
namespace App\Application\Sonata\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseGalleryRepository;
/**
* 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/query-builder-api.html
*/
class GalleryRepository extends BaseGalleryRepository
{
}
<?php
namespace App\Application\Sonata\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseMedia as BaseMedia;
/**
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* References:
* @link http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html
*/
class Media extends BaseMedia
{
/**
* @var int $id
*/
protected $id;
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}
\ No newline at end of file
<?php
namespace App\Application\Sonata\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseMediaRepository;
/**
* 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/query-builder-api.html
*/
class MediaRepository extends BaseMediaRepository
{
}
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mongo-mapping xmlns="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping
http://doctrine-project.org/schemas/odm/doctrine-mongo-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
-->
<document name="App\Application\Sonata\MediaBundle\Document\Gallery" >
<field 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\MediaBundle\Entity\Gallery"
table="media__gallery"
>
<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/phpcr-odm/phpcr-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/phpcr-odm/phpcr-mapping
https://github.com/doctrine/phpcr-odm/raw/master/doctrine-phpcr-odm-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
-->
<document name="App\Application\Sonata\MediaBundle\PHPCR\Gallery"
repository-class="App\Application\Sonata\MediaBundle\PHPCR\GalleryRepository">
<id name="id">
<generator strategy="REPOSITORY" />
</id>
</document>
</doctrine-mapping>
<?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\MediaBundle\Entity\GalleryHasMedia"
table="media__gallery_media"
>
<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/phpcr-odm/phpcr-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/phpcr-odm/phpcr-mapping
https://github.com/doctrine/phpcr-odm/raw/master/doctrine-phpcr-odm-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
-->
<document name="App\Application\Sonata\MediaBundle\PHPCR\GalleryHasMedia"
repository-class="App\Application\Sonata\MediaBundle\PHPCR\GalleryHasMediaRepository">
<id name="id">
<generator strategy="REPOSITORY" />
</id>
<reference-many name="media" target-document="App\Application\Sonata\MediaBundle\PHPCR\Media" />
</document>
</doctrine-mapping>
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mongo-mapping xmlns="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping
http://doctrine-project.org/schemas/odm/doctrine-mongo-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
-->
<document name="App\Application\Sonata\MediaBundle\Document\Media" >
<field 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\MediaBundle\Entity\Media"
table="media__media"
>
<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/phpcr-odm/phpcr-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/phpcr-odm/phpcr-mapping
https://github.com/doctrine/phpcr-odm/raw/master/doctrine-phpcr-odm-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
-->
<document name="App\Application\Sonata\MediaBundle\PHPCR\Media"
repository-class="App\Application\Sonata\MediaBundle\PHPCR\MediaRepository" >
<id name="id">
<generator strategy="REPOSITORY" />
</id>
</document>
</doctrine-mapping>
<?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\MediaBundle\Document\Gallery" exclusion-policy="all" xml-root-name="_gallery">
<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\MediaBundle\Document\GalleryHasMedia" exclusion-policy="all" xml-root-name="_gallery_has_media">
<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\MediaBundle\Document\Media" exclusion-policy="all" xml-root-name="_media">
<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\MediaBundle\Entity\Gallery" exclusion-policy="all" xml-root-name="_gallery">
<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\MediaBundle\Entity\GalleryHasMedia" exclusion-policy="all" xml-root-name="_gallery_has_media">
<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\MediaBundle\Entity\Media" exclusion-policy="all" xml-root-name="_media">
<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>
......@@ -2,16 +2,54 @@
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/** @Route("/admina", name="admina_") */
class AdminController extends AbstractController
/// @ Route ("/admina", name="admina_")
class AdminController extends Controller
{
private $em;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
/**
* @Route("/setenable/{type}/{id}", name="setenable")
*/
public function setEnableAction($type, $id, Request $request)
{
$referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
$status = 'success';
try {
$object = $this->em->getRepository(str_replace('.', ':', $type))->findOneById($id);
if ($object && method_exists($object, 'setEnabled')) {
$object->setEnabled(!$object->isEnabled());
$this->em->persist($object);
$this->em->flush();
} else {
$status = 'error';
}
} catch (\Exception $e) {
$status = 'error';
}
return new JsonResponse(array('status' => $status, 'newvalue' => ($object->isEnabled()?'true':'false')));
}
/**
* Voir tous les dashboards
* Route admin_index
* @Route("/", name="settings")
* @Route("/a", name="settings")
*/
public function settings()
{
......
......@@ -8,7 +8,7 @@ use Symfony\Component\Routing\Annotation\Route;
class IndexController extends AbstractController
{
/**
* @Route("/index", name="index")
* @Route("/", name="index")
*/
// public function index(TranslatorInterface $translator)
public function index()
......
......@@ -25,7 +25,7 @@ class Adherent
/**
* @var User
*
* @ORM\OneToOne(targetEntity="User", cascade={"persist"}, inversedBy="adherent")
* @ORM\OneToOne(targetEntity="User", cascade={"all"}, mappedBy="adherent")
*/
protected $user;
......@@ -63,4 +63,16 @@ class Adherent
$this->user = $user;
return $this;
}
public function isEnabled(): bool
{
return $this->getUser()->isEnabled();
}
public function setEnabled($enabled): self
{
$this->getUser()->setEnabled($enabled);
return $this;
}
}
......@@ -15,8 +15,6 @@ class Charte
{
use NameSlugContentEntityTrait;
const UPLOAD_DIR = "charte";
/**
* @var int
*
......@@ -27,20 +25,17 @@ class Charte
protected $id;
/**
* @var null|Image
*
* @Assert\Valid()
* @ORM\OneToOne(targetEntity="Image", cascade={"all"}, orphanRemoval=true, fetch="EAGER")
*/
private $image;
* @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id")
*/
protected $media;
/**
* @var null|Fichier
*
* @Assert\Valid()
* @ORM\OneToOne(targetEntity="Fichier", cascade={"all"}, orphanRemoval=true, fetch="EAGER")
* @ORM\Column(type="text", nullable=true)
*/
protected $fichier;
private $text;
/**
* @return int
......@@ -51,40 +46,38 @@ class Charte
}
/**
* @return Image|null
*/
public function getImage(): ?Image
* Get media
* @return
*/
public function getMedia()
{
return $this->image;
return $this->media;
}
/**
* @param Image|null $image
* @return Charte
*/
public function setImage(?Image $image)
* Set media
* @return $this
*/
public function setMedia($media)
{
$image->setType(self::UPLOAD_DIR);
$this->image = $image;
$this->media = $media;
return $this;
}
/**
* @return Fichier|null
*/
public function getFichier(): ?Fichier
public function getText(): ?string
{
return $this->fichier;
return $this->text;
}
/**
* @param Fichier|null $fichier
* @return Charte
*/
public function setFichier(?Fichier $fichier)
public function setText(?string $text): self
{
$fichier->setType(self::UPLOAD_DIR);
$this->fichier = $fichier;
$this->text = $text;
return $this;
}
public function __toString(): string
{
return $this->getTitle()?$this->getTitle():'Charte';
}
}
......@@ -38,20 +38,29 @@ class Comptoir
protected $id;
/**
* @var null|Fichier
*
* @Assert\Valid()
* @ORM\OneToOne(targetEntity="Fichier", cascade={"all"}, orphanRemoval=true, fetch="EAGER")
*/
protected $fichier;
* @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id")
*/
protected $media;
/**
* @var Groupe $comptoirGroup
*
* @ORM\ManyToOne(targetEntity="Groupe", inversedBy="comptoirs")
* @ORM\OrderBy({"name": "ASC"})
*/
private $groupe;
// *
// * @var User
// *
// * @ORM\ManyToOne(targetEntity="User", inversedBy="cotisations")
// * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
// private $user;
/**
* @return int
*/
......@@ -79,21 +88,21 @@ class Comptoir
}
/**
* @return Fichier
*/
public function getFichier(): ?Fichier
* Get media
* @return
*/
public function getMedia()
{
return $this->fichier;
return $this->media;
}
/**
* @param Fichier $fichier
* @return Comptoir
*/
public function setFichier(?Fichier $fichier)
* Set media
* @return $this
*/
public function setMedia($media)
{
$fichier->setType(self::UPLOAD_DIR);
$this->fichier = $fichier;
$this->media = $media;
return $this;
}
......@@ -114,4 +123,9 @@ class Comptoir
{
return $this->groupe;
}
public function __toString(): string
{
return (!empty($this->name)?$this->name:'Comptoir');
}
}
......@@ -92,7 +92,7 @@ class Cotisation
/**
* @return User
*/
public function getUser(): User
public function getUser(): ?User
{
return $this->user;
}
......@@ -110,7 +110,7 @@ class Cotisation
/**
* @return string
*/
public function getType(): string
public function getType(): ?string
{
return $this->type;
}
......@@ -128,7 +128,7 @@ class Cotisation
/**
* @return int
*/
public function getAnnee(): int
public function getAnnee(): ?int
{
return $this->annee;
}
......@@ -146,7 +146,7 @@ class Cotisation
/**
* @return \DateTime
*/
public function getDebut(): \DateTime
public function getDebut(): ?\DateTime
{
return $this->debut;
}
......@@ -164,7 +164,7 @@ class Cotisation
/**
* @return \DateTime
*/
public function getFin(): \DateTime
public function getFin(): ?\DateTime
{
return $this->fin;
}
......@@ -182,7 +182,7 @@ class Cotisation
/**
* @return float
*/
public function getMontant(): float
public function getMontant(): ?float
{
return $this->montant;
}
......@@ -200,7 +200,7 @@ class Cotisation
/**
* @return string
*/
public function getMoyen(): string
public function getMoyen(): ?string
{
return $this->moyen;
}
......@@ -218,7 +218,7 @@ class Cotisation
/**
* @return bool
*/
public function isRecu(): bool
public function isRecu(): ?bool
{
return $this->recu;
}
......
......@@ -19,8 +19,6 @@ class Document
TimestampableEntity,
NameSlugContentEntityTrait;
const UPLOAD_DIR = "document";
/**
* @var int
*
......@@ -31,12 +29,12 @@ class Document
protected $id;
/**
* @var null|Fichier
*
* @Assert\Valid()
* @ORM\OneToOne(targetEntity="Fichier", cascade={"all"}, orphanRemoval=true, fetch="EAGER")
*/
protected $fichier;
* @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id")
*/
protected $media;
/**
* @var User
......@@ -47,6 +45,11 @@ class Document
private $user;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $text;
/**
* @return int
*/
public function getId(): int
......@@ -73,21 +76,38 @@ class Document
}
/**
* @return Fichier|null
*/
public function getFichier(): ?Fichier
* Get media
* @return
*/
public function getMedia()
{
return $this->fichier;
return $this->media;
}
/**
* @param Fichier|null $fichier
* @return Document
*/
public function setFichier(?Fichier $fichier)
* Set media
* @return $this
*/
public function setMedia($media)
{
$fichier->setType(self::UPLOAD_DIR);
$this->fichier = $fichier;
$this->media = $media;
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function __toString(): string
{
return $this->getTitle()?$this->getTitle():'Document';
}
}
......@@ -3,8 +3,9 @@
namespace App\Entity;
use App\Entity\EntityTrait\EnablableEntityTrait;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
......@@ -15,9 +16,9 @@ use Symfony\Component\Validator\Constraints as Assert;
class Faq
{
use TimestampableEntity,
EnablableEntityTrait;
EnablableEntityTrait,
NameSlugContentEntityTrait;
const UPLOAD_DIR = "faq";
/**
* @var int
*
......@@ -28,14 +29,27 @@ class Faq
protected $id;
/**
* @var null|Fichier
*
* @Assert\Valid()
* @ORM\OneToOne(targetEntity="Fichier", cascade={"all"}, orphanRemoval=true, fetch="EAGER")
* @ORM\Column(type="text", nullable=true)
*/
private $text;
/**
* @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id")
*/
protected $fichier;
/**
* @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id")
*/
protected $image;
/**
* @var null|User
*
* @ORM\ManyToOne(targetEntity="User", inversedBy="faqs", cascade={"persist"})
......@@ -51,6 +65,18 @@ class Faq
return $this->id;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
/**
* @return null|User
*/
......@@ -70,20 +96,44 @@ class Faq
}
/**
* @return Fichier|null
* @return Media|null
*/
public function getFichier(): ?Fichier
public function getFichier()
{
return $this->fichier;
}
/**
* @param Fichier|null $fichier
* @param Media|null $fichier
* @return Faq
*/
public function setFichier(?Fichier $fichier)
public function setFichier($fichier)
{
$this->fichier = $fichier;
return $this;
}
/**
* Get image
* @return image|null
*/
public function getImage()
{
return $this->image;
}
/**
* Set image
* @return $this
*/
public function setImage($image)
{
$this->image = $image;
return $this;
}
public function __toString(): string
{
return $this->getTitle()?$this->getTitle():'FAQ';
}
}
......@@ -157,4 +157,9 @@ class Geoloc
$this->lon = $lon;
return $this;
}
public function __toString(): string
{
return (!empty($this->adresse)?$this->adresse:'').' '.(!empty($this->cpostal)?$this->cpostal:'').' '.(!empty($this->ville)?$this->ville:'');
}
}
......@@ -2,57 +2,94 @@
namespace App\Entity;
use App\Entity\EntityTrait\EnablableEntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"fichier" = "Fichier", "image" = "Image"})
* @Vich\Uploadable
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="fichier")
* @ORM\Entity(repositoryClass="App\Repository\GlobalConfigurationRepository")
*/
class Fichier
class GlobalConfiguration
{
use EnablableEntityTrait;
/**
* @var int
*
* @ORM\Id
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
private $id;
/**
* @Vich\UploadableField(mapping="balls", fileNameProperty="path")
* @Assert\File(maxSize="2M", mimeTypes={"image/png"})
* @ORM\Column(type="string", length=100)
*/
protected $file;
private $mlcname;
/**
* @var string
*
* @ORM\Column(name="path", type="text", nullable=true)
* @ORM\Column(type="string", length=50)
*/
private $mlcsmallname;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $path;
private $charte;
/**
* @return int
* @Assert\Image(maxSize="2M", minWidth="50", minHeight="50")
* @Vich\UploadableField(mapping="logo", fileNameProperty="path")
* @Assert\File(maxSize="2M", mimeTypes={"image/*"})
*/
public function getId(): int
protected $logo;
/**
* @var string
*
* @ORM\Column(name="pathlogo", type="text", nullable=true)
*/
private $pathlogo;
public function getId(): ?int
{
return $this->id;
}
public function getMlcname(): ?string
{
return $this->mlcname;
}
public function setMlcname(string $mlcname): self
{
$this->mlcname = $mlcname;
return $this;
}
public function getMlcsmallname(): ?string
{
return $this->mlcsmallname;
}
public function setMlcsmallname(string $mlcsmallname): self
{
$this->mlcsmallname = $mlcsmallname;
return $this;
}
public function getCharte(): ?string
{
return $this->charte;
}
public function setCharte(?string $charte): self
{
$this->charte = $charte;
return $this;
}
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
......@@ -62,9 +99,9 @@ class Fichier
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
*/
public function setfile(File $image = null)
public function setLogo(File $image = null)
{
$this->file = $image;
$this->logo = $image;
if ($image) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
......@@ -72,9 +109,9 @@ class Fichier
}
}
public function getFile()
public function getLogo()
{
return $this->file;
return $this->logo;
}
/**
......@@ -83,9 +120,9 @@ class Fichier
* @param string $path
* @return Photo
*/
public function setPath($path)
public function setPathLogo($path)
{
$this->path = $path;
$this->pathlogo = $path;
return $this;
}
......@@ -95,8 +132,8 @@ class Fichier
*
* @return string
*/
public function getPath()
public function getPathLogo()
{
return $this->path;
return $this->pathlogo;
}
}
......@@ -6,11 +6,13 @@ use App\Entity\Comptoir;
use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\HasCompteEntity;
use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use App\Entity\Prestataire;
use App\Entity\Siege;
use App\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
......@@ -20,6 +22,7 @@ use Symfony\Component\Validator\Constraints as Assert;
class Groupe
{
use NameSlugContentEntityTrait,
TimestampableEntity,
EnablableEntityTrait;
/**
......@@ -41,13 +44,22 @@ class Groupe
/**
* @var ArrayCollection|Comptoir[]
* @ORM\OneToMany(targetEntity="Comptoir", mappedBy="groupe", cascade={"persist"})
* @ORM\OneToMany(targetEntity="Comptoir", mappedBy="groupe", cascade={"persist"}, fetch="EXTRA_LAZY")
* @ORM\OrderBy({"name": "ASC"})
*/
private $comptoirs;
/**
* @var ArrayCollection|Prestataire[]
* @ORM\OneToMany(targetEntity="Prestataire", mappedBy="prestataireGroup", cascade={"persist"}, fetch="EXTRA_LAZY")
* @ORM\OrderBy({"name": "ASC"})
*/
private $prestataires;
public function __construct()
{
$this->users = new ArrayCollection();
$this->comptoirs = new ArrayCollection();
$this->prestataires = new ArrayCollection();
}
/**
......@@ -103,7 +115,7 @@ class Groupe
{
if (!$this->comptoirs->contains($comptoir)) {
$this->comptoirs[] = $comptoir;
$comptoir->setComptoirGroup($this);
$comptoir->setGroupe($this);
}
return $this;
}
......@@ -116,8 +128,57 @@ class Groupe
{
if ($this->comptoirs->contains($comptoir)) {
$this->comptoirs->removeElement($comptoir);
$comptoir->setComptoirGroup(null);
$comptoir->setGroupe(null);
}
return $this;
}
/**
* @return Prestataire[]|ArrayCollection
*/
public function getPrestataires()
{
return $this->prestataires;
}
/**
* @param Prestataire $prestataire
* @return $this
*/
public function addPrestataire(Prestataire $prestataire)
{
if (!$this->prestataires->contains($prestataire)) {
$this->prestataires[] = $prestataire;
$prestataire->setPrestataireGroup($this);
}
return $this;
}
/**
* @param Prestataire $prestataire
* @return $this
*/
public function removePrestataire(Prestataire $prestataire)
{
if ($this->prestataires->contains($prestataire)) {
$this->prestataires->removeElement($prestataire);
$prestataire->setPrestataireGroup(null);
}
return $this;
}
public function getComptoirsCount()
{
return $this->getComptoirs()->count();
}
public function getPrestatairesCount()
{
return $this->getPrestataires()->count();
}
public function __toString(): string
{
return $this->getName()?$this->getName():'Groupe';
}
}
......@@ -25,8 +25,6 @@ class Groupeprestataire
{
use NameSlugContentEntityTrait,
TimestampableEntity,
GeolocEntityTrait,
ContactEmailTelTrait,
EnablableEntityTrait;
/**
......@@ -39,26 +37,12 @@ class Groupeprestataire
protected $id;
/**
* @var null|string (amap, marche, ...)
*
* @ORM\Column(name="type", type="string", length=20, nullable=false)
*/
protected $type;
/**
* @var ArrayCollection|Prestataire[]
*
* @ORM\ManyToMany(targetEntity="Prestataire", inversedBy="groupeprestataires", cascade={"persist"}, fetch="EXTRA_LAZY")
*/
protected $prestataires;
/**
* @var null|string (champ libre)
*
* @ORM\Column(name="horaires", type="string", length=200, nullable=true)
*/
private $horaires;
public function __construct()
{
$this->prestataires = new ArrayCollection();
......@@ -73,25 +57,6 @@ class Groupeprestataire
}
/**
* Get type
* @return string type
*/
public function getType(): ?string
{
return $this->type;
}
/**
* Set type
* @return $this
*/
public function setType($type): self
{
$this->type = $type;
return $this;
}
/**
* @return Prestataire[]|ArrayCollection
*/
public function getPrestataires()
......@@ -125,22 +90,8 @@ class Groupeprestataire
return $this;
}
/**
* Get horaires
* @return string Horaires
*/
public function getHoraires(): ?string
public function getPrestatairesCount()
{
return $this->horaires;
}
/**
* Set horaires
* @return $this
*/
public function setHoraires($horaires): self
{
$this->horaires = $horaires;
return $this;
return $this->getPrestataires()->count();
}
}
<?php
namespace App\Entity;
use App\Entity\EntityTrait\EnablableEntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\HasLifecycleCallbacks()
*/
class Image extends Fichier
{
use EnablableEntityTrait;
/**
* @Assert\Image()
*/
protected $file;
/**
* @var null|int
*
* @ORM\Column(type="integer", nullable=true)
*/
protected $width;
/**
* @var null|int
*
* @ORM\Column(type="integer", nullable=true)
*/
protected $height;
/**
* @return int|null
*/
public function getWidth(): ?int
{
return $this->width;
}
/**
* @param int|null $width
* @return $this
*/
public function setWidth(?int $width)
{
$this->width = $width;
return $this;
}
/**
* @return int|null
*/
public function getHeight(): ?int
{
return $this->height;
}
/**
* @param int|null $height
* @return $this
*/
public function setHeight(?int $height)
{
$this->height = $height;
return $this;
}
/**
* @ORM\PreFlush()
*/
public function upload()
{
if ($this->getFile() != null) {
list($width, $height) = getimagesize($this->getAbsolutePath());
$this->setWidth($width)->setHeight($height);
}
parent::upload();
}
}
......@@ -32,12 +32,12 @@ class News
protected $id;
/**
* @var null|Fichier
*
* @Assert\Valid()
* @ORM\OneToOne(targetEntity="Fichier", cascade={"all"}, orphanRemoval=true, fetch="EAGER")
*/
protected $fichier;
* @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id")
*/
protected $media;
/**
* @var User
......@@ -63,40 +63,41 @@ class News
}
/**
* @param User $user
* @return $this
*/
public function setuser(User $user)
* Get media
* @return
*/
public function getMedia()
{
$this->user = $user;
return $this;
return $this->media;
}
/**
* @return User
*/
public function getuser(): User
* Set media
* @return $this
*/
public function setMedia($media)
{
return $this->user;
$this->media = $media;
return $this;
}
/**
* @return Fichier|null
* @param User $user
* @return $this
*/
public function getFichier(): ?Fichier
public function setuser(User $user)
{
return $this->fichier;
$this->user = $user;
return $this;
}
/**
* @param Fichier|null $fichier
* @return News
* @return User
*/
public function setFichier(?Fichier $fichier)
public function getuser(): User
{
$fichier->setType(self::UPLOAD_DIR);
$this->fichier = $fichier;
return $this;
return $this->user;
}
/**
......
......@@ -5,10 +5,11 @@ namespace App\Entity;
use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\GeolocEntityTrait;
use App\Entity\EntityTrait\HasCompteEntity;
use App\Entity\Groupeprestataire;
use App\Entity\Image;
use App\Entity\User;
use App\Entity\Rubrique;
use App\Entity\TypePrestataire;
use App\Entity\Groupeprestataire;
use App\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
......@@ -92,6 +93,13 @@ class Prestataire
private $accept = false;
/**
* @var null|string (champ libre)
*
* @ORM\Column(name="horaires", type="string", length=255, nullable=true)
*/
private $horaires;
/**
* @var TypePrestataire
*
* @ORM\ManyToOne(targetEntity="TypePrestataire", cascade={"persist"}, inversedBy="prestataires")
......@@ -99,31 +107,38 @@ class Prestataire
private $typeprestataire;
/**
* @var null|Image
*
* @Assert\Valid()
* @ORM\OneToOne(targetEntity="Image", cascade={"all"}, orphanRemoval=true, fetch="EAGER")
* @var ArrayCollection|Rubrique[]
* @ORM\ManyToMany(targetEntity="Rubrique", mappedBy="prestataires", cascade={"persist"}, fetch="EXTRA_LAZY")
* @ORM\JoinTable(name="rubrique_prestataire")
*/
private $image;
private $rubriques;
/**
* @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id")
*/
protected $media;
/**
* @var User
*
* @ORM\OneToOne(targetEntity="User", cascade={"persist"}, inversedBy="prestataire")
* @ORM\OneToOne(targetEntity="User", cascade={"all"}, mappedBy="prestataire")
*/
protected $user;
/**
* @var Groupe $prestataireGroup
*
* @ORM\ManyToOne(targetEntity="Groupe", inversedBy="prestataires")
* @ORM\ManyToOne(targetEntity="Groupe", cascade={"persist", "remove"}, inversedBy="prestataires")
*/
private $prestataireGroup;
/**
* @var ArrayCollection|Amap[]
* @ORM\ManyToMany(targetEntity="Groupeprestataire", mappedBy="prestataires", cascade={"persist"}, fetch="EXTRA_LAZY")
* @ORM\JoinTable(name="amap_prestataire")
* @ORM\JoinTable(name="groupes_prestataires")
*/
private $groupeprestataires;
......@@ -305,25 +320,6 @@ class Prestataire
}
/**
* @return Image|null
*/
public function getImage(): ?Image
{
return $this->image;
}
/**
* @param Image|null $image
* @return Prestataire
*/
public function setImage(?Image $image)
{
$image->setType(self::UPLOAD_DIR);
$this->image = $image;
return $this;
}
/**
* @return User
*/
public function getUser(): User
......@@ -379,6 +375,40 @@ class Prestataire
}
/**
* @return Rubrique[]|ArrayCollection
*/
public function getRubriques()
{
return $this->rubriques;
}
/**
* @param Rubrique $rubrique
* @return $this
*/
public function addRubrique(Rubrique $rubrique)
{
if (!$this->rubriques->contains($rubrique)) {
$this->rubriques[] = $rubrique;
$rubrique->addPrestataire($this);
}
return $this;
}
/**
* @param Rubrique $rubrique
* @return $this
*/
public function removeRubrique(Rubrique $rubrique)
{
if ($this->rubriques->contains($rubrique)) {
$this->rubriques->removeElement($rubrique);
$rubrique->removePrestataire($this);
}
return $this;
}
/**
* @return Amap[]|ArrayCollection
*/
public function getGroupeprestataires()
......@@ -411,4 +441,47 @@ class Prestataire
}
return $this;
}
/**
* Get horaires
* @return string Horaires
*/
public function getHoraires(): ?string
{
return $this->horaires;
}
/**
* Set horaires
* @return $this
*/
public function setHoraires($horaires): self
{
$this->horaires = $horaires;
return $this;
}
/**
* Get media
* @return
*/
public function getMedia()
{
return $this->media;
}
/**
* Set media
* @return $this
*/
public function setMedia($media)
{
$this->media = $media;
return $this;
}
public function __toString(): string
{
return ($this->raison?$this->raison:($this->getUser()?$this->getUser()->getFullname():'Prestataire '.$this->getId()));
}
}
......@@ -34,6 +34,11 @@ class Rubrique
*/
private $prestataires;
public function __construct()
{
$this->prestataires = new ArrayCollection();
}
/**
* @return mixed
*/
......@@ -75,4 +80,14 @@ class Rubrique
}
return $this;
}
public function getPrestatairesCount()
{
return $this->getPrestataires()->count();
}
public function __toString(): string
{
return $this->getTitle()?$this->getTitle():'Rubrique';
}
}
......@@ -2,6 +2,8 @@
namespace App\Entity;
use App\Entity\Adherent;
use App\Entity\Prestataire;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Mapping as ORM;
......@@ -41,23 +43,23 @@ class User extends BaseUser
protected $mobile;
/**
* @var User
*
* @ORM\OneToOne(targetEntity="User", cascade={"persist"}, inversedBy="adherent")
* @ORM\OneToOne(targetEntity="Adherent", inversedBy="user", cascade={"all"})
* @ORM\JoinColumn(name="adherent_id", referencedColumnName="id", nullable=true)
*/
protected $user;
protected $adherent;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Adherent", inversedBy="user", cascade={"persist"})
* @ORM\JoinColumn(name="adherent", referencedColumnName="id", nullable=true)
* @ORM\OneToOne(targetEntity="Prestataire", inversedBy="user", cascade={"all"})
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=true)
*/
protected $adherent;
protected $prestataire;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Prestataire", inversedBy="user", cascade={"persist"})
* @ORM\JoinColumn(name="prestataire", referencedColumnName="id", nullable=true)
* @var ArrayCollection|Cotisation[]
*
* @ORM\OneToMany(targetEntity="Cotisation", mappedBy="user", cascade={"all"}, orphanRemoval=true)
*/
protected $prestataire;
private $cotisations;
public function __construct()
{
......@@ -144,4 +146,75 @@ class User extends BaseUser
}
return $isSuperAdmin;
}
/**
* Get adherent
* @return
*/
public function getAdherent()
{
return $this->adherent;
}
/**
* Set adherent
* @return $this
*/
public function setAdherent($adherent): self
{
$this->adherent = $adherent;
return $this;
}
/**
* Get prestataire
* @return
*/
public function getPrestataire()
{
return $this->prestataire;
}
/**
* Set prestataire
* @return $this
*/
public function setPrestataire($prestataire): self
{
$this->prestataire = $prestataire;
return $this;
}
/**
* @return Cotisation[]|ArrayCollection
*/
public function getCotisations()
{
return $this->cotisations;
}
/**
* @param Cotisation $cotisation
* @return $this
*/
public function addCotisation(Cotisation $cotisation)
{
if (!$this->cotisations->contains($cotisation)) {
$this->cotisations[] = $cotisation;
$cotisation->setUser($this);
}
return $this;
}
/**
* @param Cotisation $cotisation
* @return $this
*/
public function removeCotisation(Cotisation $cotisation)
{
if ($this->cotisations->contains($cotisation)) {
$this->cotisations->removeElement($cotisation);
}
return $this;
}
}
<?php
namespace App\Form;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
class EntityToIdTransformer implements DataTransformerInterface
{
/**
* @var ObjectManager
*/
protected $objectManager;
/**
* @var string
*/
protected $class;
public function __construct(ObjectManager $objectManager, $class)
{
$this->objectManager = $objectManager;
$this->class = $class;
}
public function transform($entity)
{
if (null === $entity) {
return;
}
if (!is_object($entity)) {
$entityO = $this->objectManager
->getRepository($this->class)
->find($entity);
if (null === $entityO) {
throw new TransformationFailedException();
}
return $entityO;
}
return $entity->getId();
}
public function reverseTransform($id)
{
if (!$id) {
return null;
}
$entity = $this->objectManager
->getRepository($this->class)
->find($id);
if (null === $entity) {
throw new TransformationFailedException();
}
return $entity;
}
}
<?php
namespace App\Form;
use App\Form\EntityToIdTransformer;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class HiddenEntityExtension extends AbstractTypeExtension
{
public function getExtendedTypes()
{
return array(HiddenType::class);
}
/**
* Add the entity_class option
*
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefined(array('em'));
$resolver->setDefined(array('entity_class'));
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
if (isset($options['em'])&&isset($options['entity_class'])) {
$builder->addModelTransformer(new EntityToIdTransformer(
$options['em'],
$options['entity_class']
));
}
}
}
<?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 Version20190109150314 extends AbstractMigration
{
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 global_configuration (id INT AUTO_INCREMENT NOT NULL, mlcname VARCHAR(100) NOT NULL, mlcsmallname VARCHAR(50) NOT NULL, charte LONGTEXT DEFAULT NULL, pathlogo LONGTEXT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB');
}
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('DROP TABLE global_configuration');
}
}
<?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 Version20190109155035 extends AbstractMigration
{
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 media__gallery_media (id INT AUTO_INCREMENT NOT NULL, position INT NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE media__gallery (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, context VARCHAR(64) NOT NULL, default_format VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE media__media (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, provider_name VARCHAR(255) NOT NULL, provider_status INT NOT NULL, provider_reference VARCHAR(255) NOT NULL, provider_metadata LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', width INT DEFAULT NULL, height INT DEFAULT NULL, length NUMERIC(10, 0) DEFAULT NULL, content_type VARCHAR(255) DEFAULT NULL, content_size INT DEFAULT NULL, copyright VARCHAR(255) DEFAULT NULL, author_name VARCHAR(255) DEFAULT NULL, context VARCHAR(64) DEFAULT NULL, cdn_is_flushable TINYINT(1) DEFAULT NULL, cdn_flush_identifier VARCHAR(64) DEFAULT NULL, cdn_flush_at DATETIME DEFAULT NULL, cdn_status INT DEFAULT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB');
}
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('DROP TABLE media__gallery_media');
$this->addSql('DROP TABLE media__gallery');
$this->addSql('DROP TABLE media__media');
}
}
<?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 Version20190109162609 extends AbstractMigration
{
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('ALTER TABLE document DROP FOREIGN KEY FK_D8698A76F915CFE');
$this->addSql('DROP INDEX UNIQ_D8698A76F915CFE ON document');
$this->addSql('ALTER TABLE document ADD text LONGTEXT DEFAULT NULL, CHANGE fichier_id media_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE document ADD CONSTRAINT FK_D8698A76EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)');
$this->addSql('CREATE INDEX IDX_D8698A76EA9FDD75 ON document (media_id)');
$this->addSql('ALTER TABLE media__gallery_media ADD gallery_id INT DEFAULT NULL, ADD media_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C5414E7AF8F FOREIGN KEY (gallery_id) REFERENCES media__gallery (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C541EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_80D4C5414E7AF8F ON media__gallery_media (gallery_id)');
$this->addSql('CREATE INDEX IDX_80D4C541EA9FDD75 ON media__gallery_media (media_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 document DROP FOREIGN KEY FK_D8698A76EA9FDD75');
$this->addSql('DROP INDEX IDX_D8698A76EA9FDD75 ON document');
$this->addSql('ALTER TABLE document DROP text, CHANGE media_id fichier_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE document ADD CONSTRAINT FK_D8698A76F915CFE FOREIGN KEY (fichier_id) REFERENCES fichier (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_D8698A76F915CFE ON document (fichier_id)');
$this->addSql('ALTER TABLE media__gallery_media DROP FOREIGN KEY FK_80D4C5414E7AF8F');
$this->addSql('ALTER TABLE media__gallery_media DROP FOREIGN KEY FK_80D4C541EA9FDD75');
$this->addSql('DROP INDEX IDX_80D4C5414E7AF8F ON media__gallery_media');
$this->addSql('DROP INDEX IDX_80D4C541EA9FDD75 ON media__gallery_media');
$this->addSql('ALTER TABLE media__gallery_media DROP gallery_id, DROP media_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 Version20190109171819 extends AbstractMigration
{
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('ALTER TABLE charte DROP FOREIGN KEY FK_3484E5A63DA5256D');
$this->addSql('ALTER TABLE charte DROP FOREIGN KEY FK_3484E5A6F915CFE');
$this->addSql('ALTER TABLE comptoir DROP FOREIGN KEY FK_A6E2C35EF915CFE');
$this->addSql('ALTER TABLE faq DROP FOREIGN KEY FK_E8FF75CCF915CFE');
$this->addSql('ALTER TABLE news DROP FOREIGN KEY FK_1DD39950F915CFE');
$this->addSql('ALTER TABLE prestataire DROP FOREIGN KEY FK_60A264803DA5256D');
$this->addSql('DROP TABLE fichier');
$this->addSql('DROP INDEX UNIQ_1DD39950F915CFE ON news');
$this->addSql('ALTER TABLE news CHANGE fichier_id media_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD39950EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)');
$this->addSql('CREATE INDEX IDX_1DD39950EA9FDD75 ON news (media_id)');
$this->addSql('DROP INDEX UNIQ_A6E2C35EF915CFE ON comptoir');
$this->addSql('ALTER TABLE comptoir CHANGE fichier_id media_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE comptoir ADD CONSTRAINT FK_A6E2C35EEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)');
$this->addSql('CREATE INDEX IDX_A6E2C35EEA9FDD75 ON comptoir (media_id)');
$this->addSql('DROP INDEX UNIQ_3484E5A6F915CFE ON charte');
$this->addSql('DROP INDEX UNIQ_3484E5A63DA5256D ON charte');
$this->addSql('ALTER TABLE charte ADD media_id INT DEFAULT NULL, ADD text LONGTEXT DEFAULT NULL, DROP image_id, DROP fichier_id');
$this->addSql('ALTER TABLE charte ADD CONSTRAINT FK_3484E5A6EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)');
$this->addSql('CREATE INDEX IDX_3484E5A6EA9FDD75 ON charte (media_id)');
$this->addSql('DROP INDEX UNIQ_60A264803DA5256D ON prestataire');
$this->addSql('ALTER TABLE prestataire CHANGE image_id media_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE prestataire ADD CONSTRAINT FK_60A26480EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)');
$this->addSql('CREATE INDEX IDX_60A26480EA9FDD75 ON prestataire (media_id)');
$this->addSql('DROP INDEX UNIQ_E8FF75CCF915CFE ON faq');
$this->addSql('ALTER TABLE faq ADD text LONGTEXT DEFAULT NULL, ADD name VARCHAR(150) NOT NULL, ADD slug VARCHAR(150) NOT NULL, ADD content LONGTEXT DEFAULT NULL, CHANGE fichier_id media_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE faq ADD CONSTRAINT FK_E8FF75CCEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E8FF75CC989D9B62 ON faq (slug)');
$this->addSql('CREATE INDEX IDX_E8FF75CCEA9FDD75 ON faq (media_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('CREATE TABLE fichier (id INT AUTO_INCREMENT NOT NULL, path LONGTEXT DEFAULT NULL COLLATE utf8mb4_unicode_ci, discr VARCHAR(255) NOT NULL COLLATE utf8mb4_unicode_ci, width INT DEFAULT NULL, height INT DEFAULT NULL, enabled TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE charte DROP FOREIGN KEY FK_3484E5A6EA9FDD75');
$this->addSql('DROP INDEX IDX_3484E5A6EA9FDD75 ON charte');
$this->addSql('ALTER TABLE charte ADD fichier_id INT DEFAULT NULL, DROP text, CHANGE media_id image_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE charte ADD CONSTRAINT FK_3484E5A63DA5256D FOREIGN KEY (image_id) REFERENCES fichier (id)');
$this->addSql('ALTER TABLE charte ADD CONSTRAINT FK_3484E5A6F915CFE FOREIGN KEY (fichier_id) REFERENCES fichier (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_3484E5A6F915CFE ON charte (fichier_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_3484E5A63DA5256D ON charte (image_id)');
$this->addSql('ALTER TABLE comptoir DROP FOREIGN KEY FK_A6E2C35EEA9FDD75');
$this->addSql('DROP INDEX IDX_A6E2C35EEA9FDD75 ON comptoir');
$this->addSql('ALTER TABLE comptoir CHANGE media_id fichier_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE comptoir ADD CONSTRAINT FK_A6E2C35EF915CFE FOREIGN KEY (fichier_id) REFERENCES fichier (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_A6E2C35EF915CFE ON comptoir (fichier_id)');
$this->addSql('ALTER TABLE faq DROP FOREIGN KEY FK_E8FF75CCEA9FDD75');
$this->addSql('DROP INDEX UNIQ_E8FF75CC989D9B62 ON faq');
$this->addSql('DROP INDEX IDX_E8FF75CCEA9FDD75 ON faq');
$this->addSql('ALTER TABLE faq DROP text, DROP name, DROP slug, DROP content, CHANGE media_id fichier_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE faq ADD CONSTRAINT FK_E8FF75CCF915CFE FOREIGN KEY (fichier_id) REFERENCES fichier (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E8FF75CCF915CFE ON faq (fichier_id)');
$this->addSql('ALTER TABLE news DROP FOREIGN KEY FK_1DD39950EA9FDD75');
$this->addSql('DROP INDEX IDX_1DD39950EA9FDD75 ON news');
$this->addSql('ALTER TABLE news CHANGE media_id fichier_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD39950F915CFE FOREIGN KEY (fichier_id) REFERENCES fichier (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1DD39950F915CFE ON news (fichier_id)');
$this->addSql('ALTER TABLE prestataire DROP FOREIGN KEY FK_60A26480EA9FDD75');
$this->addSql('DROP INDEX IDX_60A26480EA9FDD75 ON prestataire');
$this->addSql('ALTER TABLE prestataire CHANGE media_id image_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE prestataire ADD CONSTRAINT FK_60A264803DA5256D FOREIGN KEY (image_id) REFERENCES fichier (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_60A264803DA5256D ON prestataire (image_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 Version20190109172932 extends AbstractMigration
{
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('ALTER TABLE groupe ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL');
}
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 groupe DROP created_at, DROP updated_at');
}
}
<?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 Version20190109183052 extends AbstractMigration
{
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('ALTER TABLE comptoir DROP user_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 comptoir ADD user_id INT NOT NULL');
}
}
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