diff --git a/Makefile b/Makefile index e4a5257f7..591f8a854 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ PHP_EXEC := ${DOCKER_EXECPHP} php -d memory_limit=-1 SYMFONY_EXEC := ${DOCKER_EXECPHP} symfony console COMPOSER_EXEC := ${DOCKER_EXECPHP} symfony composer -COMMANDS_SUPPORTED_COMMANDS := libraries workflow-png tests messenger linter install git env encore composer bdd setbdd +COMMANDS_SUPPORTED_COMMANDS := libraries workflow-png tests messenger linter install git env encore composer bdd setbdd geocode COMMANDS_SUPPORTS_MAKE_ARGS := $(findstring $(firstword $(MAKECMDGOALS)), $(COMMANDS_SUPPORTED_COMMANDS)) ifneq "$(COMMANDS_SUPPORTS_MAKE_ARGS)" "" COMMANDS_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) @@ -146,7 +146,7 @@ endif .PHONY: geocode geocode: isdocker ### Geocode - $(SYMFONY_EXEC) $(COMMANDS_ARGS) + $(SYMFONY_EXEC) labstag:geocode:install $(COMMANDS_ARGS) .PHONY: install install: apps/.env ### installation diff --git a/apps/composer.json b/apps/composer.json index a5ac47ea9..f6d41b10f 100644 --- a/apps/composer.json +++ b/apps/composer.json @@ -8,7 +8,7 @@ "ext-ctype": "*", "ext-iconv": "*", "adam-paterson/oauth2-slack": "1.1.3", - "api-platform/core": "2.6.5", + "api-platform/core": "2.6.6", "beberlei/assert": "3.3.1", "beberlei/doctrineextensions": "1.3.0", "bluemmb/faker-picsum-photos-provider": "2.0", @@ -19,7 +19,7 @@ "doctrine/orm": "2.9.5", "fakerphp/faker": "v1.16.0", "friendsofsymfony/ckeditor-bundle": "2.3.0", - "giggsey/libphonenumber-for-php": "8.12.32", + "giggsey/libphonenumber-for-php": "8.12.33", "helios-ag/fm-elfinder-bundle": "10.1", "imagine/imagine": "1.2.4", "knplabs/knp-menu-bundle": "3.1.0", @@ -37,8 +37,6 @@ "omines/oauth2-gitlab": "3.4.0", "phpdocumentor/reflection-docblock": "5.2.2", "psr/http-message": "1.0.1", - "ramsey/uuid": "4.2.1", - "ramsey/uuid-doctrine": "1.7.0", "rtheunissen/oauth2-reddit": "2.0.2", "sensio/framework-extra-bundle": "v6.2.0", "stevenmaguire/oauth2-bitbucket": "3.0.0", @@ -47,40 +45,41 @@ "stof/doctrine-extensions-bundle": "1.6.0", "symfony/apache-pack": "1.0.1", "symfony/asset": "5.3.4", - "symfony/cache": "5.3.7", + "symfony/cache": "5.3.8", "symfony/console": "5.3.7", - "symfony/dotenv": "5.3.7", + "symfony/dotenv": "5.3.8", "symfony/event-dispatcher": "5.3.7", "symfony/expression-language": "5.3.7", "symfony/finder": "5.3.7", - "symfony/flex": "1.15.4", - "symfony/form": "5.3.7", - "symfony/framework-bundle": "5.3.7", - "symfony/http-client": "5.3.7", - "symfony/intl": "5.3.7", - "symfony/ldap": "5.3.7", + "symfony/flex": "1.16.3", + "symfony/form": "5.3.8", + "symfony/framework-bundle": "5.3.8", + "symfony/http-client": "5.3.8", + "symfony/intl": "5.3.8", + "symfony/ldap": "5.3.8", "symfony/lock": "5.3.4", - "symfony/mailer": "5.3.4", + "symfony/mailer": "5.3.9", "symfony/mercure": "0.5.3", - "symfony/messenger": "5.3.7", - "symfony/mime": "5.3.7", + "symfony/messenger": "5.3.9", + "symfony/mime": "5.3.8", "symfony/monolog-bundle": "3.7.0", - "symfony/notifier": "5.3.4", + "symfony/notifier": "5.3.9", "symfony/process": "5.3.7", - "symfony/property-access": "5.3.7", - "symfony/property-info": "5.3.7", + "symfony/property-access": "5.3.8", + "symfony/property-info": "5.3.8", + "symfony/proxy-manager-bridge": "5.3.*", "symfony/rate-limiter": "5.3.4", "symfony/runtime": "5.3.4", - "symfony/security-bundle": "5.3.7", - "symfony/security-core": "5.3.7", + "symfony/security-bundle": "5.3.8", + "symfony/security-core": "5.3.8", "symfony/security-csrf": "5.3.4", "symfony/security-guard": "5.3.7", - "symfony/security-http": "5.3.7", - "symfony/serializer": "5.3.4", + "symfony/security-http": "5.3.8", + "symfony/serializer": "5.3.8", "symfony/string": "5.3.7", - "symfony/translation": "5.3.7", + "symfony/translation": "5.3.9", "symfony/twig-bundle": "5.3.4", - "symfony/validator": "5.3.7", + "symfony/validator": "5.3.8", "symfony/web-link": "5.3.4", "symfony/webpack-encore-bundle": "1.12.0", "symfony/workflow": "5.3.4", @@ -100,11 +99,11 @@ "symfony/browser-kit": "5.3.4", "symfony/css-selector": "5.3.4", "symfony/debug-bundle": "5.3.4", - "symfony/maker-bundle": "1.33.0", - "symfony/phpunit-bridge": "5.3.7", + "symfony/maker-bundle": "1.34.0", + "symfony/phpunit-bridge": "5.3.8", "symfony/stopwatch": "5.3.4", - "symfony/var-dumper": "5.3.7", - "symfony/web-profiler-bundle": "5.3.5" + "symfony/var-dumper": "5.3.8", + "symfony/web-profiler-bundle": "5.3.8" }, "config": { "optimize-autoloader": true, diff --git a/apps/composer.lock b/apps/composer.lock index 41bb8037d..13b2a4088 100644 --- a/apps/composer.lock +++ b/apps/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1c65b5af288cbd97c0e017cda0651f16", + "content-hash": "7d8547203efc5f5a3e04745bef5cfb3c", "packages": [ { "name": "adam-paterson/oauth2-slack", @@ -66,16 +66,16 @@ }, { "name": "api-platform/core", - "version": "v2.6.5", + "version": "v2.6.6", "source": { "type": "git", "url": "https://github.com/api-platform/core.git", - "reference": "4e22a289e474db454480020ff37d20472668c11c" + "reference": "25c71b216473844cdbe5bf284ccbeeb26acd76e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/api-platform/core/zipball/4e22a289e474db454480020ff37d20472668c11c", - "reference": "4e22a289e474db454480020ff37d20472668c11c", + "url": "https://api.github.com/repos/api-platform/core/zipball/25c71b216473844cdbe5bf284ccbeeb26acd76e7", + "reference": "25c71b216473844cdbe5bf284ccbeeb26acd76e7", "shasum": "" }, "require": { @@ -94,6 +94,7 @@ }, "conflict": { "doctrine/common": "<2.7", + "doctrine/dbal": "<2.10", "doctrine/mongodb-odm": "<2.2", "doctrine/persistence": "<1.3" }, @@ -213,7 +214,7 @@ ], "support": { "issues": "https://github.com/api-platform/core/issues", - "source": "https://github.com/api-platform/core/tree/v2.6.5" + "source": "https://github.com/api-platform/core/tree/v2.6.6" }, "funding": [ { @@ -221,7 +222,7 @@ "type": "tidelift" } ], - "time": "2021-06-15T16:53:33+00:00" + "time": "2021-09-29T19:11:04+00:00" }, { "name": "beberlei/assert", @@ -446,66 +447,6 @@ }, "time": "2021-02-02T13:59:04+00:00" }, - { - "name": "brick/math", - "version": "0.9.3", - "source": { - "type": "git", - "url": "https://github.com/brick/math.git", - "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/ca57d18f028f84f777b2168cd1911b0dee2343ae", - "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.0", - "vimeo/psalm": "4.9.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Brick\\Math\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Arbitrary-precision arithmetic library", - "keywords": [ - "Arbitrary-precision", - "BigInteger", - "BigRational", - "arithmetic", - "bigdecimal", - "bignum", - "brick", - "math" - ], - "support": { - "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.9.3" - }, - "funding": [ - { - "url": "https://github.com/BenMorel", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/brick/math", - "type": "tidelift" - } - ], - "time": "2021-08-15T20:50:18+00:00" - }, { "name": "composer/package-versions-deprecated", "version": "1.11.99.3", @@ -2397,16 +2338,16 @@ }, { "name": "giggsey/libphonenumber-for-php", - "version": "8.12.32", + "version": "8.12.33", "source": { "type": "git", "url": "https://github.com/giggsey/libphonenumber-for-php.git", - "reference": "b13fcfd3ebfef44486fc0bd1f830737047205ae3" + "reference": "554116cea0dec3cdf0ca1deb045df59b3a6385b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/b13fcfd3ebfef44486fc0bd1f830737047205ae3", - "reference": "b13fcfd3ebfef44486fc0bd1f830737047205ae3", + "url": "https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/554116cea0dec3cdf0ca1deb045df59b3a6385b0", + "reference": "554116cea0dec3cdf0ca1deb045df59b3a6385b0", "shasum": "" }, "require": { @@ -2466,7 +2407,7 @@ "issues": "https://github.com/giggsey/libphonenumber-for-php/issues", "source": "https://github.com/giggsey/libphonenumber-for-php" }, - "time": "2021-09-10T14:29:11+00:00" + "time": "2021-09-22T12:21:13+00:00" }, { "name": "giggsey/locale", @@ -4704,249 +4645,6 @@ }, "time": "2019-03-08T08:55:37+00:00" }, - { - "name": "ramsey/collection", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/ramsey/collection.git", - "reference": "eaca1dc1054ddd10cbd83c1461907bee6fb528fa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/eaca1dc1054ddd10cbd83c1461907bee6fb528fa", - "reference": "eaca1dc1054ddd10cbd83c1461907bee6fb528fa", - "shasum": "" - }, - "require": { - "php": "^7.3 || ^8", - "symfony/polyfill-php81": "^1.23" - }, - "require-dev": { - "captainhook/captainhook": "^5.3", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "ergebnis/composer-normalize": "^2.6", - "fakerphp/faker": "^1.5", - "hamcrest/hamcrest-php": "^2", - "jangregor/phpstan-prophecy": "^0.8", - "mockery/mockery": "^1.3", - "phpspec/prophecy-phpunit": "^2.0", - "phpstan/extension-installer": "^1", - "phpstan/phpstan": "^0.12.32", - "phpstan/phpstan-mockery": "^0.12.5", - "phpstan/phpstan-phpunit": "^0.12.11", - "phpunit/phpunit": "^8.5 || ^9", - "psy/psysh": "^0.10.4", - "slevomat/coding-standard": "^6.3", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Ramsey\\Collection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - } - ], - "description": "A PHP library for representing and manipulating collections.", - "keywords": [ - "array", - "collection", - "hash", - "map", - "queue", - "set" - ], - "support": { - "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/1.2.1" - }, - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", - "type": "tidelift" - } - ], - "time": "2021-08-06T03:41:06+00:00" - }, - { - "name": "ramsey/uuid", - "version": "4.2.1", - "source": { - "type": "git", - "url": "https://github.com/ramsey/uuid.git", - "reference": "fe665a03df4f056aa65af552a96e1976df8c8dae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/fe665a03df4f056aa65af552a96e1976df8c8dae", - "reference": "fe665a03df4f056aa65af552a96e1976df8c8dae", - "shasum": "" - }, - "require": { - "brick/math": "^0.8 || ^0.9", - "ext-json": "*", - "php": "^7.2 || ^8", - "ramsey/collection": "^1.0", - "symfony/polyfill-ctype": "^1.8" - }, - "replace": { - "rhumsaa/uuid": "self.version" - }, - "require-dev": { - "captainhook/captainhook": "^5.10", - "captainhook/plugin-composer": "^5.3", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "doctrine/annotations": "^1.8", - "ergebnis/composer-normalize": "^2.15", - "mockery/mockery": "^1.3", - "moontoast/math": "^1.1", - "paragonie/random-lib": "^2", - "php-mock/php-mock": "^2.2", - "php-mock/php-mock-mockery": "^1.3", - "php-parallel-lint/php-parallel-lint": "^1.1", - "phpbench/phpbench": "^1.0", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-mockery": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^8.5 || ^9", - "slevomat/coding-standard": "^7.0", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.9" - }, - "suggest": { - "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", - "ext-ctype": "Enables faster processing of character classification using ctype functions.", - "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", - "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", - "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", - "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "4.x-dev" - }, - "captainhook": { - "force-install": true - } - }, - "autoload": { - "psr-4": { - "Ramsey\\Uuid\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A PHP library for generating and working with universally unique identifiers (UUIDs).", - "keywords": [ - "guid", - "identifier", - "uuid" - ], - "support": { - "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.2.1" - }, - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid", - "type": "tidelift" - } - ], - "time": "2021-08-11T01:06:55+00:00" - }, - { - "name": "ramsey/uuid-doctrine", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/ramsey/uuid-doctrine.git", - "reference": "b250b9d425d5e806cd56a3ab8c60a575a611d786" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid-doctrine/zipball/b250b9d425d5e806cd56a3ab8c60a575a611d786", - "reference": "b250b9d425d5e806cd56a3ab8c60a575a611d786", - "shasum": "" - }, - "require": { - "doctrine/dbal": "^2.5", - "php": "^5.4 || ^7 || ^8", - "ramsey/uuid": "^3.5 || ^4" - }, - "require-dev": { - "doctrine/orm": "^2.5", - "mockery/mockery": "^0.9.11 || ^1", - "php-parallel-lint/php-parallel-lint": "^1", - "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7 || ^8 || ^9", - "squizlabs/php_codesniffer": "^3.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Ramsey\\Uuid\\Doctrine\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - } - ], - "description": "Use ramsey/uuid as a Doctrine field type.", - "keywords": [ - "database", - "doctrine", - "guid", - "identifier", - "uuid" - ], - "support": { - "issues": "https://github.com/ramsey/uuid-doctrine/issues", - "source": "https://github.com/ramsey/uuid-doctrine/tree/1.7.0" - }, - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid", - "type": "tidelift" - } - ], - "time": "2021-08-07T16:48:33+00:00" - }, { "name": "rtheunissen/oauth2-reddit", "version": "v2.0.2", @@ -5554,16 +5252,16 @@ }, { "name": "symfony/cache", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "864867b13bd67347497ce956f4b253f8fe18b80c" + "reference": "945bcebfef0aeef105de61843dd14105633ae38f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/864867b13bd67347497ce956f4b253f8fe18b80c", - "reference": "864867b13bd67347497ce956f4b253f8fe18b80c", + "url": "https://api.github.com/repos/symfony/cache/zipball/945bcebfef0aeef105de61843dd14105633ae38f", + "reference": "945bcebfef0aeef105de61843dd14105633ae38f", "shasum": "" }, "require": { @@ -5631,7 +5329,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v5.3.7" + "source": "https://github.com/symfony/cache/tree/v5.3.8" }, "funding": [ { @@ -5647,7 +5345,7 @@ "type": "tidelift" } ], - "time": "2021-08-29T15:08:21+00:00" + "time": "2021-09-26T18:29:18+00:00" }, { "name": "symfony/cache-contracts", @@ -5974,16 +5672,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v5.3.4", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "5a825e4b386066167a8b55487091cb62beec74c2" + "reference": "e39c344e06a3ceab531ebeb6c077e6652c4a0829" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/5a825e4b386066167a8b55487091cb62beec74c2", - "reference": "5a825e4b386066167a8b55487091cb62beec74c2", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e39c344e06a3ceab531ebeb6c077e6652c4a0829", + "reference": "e39c344e06a3ceab531ebeb6c077e6652c4a0829", "shasum": "" }, "require": { @@ -6042,7 +5740,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v5.3.4" + "source": "https://github.com/symfony/dependency-injection/tree/v5.3.8" }, "funding": [ { @@ -6058,7 +5756,7 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:55:36+00:00" + "time": "2021-09-21T20:52:44+00:00" }, { "name": "symfony/deprecation-contracts", @@ -6242,16 +5940,16 @@ }, { "name": "symfony/doctrine-messenger", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/doctrine-messenger.git", - "reference": "3d7d247feeaec4be4bbd22a1d06ae9343701336b" + "reference": "e11b87557afae8631f83c5afaa1de84232a8043e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/doctrine-messenger/zipball/3d7d247feeaec4be4bbd22a1d06ae9343701336b", - "reference": "3d7d247feeaec4be4bbd22a1d06ae9343701336b", + "url": "https://api.github.com/repos/symfony/doctrine-messenger/zipball/e11b87557afae8631f83c5afaa1de84232a8043e", + "reference": "e11b87557afae8631f83c5afaa1de84232a8043e", "shasum": "" }, "require": { @@ -6295,7 +5993,7 @@ "description": "Symfony Doctrine Messenger Bridge", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/doctrine-messenger/tree/v5.3.7" + "source": "https://github.com/symfony/doctrine-messenger/tree/v5.3.8" }, "funding": [ { @@ -6311,20 +6009,20 @@ "type": "tidelift" } ], - "time": "2021-08-26T13:49:04+00:00" + "time": "2021-09-01T13:32:48+00:00" }, { "name": "symfony/dotenv", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "99a18c2e23f4d901c36cea2012f9f1a8e25e99e4" + "reference": "12888c9c46ac750ec5c1381db5bf3d534e7d70cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/99a18c2e23f4d901c36cea2012f9f1a8e25e99e4", - "reference": "99a18c2e23f4d901c36cea2012f9f1a8e25e99e4", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/12888c9c46ac750ec5c1381db5bf3d534e7d70cb", + "reference": "12888c9c46ac750ec5c1381db5bf3d534e7d70cb", "shasum": "" }, "require": { @@ -6365,7 +6063,7 @@ "environment" ], "support": { - "source": "https://github.com/symfony/dotenv/tree/v5.3.7" + "source": "https://github.com/symfony/dotenv/tree/v5.3.8" }, "funding": [ { @@ -6381,7 +6079,7 @@ "type": "tidelift" } ], - "time": "2021-07-02T16:35:09+00:00" + "time": "2021-07-29T06:18:06+00:00" }, { "name": "symfony/error-handler", @@ -6805,16 +6503,16 @@ }, { "name": "symfony/flex", - "version": "v1.15.4", + "version": "v1.16.3", "source": { "type": "git", "url": "https://github.com/symfony/flex.git", - "reference": "9a22ef2a75609a4d3717db784d923a7a6b347bc5" + "reference": "f05406b33681409b83285f4d2ff4efbca7c55b03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/flex/zipball/9a22ef2a75609a4d3717db784d923a7a6b347bc5", - "reference": "9a22ef2a75609a4d3717db784d923a7a6b347bc5", + "url": "https://api.github.com/repos/symfony/flex/zipball/f05406b33681409b83285f4d2ff4efbca7c55b03", + "reference": "f05406b33681409b83285f4d2ff4efbca7c55b03", "shasum": "" }, "require": { @@ -6825,13 +6523,13 @@ "composer/composer": "^1.0.2|^2.0", "symfony/dotenv": "^4.4|^5.0", "symfony/filesystem": "^4.4|^5.0", - "symfony/phpunit-bridge": "^4.4|^5.0", + "symfony/phpunit-bridge": "^4.4.12|^5.0", "symfony/process": "^3.4|^4.4|^5.0" }, "type": "composer-plugin", "extra": { "branch-alias": { - "dev-main": "1.13-dev" + "dev-main": "1.16-dev" }, "class": "Symfony\\Flex\\Flex" }, @@ -6853,7 +6551,7 @@ "description": "Composer plugin for Symfony", "support": { "issues": "https://github.com/symfony/flex/issues", - "source": "https://github.com/symfony/flex/tree/v1.15.4" + "source": "https://github.com/symfony/flex/tree/v1.16.3" }, "funding": [ { @@ -6869,20 +6567,20 @@ "type": "tidelift" } ], - "time": "2021-09-13T14:49:33+00:00" + "time": "2021-09-28T17:00:52+00:00" }, { "name": "symfony/form", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/form.git", - "reference": "325f8c34c3bc58192274e64f042cfc2daad792b0" + "reference": "417bb0355ed1027817c14f39aff353e9fb4bd9a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/form/zipball/325f8c34c3bc58192274e64f042cfc2daad792b0", - "reference": "325f8c34c3bc58192274e64f042cfc2daad792b0", + "url": "https://api.github.com/repos/symfony/form/zipball/417bb0355ed1027817c14f39aff353e9fb4bd9a8", + "reference": "417bb0355ed1027817c14f39aff353e9fb4bd9a8", "shasum": "" }, "require": { @@ -6955,7 +6653,7 @@ "description": "Allows to easily create, process and reuse HTML forms", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/form/tree/v5.3.7" + "source": "https://github.com/symfony/form/tree/v5.3.8" }, "funding": [ { @@ -6971,20 +6669,20 @@ "type": "tidelift" } ], - "time": "2021-08-23T12:57:24+00:00" + "time": "2021-09-21T20:52:44+00:00" }, { "name": "symfony/framework-bundle", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "5d4fcef02a42ea86280afcbacedf8de7a039032c" + "reference": "ea6e30a8c9534d87187375ef4ee39d48ee40dd2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/5d4fcef02a42ea86280afcbacedf8de7a039032c", - "reference": "5d4fcef02a42ea86280afcbacedf8de7a039032c", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/ea6e30a8c9534d87187375ef4ee39d48ee40dd2d", + "reference": "ea6e30a8c9534d87187375ef4ee39d48ee40dd2d", "shasum": "" }, "require": { @@ -7106,7 +6804,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v5.3.7" + "source": "https://github.com/symfony/framework-bundle/tree/v5.3.8" }, "funding": [ { @@ -7122,20 +6820,20 @@ "type": "tidelift" } ], - "time": "2021-08-26T08:37:07+00:00" + "time": "2021-09-28T07:17:01+00:00" }, { "name": "symfony/http-client", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "da8638ffecefc4e8ba2bc848d7b61a408119b333" + "reference": "c6370fe2c0a445aedc08f592a6a3149da1fea4c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/da8638ffecefc4e8ba2bc848d7b61a408119b333", - "reference": "da8638ffecefc4e8ba2bc848d7b61a408119b333", + "url": "https://api.github.com/repos/symfony/http-client/zipball/c6370fe2c0a445aedc08f592a6a3149da1fea4c7", + "reference": "c6370fe2c0a445aedc08f592a6a3149da1fea4c7", "shasum": "" }, "require": { @@ -7193,7 +6891,7 @@ "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-client/tree/v5.3.7" + "source": "https://github.com/symfony/http-client/tree/v5.3.8" }, "funding": [ { @@ -7209,7 +6907,7 @@ "type": "tidelift" } ], - "time": "2021-08-28T16:24:37+00:00" + "time": "2021-09-07T10:45:28+00:00" }, { "name": "symfony/http-client-contracts", @@ -7364,16 +7062,16 @@ }, { "name": "symfony/http-kernel", - "version": "v5.3.7", + "version": "v5.3.9", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "a3a78e37935a527b50376c22ac1cec35b57fe787" + "reference": "ceaf46a992f60e90645e7279825a830f733a17c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a3a78e37935a527b50376c22ac1cec35b57fe787", - "reference": "a3a78e37935a527b50376c22ac1cec35b57fe787", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ceaf46a992f60e90645e7279825a830f733a17c5", + "reference": "ceaf46a992f60e90645e7279825a830f733a17c5", "shasum": "" }, "require": { @@ -7456,7 +7154,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.3.7" + "source": "https://github.com/symfony/http-kernel/tree/v5.3.9" }, "funding": [ { @@ -7472,20 +7170,20 @@ "type": "tidelift" } ], - "time": "2021-08-30T12:37:19+00:00" + "time": "2021-09-28T10:25:11+00:00" }, { "name": "symfony/intl", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/intl.git", - "reference": "1af1675221f35dec23b13193873139338c784290" + "reference": "dc9e9cdefb52ff436ee27af6d9631e455d201a3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/intl/zipball/1af1675221f35dec23b13193873139338c784290", - "reference": "1af1675221f35dec23b13193873139338c784290", + "url": "https://api.github.com/repos/symfony/intl/zipball/dc9e9cdefb52ff436ee27af6d9631e455d201a3d", + "reference": "dc9e9cdefb52ff436ee27af6d9631e455d201a3d", "shasum": "" }, "require": { @@ -7544,7 +7242,7 @@ "localization" ], "support": { - "source": "https://github.com/symfony/intl/tree/v5.3.7" + "source": "https://github.com/symfony/intl/tree/v5.3.8" }, "funding": [ { @@ -7560,20 +7258,20 @@ "type": "tidelift" } ], - "time": "2021-08-09T09:00:11+00:00" + "time": "2021-09-14T15:57:41+00:00" }, { "name": "symfony/ldap", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/ldap.git", - "reference": "37d2038d890b8565982941b288eaa2584bd6c5f8" + "reference": "df17b047559afd0cc5870ec044187536a2f2498d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/ldap/zipball/37d2038d890b8565982941b288eaa2584bd6c5f8", - "reference": "37d2038d890b8565982941b288eaa2584bd6c5f8", + "url": "https://api.github.com/repos/symfony/ldap/zipball/df17b047559afd0cc5870ec044187536a2f2498d", + "reference": "df17b047559afd0cc5870ec044187536a2f2498d", "shasum": "" }, "require": { @@ -7619,7 +7317,7 @@ "ldap" ], "support": { - "source": "https://github.com/symfony/ldap/tree/v5.3.7" + "source": "https://github.com/symfony/ldap/tree/v5.3.8" }, "funding": [ { @@ -7635,7 +7333,7 @@ "type": "tidelift" } ], - "time": "2021-08-13T15:54:02+00:00" + "time": "2021-09-26T18:29:18+00:00" }, { "name": "symfony/lock", @@ -7719,7 +7417,7 @@ }, { "name": "symfony/mailer", - "version": "v5.3.4", + "version": "v5.3.9", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", @@ -7774,7 +7472,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v5.3.4" + "source": "https://github.com/symfony/mailer/tree/v5.3.9" }, "funding": [ { @@ -7876,16 +7574,16 @@ }, { "name": "symfony/messenger", - "version": "v5.3.7", + "version": "v5.3.9", "source": { "type": "git", "url": "https://github.com/symfony/messenger.git", - "reference": "8000632a98da6a54c58d6675342d56083655d5b4" + "reference": "1cc72a00521c69219ba79b7b04757d5e7fface66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/messenger/zipball/8000632a98da6a54c58d6675342d56083655d5b4", - "reference": "8000632a98da6a54c58d6675342d56083655d5b4", + "url": "https://api.github.com/repos/symfony/messenger/zipball/1cc72a00521c69219ba79b7b04757d5e7fface66", + "reference": "1cc72a00521c69219ba79b7b04757d5e7fface66", "shasum": "" }, "require": { @@ -7946,7 +7644,7 @@ "description": "Helps applications send and receive messages to/from other applications or via message queues", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/messenger/tree/v5.3.7" + "source": "https://github.com/symfony/messenger/tree/v5.3.9" }, "funding": [ { @@ -7966,16 +7664,16 @@ }, { "name": "symfony/mime", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "ae887cb3b044658676129f5e97aeb7e9eb69c2d8" + "reference": "a756033d0a7e53db389618653ae991eba5a19a11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/ae887cb3b044658676129f5e97aeb7e9eb69c2d8", - "reference": "ae887cb3b044658676129f5e97aeb7e9eb69c2d8", + "url": "https://api.github.com/repos/symfony/mime/zipball/a756033d0a7e53db389618653ae991eba5a19a11", + "reference": "a756033d0a7e53db389618653ae991eba5a19a11", "shasum": "" }, "require": { @@ -8029,7 +7727,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v5.3.7" + "source": "https://github.com/symfony/mime/tree/v5.3.8" }, "funding": [ { @@ -8045,7 +7743,7 @@ "type": "tidelift" } ], - "time": "2021-08-20T11:40:01+00:00" + "time": "2021-09-10T12:30:38+00:00" }, { "name": "symfony/monolog-bridge", @@ -8214,7 +7912,7 @@ }, { "name": "symfony/notifier", - "version": "v5.3.4", + "version": "v5.3.9", "source": { "type": "git", "url": "https://github.com/symfony/notifier.git", @@ -8288,7 +7986,7 @@ "notifier" ], "support": { - "source": "https://github.com/symfony/notifier/tree/v5.3.4" + "source": "https://github.com/symfony/notifier/tree/v5.3.9" }, "funding": [ { @@ -8377,16 +8075,16 @@ }, { "name": "symfony/password-hasher", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/password-hasher.git", - "reference": "106639b209d0f8b0946394a1108acc9cc20e2216" + "reference": "4bdaa0cca1fb3521bc1825160f3b5490c130bbda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/password-hasher/zipball/106639b209d0f8b0946394a1108acc9cc20e2216", - "reference": "106639b209d0f8b0946394a1108acc9cc20e2216", + "url": "https://api.github.com/repos/symfony/password-hasher/zipball/4bdaa0cca1fb3521bc1825160f3b5490c130bbda", + "reference": "4bdaa0cca1fb3521bc1825160f3b5490c130bbda", "shasum": "" }, "require": { @@ -8430,7 +8128,7 @@ "password" ], "support": { - "source": "https://github.com/symfony/password-hasher/tree/v5.3.7" + "source": "https://github.com/symfony/password-hasher/tree/v5.3.8" }, "funding": [ { @@ -8446,7 +8144,7 @@ "type": "tidelift" } ], - "time": "2021-08-17T15:45:42+00:00" + "time": "2021-09-03T12:22:16+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -9172,16 +8870,16 @@ }, { "name": "symfony/property-access", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "a4bbf09b8f3e2d2c89cc2c8b3d6682bf4c3d5589" + "reference": "2fbab5f95ddb6b8e85f38a6a8a04a17c0acc4d66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/a4bbf09b8f3e2d2c89cc2c8b3d6682bf4c3d5589", - "reference": "a4bbf09b8f3e2d2c89cc2c8b3d6682bf4c3d5589", + "url": "https://api.github.com/repos/symfony/property-access/zipball/2fbab5f95ddb6b8e85f38a6a8a04a17c0acc4d66", + "reference": "2fbab5f95ddb6b8e85f38a6a8a04a17c0acc4d66", "shasum": "" }, "require": { @@ -9233,7 +8931,7 @@ "reflection" ], "support": { - "source": "https://github.com/symfony/property-access/tree/v5.3.7" + "source": "https://github.com/symfony/property-access/tree/v5.3.8" }, "funding": [ { @@ -9249,20 +8947,20 @@ "type": "tidelift" } ], - "time": "2021-08-09T12:23:10+00:00" + "time": "2021-09-10T11:55:24+00:00" }, { "name": "symfony/property-info", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "7202b6c93a07df5df83eb58e3757dffb77fc5d90" + "reference": "39de5bed8c036f76ec0457ec52908e45d5497947" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/7202b6c93a07df5df83eb58e3757dffb77fc5d90", - "reference": "7202b6c93a07df5df83eb58e3757dffb77fc5d90", + "url": "https://api.github.com/repos/symfony/property-info/zipball/39de5bed8c036f76ec0457ec52908e45d5497947", + "reference": "39de5bed8c036f76ec0457ec52908e45d5497947", "shasum": "" }, "require": { @@ -9323,7 +9021,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v5.3.7" + "source": "https://github.com/symfony/property-info/tree/v5.3.8" }, "funding": [ { @@ -9339,7 +9037,75 @@ "type": "tidelift" } ], - "time": "2021-08-23T12:57:24+00:00" + "time": "2021-09-07T07:41:40+00:00" + }, + { + "name": "symfony/proxy-manager-bridge", + "version": "v5.3.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/proxy-manager-bridge.git", + "reference": "76e61f33f6a34a340bf6e02211214f466e8e1dba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/76e61f33f6a34a340bf6e02211214f466e8e1dba", + "reference": "76e61f33f6a34a340bf6e02211214f466e8e1dba", + "shasum": "" + }, + "require": { + "composer/package-versions-deprecated": "^1.8", + "friendsofphp/proxy-manager-lts": "^1.0.2", + "php": ">=7.2.5", + "symfony/dependency-injection": "^5.0", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "symfony/config": "^4.4|^5.0" + }, + "type": "symfony-bridge", + "autoload": { + "psr-4": { + "Symfony\\Bridge\\ProxyManager\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides integration for ProxyManager with various Symfony components", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/proxy-manager-bridge/tree/v5.3.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-07-21T12:38:00+00:00" }, { "name": "symfony/rate-limiter", @@ -9413,16 +9179,16 @@ }, { "name": "symfony/redis-messenger", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/redis-messenger.git", - "reference": "ec74daf942ef7ba64f054b462964b931e01e6d3f" + "reference": "4d775c1728fc3124a58376dc746e643d8ae80849" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/redis-messenger/zipball/ec74daf942ef7ba64f054b462964b931e01e6d3f", - "reference": "ec74daf942ef7ba64f054b462964b931e01e6d3f", + "url": "https://api.github.com/repos/symfony/redis-messenger/zipball/4d775c1728fc3124a58376dc746e643d8ae80849", + "reference": "4d775c1728fc3124a58376dc746e643d8ae80849", "shasum": "" }, "require": { @@ -9460,7 +9226,7 @@ "description": "Symfony Redis extension Messenger Bridge", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/redis-messenger/tree/v5.3.7" + "source": "https://github.com/symfony/redis-messenger/tree/v5.3.8" }, "funding": [ { @@ -9476,7 +9242,7 @@ "type": "tidelift" } ], - "time": "2021-08-02T21:14:49+00:00" + "time": "2021-09-25T08:57:14+00:00" }, { "name": "symfony/routing", @@ -9647,16 +9413,16 @@ }, { "name": "symfony/security-bundle", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "aed98f8ca60f1fb474a4db3ade066155d2b040f7" + "reference": "b755ed5d11685ba9aaa27b060250e5a57371f37f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/aed98f8ca60f1fb474a4db3ade066155d2b040f7", - "reference": "aed98f8ca60f1fb474a4db3ade066155d2b040f7", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/b755ed5d11685ba9aaa27b060250e5a57371f37f", + "reference": "b755ed5d11685ba9aaa27b060250e5a57371f37f", "shasum": "" }, "require": { @@ -9729,7 +9495,7 @@ "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-bundle/tree/v5.3.7" + "source": "https://github.com/symfony/security-bundle/tree/v5.3.8" }, "funding": [ { @@ -9745,20 +9511,20 @@ "type": "tidelift" } ], - "time": "2021-08-17T15:45:42+00:00" + "time": "2021-09-26T16:32:59+00:00" }, { "name": "symfony/security-core", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "bd3a055d1092a46f6b6599bcda5a7624cd804cb1" + "reference": "62e5943d042aa5fc43d44b40209aa7304f68c56e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/bd3a055d1092a46f6b6599bcda5a7624cd804cb1", - "reference": "bd3a055d1092a46f6b6599bcda5a7624cd804cb1", + "url": "https://api.github.com/repos/symfony/security-core/zipball/62e5943d042aa5fc43d44b40209aa7304f68c56e", + "reference": "62e5943d042aa5fc43d44b40209aa7304f68c56e", "shasum": "" }, "require": { @@ -9822,7 +9588,7 @@ "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-core/tree/v5.3.7" + "source": "https://github.com/symfony/security-core/tree/v5.3.8" }, "funding": [ { @@ -9838,7 +9604,7 @@ "type": "tidelift" } ], - "time": "2021-08-14T21:25:00+00:00" + "time": "2021-09-21T20:52:44+00:00" }, { "name": "symfony/security-csrf", @@ -9981,16 +9747,16 @@ }, { "name": "symfony/security-http", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/security-http.git", - "reference": "cb3d53b245c38f73e67b1e461ea076ffbb2e6dd7" + "reference": "d499ecde6f81de42e557514626d6d5c14c0bdb78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-http/zipball/cb3d53b245c38f73e67b1e461ea076ffbb2e6dd7", - "reference": "cb3d53b245c38f73e67b1e461ea076ffbb2e6dd7", + "url": "https://api.github.com/repos/symfony/security-http/zipball/d499ecde6f81de42e557514626d6d5c14c0bdb78", + "reference": "d499ecde6f81de42e557514626d6d5c14c0bdb78", "shasum": "" }, "require": { @@ -10046,7 +9812,7 @@ "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-http/tree/v5.3.7" + "source": "https://github.com/symfony/security-http/tree/v5.3.8" }, "funding": [ { @@ -10062,20 +9828,20 @@ "type": "tidelift" } ], - "time": "2021-08-18T14:06:55+00:00" + "time": "2021-09-26T16:35:00+00:00" }, { "name": "symfony/serializer", - "version": "v5.3.4", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "f04e368e3cb35948550c7e95cc8918cb7e761c0c" + "reference": "a877799b1e94f792208bea68295f6675027c92be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/f04e368e3cb35948550c7e95cc8918cb7e761c0c", - "reference": "f04e368e3cb35948550c7e95cc8918cb7e761c0c", + "url": "https://api.github.com/repos/symfony/serializer/zipball/a877799b1e94f792208bea68295f6675027c92be", + "reference": "a877799b1e94f792208bea68295f6675027c92be", "shasum": "" }, "require": { @@ -10148,7 +9914,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v5.3.4" + "source": "https://github.com/symfony/serializer/tree/v5.3.8" }, "funding": [ { @@ -10164,7 +9930,7 @@ "type": "tidelift" } ], - "time": "2021-07-21T13:18:10+00:00" + "time": "2021-09-17T08:55:39+00:00" }, { "name": "symfony/service-contracts", @@ -10392,16 +10158,16 @@ }, { "name": "symfony/translation", - "version": "v5.3.7", + "version": "v5.3.9", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "4d595a6d15fd3a2c67f6f31d14d15d3b7356d7a6" + "reference": "6e69f3551c1a3356cf6ea8d019bf039a0f8b6886" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/4d595a6d15fd3a2c67f6f31d14d15d3b7356d7a6", - "reference": "4d595a6d15fd3a2c67f6f31d14d15d3b7356d7a6", + "url": "https://api.github.com/repos/symfony/translation/zipball/6e69f3551c1a3356cf6ea8d019bf039a0f8b6886", + "reference": "6e69f3551c1a3356cf6ea8d019bf039a0f8b6886", "shasum": "" }, "require": { @@ -10467,7 +10233,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.3.7" + "source": "https://github.com/symfony/translation/tree/v5.3.9" }, "funding": [ { @@ -10774,16 +10540,16 @@ }, { "name": "symfony/validator", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "916a7c6cf3ede36eb0e4097500e0a12dcff520a7" + "reference": "3a773f6f03ef2846c280e4f5b5f34cf950ead127" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/916a7c6cf3ede36eb0e4097500e0a12dcff520a7", - "reference": "916a7c6cf3ede36eb0e4097500e0a12dcff520a7", + "url": "https://api.github.com/repos/symfony/validator/zipball/3a773f6f03ef2846c280e4f5b5f34cf950ead127", + "reference": "3a773f6f03ef2846c280e4f5b5f34cf950ead127", "shasum": "" }, "require": { @@ -10864,7 +10630,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v5.3.7" + "source": "https://github.com/symfony/validator/tree/v5.3.8" }, "funding": [ { @@ -10880,20 +10646,20 @@ "type": "tidelift" } ], - "time": "2021-08-26T08:22:53+00:00" + "time": "2021-09-21T20:52:44+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "3ad5af4aed07d0a0201bbcfc42658fe6c5b2fb8f" + "reference": "eaaea4098be1c90c8285543e1356a09c8aa5c8da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3ad5af4aed07d0a0201bbcfc42658fe6c5b2fb8f", - "reference": "3ad5af4aed07d0a0201bbcfc42658fe6c5b2fb8f", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/eaaea4098be1c90c8285543e1356a09c8aa5c8da", + "reference": "eaaea4098be1c90c8285543e1356a09c8aa5c8da", "shasum": "" }, "require": { @@ -10952,7 +10718,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.3.7" + "source": "https://github.com/symfony/var-dumper/tree/v5.3.8" }, "funding": [ { @@ -10968,20 +10734,20 @@ "type": "tidelift" } ], - "time": "2021-08-04T23:19:25+00:00" + "time": "2021-09-24T15:59:58+00:00" }, { "name": "symfony/var-exporter", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "2ded877ab0574d8b646f4eb3f716f8ed7ee7f392" + "reference": "a7604de14bcf472fe8e33f758e9e5b7bf07d3b91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/2ded877ab0574d8b646f4eb3f716f8ed7ee7f392", - "reference": "2ded877ab0574d8b646f4eb3f716f8ed7ee7f392", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/a7604de14bcf472fe8e33f758e9e5b7bf07d3b91", + "reference": "a7604de14bcf472fe8e33f758e9e5b7bf07d3b91", "shasum": "" }, "require": { @@ -11025,7 +10791,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v5.3.7" + "source": "https://github.com/symfony/var-exporter/tree/v5.3.8" }, "funding": [ { @@ -11041,7 +10807,7 @@ "type": "tidelift" } ], - "time": "2021-08-04T22:42:42+00:00" + "time": "2021-08-31T12:49:16+00:00" }, { "name": "symfony/web-link", @@ -12272,16 +12038,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.12.0", + "version": "v4.13.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6608f01670c3cc5079e18c1dab1104e002579143" + "reference": "50953a2691a922aa1769461637869a0a2faa3f53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143", - "reference": "6608f01670c3cc5079e18c1dab1104e002579143", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53", + "reference": "50953a2691a922aa1769461637869a0a2faa3f53", "shasum": "" }, "require": { @@ -12322,9 +12088,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0" }, - "time": "2021-07-21T10:44:31+00:00" + "time": "2021-09-20T12:20:58+00:00" }, { "name": "php-parallel-lint/php-console-highlighter", @@ -12719,21 +12485,21 @@ }, { "name": "symfony/maker-bundle", - "version": "v1.33.0", + "version": "v1.34.0", "source": { "type": "git", "url": "https://github.com/symfony/maker-bundle.git", - "reference": "f093d906c667cba7e3f74487d9e5e55aaf25a031" + "reference": "c1ead8581cddeb4b2b9dcc8a3f00910093c4e5e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/f093d906c667cba7e3f74487d9e5e55aaf25a031", - "reference": "f093d906c667cba7e3f74487d9e5e55aaf25a031", + "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/c1ead8581cddeb4b2b9dcc8a3f00910093c4e5e8", + "reference": "c1ead8581cddeb4b2b9dcc8a3f00910093c4e5e8", "shasum": "" }, "require": { "doctrine/inflector": "^1.2|^2.0", - "nikic/php-parser": "^4.0", + "nikic/php-parser": "^4.11", "php": ">=7.1.3", "symfony/config": "^4.0|^5.0", "symfony/console": "^4.0|^5.0", @@ -12787,7 +12553,7 @@ ], "support": { "issues": "https://github.com/symfony/maker-bundle/issues", - "source": "https://github.com/symfony/maker-bundle/tree/v1.33.0" + "source": "https://github.com/symfony/maker-bundle/tree/v1.34.0" }, "funding": [ { @@ -12803,20 +12569,20 @@ "type": "tidelift" } ], - "time": "2021-07-01T00:28:30+00:00" + "time": "2021-09-27T14:29:38+00:00" }, { "name": "symfony/phpunit-bridge", - "version": "v5.3.7", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "2a1ff6e5a4521be1350bfce75784938e590d6342" + "reference": "e9c0548d8d7abcd257f18f0adc0517895996a9c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/2a1ff6e5a4521be1350bfce75784938e590d6342", - "reference": "2a1ff6e5a4521be1350bfce75784938e590d6342", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/e9c0548d8d7abcd257f18f0adc0517895996a9c1", + "reference": "e9c0548d8d7abcd257f18f0adc0517895996a9c1", "shasum": "" }, "require": { @@ -12870,7 +12636,7 @@ "description": "Provides utilities for PHPUnit, especially user deprecation notices management", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v5.3.7" + "source": "https://github.com/symfony/phpunit-bridge/tree/v5.3.8" }, "funding": [ { @@ -12886,20 +12652,20 @@ "type": "tidelift" } ], - "time": "2021-08-26T13:36:50+00:00" + "time": "2021-09-14T13:57:08+00:00" }, { "name": "symfony/web-profiler-bundle", - "version": "v5.3.5", + "version": "v5.3.8", "source": { "type": "git", "url": "https://github.com/symfony/web-profiler-bundle.git", - "reference": "95fb24b09551688a09cffac95a2ddbb907833f07" + "reference": "9ba1e05fdc7a46979047ba6c8949bd35e3a386a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/95fb24b09551688a09cffac95a2ddbb907833f07", - "reference": "95fb24b09551688a09cffac95a2ddbb907833f07", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/9ba1e05fdc7a46979047ba6c8949bd35e3a386a5", + "reference": "9ba1e05fdc7a46979047ba6c8949bd35e3a386a5", "shasum": "" }, "require": { @@ -12949,7 +12715,7 @@ "description": "Provides a development tool that gives detailed information about the execution of any request", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/web-profiler-bundle/tree/v5.3.5" + "source": "https://github.com/symfony/web-profiler-bundle/tree/v5.3.8" }, "funding": [ { @@ -12965,7 +12731,7 @@ "type": "tidelift" } ], - "time": "2021-07-27T04:28:53+00:00" + "time": "2021-09-17T08:55:39+00:00" } ], "aliases": [], diff --git a/apps/config/packages/messenger.yaml b/apps/config/packages/messenger.yaml index 88fef6231..54dfb2c03 100644 --- a/apps/config/packages/messenger.yaml +++ b/apps/config/packages/messenger.yaml @@ -1,22 +1,30 @@ framework: - messenger: - # Uncomment this (and the failed transport below) to send failed messages to this transport for later handling. - # failure_transport: failed + messenger: + buses: + command_bus: + middleware: + # each time a message is handled, the Doctrine connection + # is "pinged" and reconnected if it's closed. Useful + # if your workers run for a long time and the database + # connection is sometimes lost + - doctrine_ping_connection + # Uncomment this (and the failed transport below) to send failed messages to this transport for later handling. + # failure_transport: failed - transports: - # https://symfony.com/doc/current/messenger.html#transport-configuration - async: - dsn: "%env(MESSENGER_TRANSPORT_DSN)%" - retry_strategy: - max_retries: 0 - delay: 5000 - failed: doctrine://default - sync: "sync://" - # async: '%env(MESSENGER_TRANSPORT_DSN)%' - # failed: 'doctrine://default?queue_name=failed' - # sync: 'sync://' + transports: + # https://symfony.com/doc/current/messenger.html#transport-configuration + async: + dsn: "%env(MESSENGER_TRANSPORT_DSN)%" + retry_strategy: + max_retries: 0 + delay: 5000 + failed: doctrine://default + sync: "sync://" + # async: '%env(MESSENGER_TRANSPORT_DSN)%' + # failed: 'doctrine://default?queue_name=failed' + # sync: 'sync://' - routing: - # Route your messages to the transports - Labstag\Queue\Message\ServiceMethodMessage: async - # 'App\Message\YourMessage': async + routing: + # Route your messages to the transports + Labstag\Queue\Message\ServiceMethodMessage: async + # 'App\Message\YourMessage': async diff --git a/apps/config/packages/ramsey_uuid_doctrine.yaml b/apps/config/packages/ramsey_uuid_doctrine.yaml deleted file mode 100644 index 2c6013f7a..000000000 --- a/apps/config/packages/ramsey_uuid_doctrine.yaml +++ /dev/null @@ -1,4 +0,0 @@ -doctrine: - dbal: - types: - uuid: 'Ramsey\Uuid\Doctrine\UuidType' diff --git a/apps/migrations/2021/10/Version20211007141816.php b/apps/migrations/2021/10/Version20211007141816.php new file mode 100644 index 000000000..b943c3cc1 --- /dev/null +++ b/apps/migrations/2021/10/Version20211007141816.php @@ -0,0 +1,35 @@ +addSql('ALTER TABLE bookmark ADD icon LONGTEXT DEFAULT NULL, CHANGE content content LONGTEXT DEFAULT NULL, CHANGE meta_description meta_description LONGTEXT DEFAULT NULL, CHANGE meta_keywords meta_keywords LONGTEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE edito CHANGE meta_description meta_description VARCHAR(255) DEFAULT NULL, CHANGE meta_keywords meta_keywords VARCHAR(255) DEFAULT NULL'); + $this->addSql('ALTER TABLE post CHANGE meta_description meta_description VARCHAR(255) DEFAULT NULL, CHANGE meta_keywords meta_keywords VARCHAR(255) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE bookmark DROP icon, CHANGE content content LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE meta_description meta_description VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE meta_keywords meta_keywords VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE edito CHANGE meta_description meta_description VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE meta_keywords meta_keywords VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE post CHANGE meta_description meta_description VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE meta_keywords meta_keywords VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`'); + } +} diff --git a/apps/src/Controller/Admin/AttachmentController.php b/apps/src/Controller/Admin/AttachmentController.php index 6a132d99a..6c2065519 100644 --- a/apps/src/Controller/Admin/AttachmentController.php +++ b/apps/src/Controller/Admin/AttachmentController.php @@ -22,26 +22,23 @@ public function indexOrTrash(AttachmentRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], - 'admin/attachment/index.html.twig', - [ - 'empty' => 'api_action_empty', - 'trash' => 'admin_attachment_trash', - 'list' => 'admin_attachment_index', - ], - [ - 'list' => 'admin_attachment_index', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - 'workflow' => 'api_action_workflow', - ] + 'admin/attachment/index.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'empty' => 'api_action_empty', + 'list' => 'admin_attachment_index', + 'restore' => 'api_action_restore', + 'trash' => 'admin_attachment_trash', + 'workflow' => 'api_action_workflow', + ]; + } + protected function setBreadcrumbsPageAdminAttachment(): array { return [ diff --git a/apps/src/Controller/Admin/BookmarkController.php b/apps/src/Controller/Admin/BookmarkController.php index 161b366b3..ea92c4c66 100644 --- a/apps/src/Controller/Admin/BookmarkController.php +++ b/apps/src/Controller/Admin/BookmarkController.php @@ -2,17 +2,27 @@ namespace Labstag\Controller\Admin; +use DateTime; +use DOMDocument; use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\Bookmark; -use Labstag\Form\Admin\BookmarkType; +use Labstag\Entity\User; +use Labstag\Form\Admin\Bookmark\ImportType; +use Labstag\Form\Admin\Bookmark\PrincipalType; +use Labstag\Form\Admin\Search\BookmarkType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; +use Labstag\Queue\EnqueueMethod; use Labstag\Repository\BookmarkRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\BookmarkRequestHandler; +use Labstag\Search\BookmarkSearch; +use Labstag\Service\AttachFormService; +use Labstag\Service\BookmarkService; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Security\Core\Security; /** * @Route("/admin/bookmark") @@ -21,85 +31,60 @@ class BookmarkController extends AdminControllerLib { /** * @Route("/{id}/edit", name="admin_bookmark_edit", methods={"GET","POST"}) + * @Route("/new", name="admin_bookmark_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - Bookmark $bookmark, + AttachFormService $service, + ?Bookmark $bookmark, BookmarkRequestHandler $requestHandler ): Response { $this->modalAttachmentDelete(); - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, - BookmarkType::class, - $bookmark, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_bookmark_index', - 'show' => 'admin_bookmark_show', - ], + PrincipalType::class, + !is_null($bookmark) ? $bookmark : new Bookmark(), 'admin/bookmark/form.html.twig' ); } /** - * @Route("/trash", name="admin_bookmark_trash", methods={"GET"}) - * @Route("/", name="admin_bookmark_index", methods={"GET"}) - * @IgnoreSoftDelete + * @Route("/import", name="admin_bookmark_import", methods={"GET","POST"}) */ - public function indexOrTrash(BookmarkRepository $repository): Response + public function import( + Request $request, + Security $security, + EnqueueMethod $enqueue + ) { - return $this->listOrTrash( - $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], - 'admin/bookmark/index.html.twig', - [ - 'new' => 'admin_bookmark_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_bookmark_trash', - 'list' => 'admin_bookmark_index', - ], + $this->setBtnList($this->getUrlAdmin()); + $form = $this->createForm(ImportType::class, []); + $this->btnInstance()->addBtnSave($form->getName(), 'Import'); + $form->handleRequest($request); + if ($form->isSubmitted() && $form->isValid()) { + $this->uploadFile($form, $security, $enqueue); + } + + return $this->render( + 'admin/bookmark/import.html.twig', [ - 'list' => 'admin_bookmark_index', - 'show' => 'admin_bookmark_show', - 'preview' => 'admin_bookmark_preview', - 'edit' => 'admin_bookmark_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - 'workflow' => 'api_action_workflow', + 'form' => $form->createView(), ] ); } /** - * @Route("/new", name="admin_bookmark_new", methods={"GET","POST"}) + * @Route("/trash", name="admin_bookmark_trash", methods={"GET"}) + * @Route("/", name="admin_bookmark_index", methods={"GET"}) + * @IgnoreSoftDelete */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - BookmarkRequestHandler $requestHandler - ): Response + public function indexOrTrash(BookmarkRepository $repository): Response { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new Bookmark(), - BookmarkType::class, - ['list' => 'admin_bookmark_index'], - 'admin/bookmark/form.html.twig' + return $this->listOrTrash( + $repository, + 'admin/bookmark/index.html.twig' ); } @@ -114,18 +99,36 @@ public function showOrPreview( { return $this->renderShowOrPreview( $bookmark, - 'admin/bookmark/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'edit' => 'admin_bookmark_edit', - 'list' => 'admin_bookmark_index', - 'trash' => 'admin_bookmark_trash', - ] + 'admin/bookmark/show.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_bookmark_edit', + 'empty' => 'api_action_empty', + 'import' => 'admin_bookmark_import', + 'list' => 'admin_bookmark_index', + 'new' => 'admin_bookmark_new', + 'preview' => 'admin_bookmark_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_bookmark_show', + 'trash' => 'admin_bookmark_trash', + 'workflow' => 'api_action_workflow', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => BookmarkType::class, + 'data' => new BookmarkSearch(), + ]; + } + protected function setBreadcrumbsPageAdminBookmark(): array { return [ @@ -152,6 +155,17 @@ protected function setBreadcrumbsPageAdminBookmarkEdit(): array ]; } + protected function setBreadcrumbsPageAdminBookmarkImport(): array + { + return [ + [ + 'title' => $this->translator->trans('bookmark.import', [], 'admin.breadcrumb'), + 'route' => 'admin_bookmark_import', + 'route_params' => [], + ], + ]; + } + protected function setBreadcrumbsPageAdminBookmarkNew(): array { return [ @@ -220,4 +234,37 @@ protected function setHeaderTitle(): array ] ); } + + private function uploadFile( + FormInterface $form, + Security $security, + EnqueueMethod $enqueue + ) + { + $file = $form->get('file')->getData(); + if (!$file instanceof UploadedFile) { + return; + } + + $doc = new DOMDocument(); + $doc->loadHTMLFile($file->getPathname(), LIBXML_NOWARNING | LIBXML_NOERROR); + $tags = $doc->getElementsByTagName('a'); + $date = new DateTime(); + /** @var User $user */ + $user = $security->getUser(); + $userId = $user->getId(); + foreach ($tags as $tag) { + $enqueue->enqueue( + BookmarkService::class, + 'process', + [ + 'userid' => $userId, + 'url' => $tag->getAttribute('href'), + 'name' => $tag->nodeValue, + 'icon' => $tag->getAttribute('icon'), + 'date' => $date->setTimestamp((int) $tag->getAttribute('add_date')), + ] + ); + } + } } diff --git a/apps/src/Controller/Admin/CategoryController.php b/apps/src/Controller/Admin/CategoryController.php index ce6fa3ab9..3523e0184 100644 --- a/apps/src/Controller/Admin/CategoryController.php +++ b/apps/src/Controller/Admin/CategoryController.php @@ -5,12 +5,12 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\Category; use Labstag\Form\Admin\CategoryType; +use Labstag\Form\Admin\Search\CategoryType as SearchCategoryType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\CategoryRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\CategoryRequestHandler; +use Labstag\Search\CategorySearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -21,29 +21,21 @@ class CategoryController extends AdminControllerLib { /** * @Route("/{id}/edit", name="admin_category_edit", methods={"GET","POST"}) + * @Route("/new", name="admin_category_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - Category $category, + AttachFormService $service, + ?Category $category, CategoryRequestHandler $requestHandler ): Response { $this->modalAttachmentDelete(); - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, CategoryType::class, - $category, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_category_index', - 'show' => 'admin_category_show', - ] + !is_null($category) ? $category : new Category() ); } @@ -56,48 +48,7 @@ public function indexOrTrash(CategoryRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashParentForAdmin', - 'all' => 'findAllParentForAdmin', - ], - 'admin/category/index.html.twig', - [ - 'new' => 'admin_category_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_category_trash', - 'list' => 'admin_category_index', - ], - [ - 'list' => 'admin_category_index', - 'show' => 'admin_category_show', - 'preview' => 'admin_category_preview', - 'edit' => 'admin_category_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - 'workflow' => 'api_action_workflow', - ] - ); - } - - /** - * @Route("/new", name="admin_category_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - CategoryRequestHandler $requestHandler - ): Response - { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new Category(), - CategoryType::class, - ['list' => 'admin_category_index'] + 'admin/category/index.html.twig' ); } @@ -112,18 +63,43 @@ public function showOrPreview( { return $this->renderShowOrPreview( $category, - 'admin/category/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'edit' => 'admin_category_edit', - 'list' => 'admin_category_index', - 'trash' => 'admin_category_trash', - ] + 'admin/category/show.html.twig' ); } + protected function getMethodsList(): array + { + return [ + 'trash' => 'findTrashParentForAdmin', + 'all' => 'findAllParentForAdmin', + ]; + } + + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_category_edit', + 'empty' => 'api_action_empty', + 'list' => 'admin_category_index', + 'new' => 'admin_category_new', + 'preview' => 'admin_category_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_category_show', + 'trash' => 'admin_category_trash', + 'workflow' => 'api_action_workflow', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => SearchCategoryType::class, + 'data' => new CategorySearch(), + ]; + } + protected function setBreadcrumbsPageAdminCategory(): array { return [ diff --git a/apps/src/Controller/Admin/EditoController.php b/apps/src/Controller/Admin/EditoController.php index 90e8311fa..d96507012 100644 --- a/apps/src/Controller/Admin/EditoController.php +++ b/apps/src/Controller/Admin/EditoController.php @@ -5,12 +5,12 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\Edito; use Labstag\Form\Admin\EditoType; +use Labstag\Form\Admin\Search\EditoType as SearchEditoType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\EditoRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\EditoRequestHandler; +use Labstag\Search\EditoSearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -21,29 +21,21 @@ class EditoController extends AdminControllerLib { /** * @Route("/{id}/edit", name="admin_edito_edit", methods={"GET","POST"}) + * @Route("/new", name="admin_edito_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - Edito $edito, + AttachFormService $service, + ?Edito $edito, EditoRequestHandler $requestHandler ): Response { $this->modalAttachmentDelete(); - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, EditoType::class, - $edito, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_edito_index', - 'show' => 'admin_edito_show', - ], + !is_null($edito) ? $edito : new Edito(), 'admin/edito/form.html.twig' ); } @@ -57,49 +49,7 @@ public function indexOrTrash(EditoRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], 'admin/edito/index.html.twig', - [ - 'new' => 'admin_edito_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_edito_trash', - 'list' => 'admin_edito_index', - ], - [ - 'list' => 'admin_edito_index', - 'show' => 'admin_edito_show', - 'preview' => 'admin_edito_preview', - 'edit' => 'admin_edito_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - 'workflow' => 'api_action_workflow', - ] - ); - } - - /** - * @Route("/new", name="admin_edito_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - EditoRequestHandler $requestHandler - ): Response - { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new Edito(), - EditoType::class, - ['list' => 'admin_edito_index'], - 'admin/edito/form.html.twig' ); } @@ -114,18 +64,35 @@ public function showOrPreview( { return $this->renderShowOrPreview( $edito, - 'admin/edito/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'edit' => 'admin_edito_edit', - 'list' => 'admin_edito_index', - 'trash' => 'admin_edito_trash', - ] + 'admin/edito/show.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_edito_edit', + 'empty' => 'api_action_empty', + 'list' => 'admin_edito_index', + 'new' => 'admin_edito_new', + 'preview' => 'admin_edito_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_edito_show', + 'trash' => 'admin_edito_trash', + 'workflow' => 'api_action_workflow', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => SearchEditoType::class, + 'data' => new EditoSearch(), + ]; + } + protected function setBreadcrumbsPageAdminEdito(): array { return [ diff --git a/apps/src/Controller/Admin/GeoCodeController.php b/apps/src/Controller/Admin/GeoCodeController.php index b09b5bd19..bcea308a3 100644 --- a/apps/src/Controller/Admin/GeoCodeController.php +++ b/apps/src/Controller/Admin/GeoCodeController.php @@ -5,12 +5,12 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\GeoCode; use Labstag\Form\Admin\GeoCodeType; +use Labstag\Form\Admin\Search\GeocodeType as SearchGeocodeType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\GeoCodeRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\GeoCodeRequestHandler; +use Labstag\Search\GeocodeSearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -21,27 +21,19 @@ class GeoCodeController extends AdminControllerLib { /** * @Route("/{id}/edit", name="admin_geocode_edit", methods={"GET","POST"}) + * @Route("/new", name="admin_geocode_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - GeoCode $geoCode, + AttachFormService $service, + ?GeoCode $geoCode, GeoCodeRequestHandler $requestHandler ): Response { - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, GeoCodeType::class, - $geoCode, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_geocode_index', - 'show' => 'admin_geocode_show', - ] + !is_null($geoCode) ? $geoCode : new GeoCode() ); } @@ -54,45 +46,7 @@ public function index(GeoCodeRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], - 'admin/geocode/index.html.twig', - [ - 'new' => 'admin_geocode_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_geocode_trash', - 'list' => 'admin_geocode_index', - ], - [ - 'list' => 'admin_geocode_index', - 'show' => 'admin_geocode_show', - 'edit' => 'admin_geocode_edit', - 'delete' => 'api_action_delete', - 'trashdelete' => 'admin_geocode_destroy', - ] - ); - } - - /** - * @Route("/new", name="admin_geocode_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - GeoCodeRequestHandler $requestHandler - ): Response - { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new GeoCode(), - GeoCodeType::class, - ['list' => 'admin_geocode_index'] + 'admin/geocode/index.html.twig' ); } @@ -107,18 +61,34 @@ public function showOrPreview( { return $this->renderShowOrPreview( $geoCode, - 'admin/geocode/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'list' => 'admin_geocode_index', - 'edit' => 'admin_geocode_edit', - 'trash' => 'admin_geocode_trash', - ] + 'admin/geocode/show.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_geocode_edit', + 'empty' => 'api_action_empty', + 'list' => 'admin_geocode_index', + 'new' => 'admin_geocode_new', + 'restore' => 'api_action_restore', + 'show' => 'admin_geocode_show', + 'trash' => 'admin_geocode_trash', + 'trashdelete' => 'admin_geocode_destroy', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => SearchGeocodeType::class, + 'data' => new GeocodeSearch(), + ]; + } + protected function setBreadcrumbsPageAdminGeocode(): array { return [ diff --git a/apps/src/Controller/Admin/LibelleController.php b/apps/src/Controller/Admin/LibelleController.php index 180361701..cdb750116 100644 --- a/apps/src/Controller/Admin/LibelleController.php +++ b/apps/src/Controller/Admin/LibelleController.php @@ -5,12 +5,12 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\Libelle; use Labstag\Form\Admin\LibelleType; +use Labstag\Form\Admin\Search\LibelleType as SearchLibelleType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\LibelleRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\LibelleRequestHandler; +use Labstag\Search\LibelleSearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -21,29 +21,21 @@ class LibelleController extends AdminControllerLib { /** * @Route("/{id}/edit", name="admin_libelle_edit", methods={"GET","POST"}) + * @Route("/new", name="admin_libelle_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - Libelle $libelle, + AttachFormService $service, + ?Libelle $libelle, LibelleRequestHandler $requestHandler ): Response { $this->modalAttachmentDelete(); - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, LibelleType::class, - $libelle, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_libelle_index', - 'show' => 'admin_libelle_show', - ] + !is_null($libelle) ? $libelle : new Libelle() ); } @@ -56,48 +48,7 @@ public function indexOrTrash(LibelleRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], - 'admin/libelle/index.html.twig', - [ - 'new' => 'admin_libelle_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_libelle_trash', - 'list' => 'admin_libelle_index', - ], - [ - 'list' => 'admin_libelle_index', - 'show' => 'admin_libelle_show', - 'preview' => 'admin_libelle_preview', - 'edit' => 'admin_libelle_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - 'workflow' => 'api_action_workflow', - ] - ); - } - - /** - * @Route("/new", name="admin_libelle_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - LibelleRequestHandler $requestHandler - ): Response - { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new Libelle(), - LibelleType::class, - ['list' => 'admin_libelle_index'] + 'admin/libelle/index.html.twig' ); } @@ -112,18 +63,35 @@ public function showOrPreview( { return $this->renderShowOrPreview( $libelle, - 'admin/libelle/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'edit' => 'admin_libelle_edit', - 'list' => 'admin_libelle_index', - 'trash' => 'admin_libelle_trash', - ] + 'admin/libelle/show.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_libelle_edit', + 'empty' => 'api_action_empty', + 'list' => 'admin_libelle_index', + 'new' => 'admin_libelle_new', + 'preview' => 'admin_libelle_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_libelle_show', + 'trash' => 'admin_libelle_trash', + 'workflow' => 'api_action_workflow', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => SearchLibelleType::class, + 'data' => new LibelleSearch(), + ]; + } + protected function setBreadcrumbsPageAdminlibelle(): array { return [ diff --git a/apps/src/Controller/Admin/MenuController.php b/apps/src/Controller/Admin/MenuController.php index 52b1e5fb2..4a93f3806 100644 --- a/apps/src/Controller/Admin/MenuController.php +++ b/apps/src/Controller/Admin/MenuController.php @@ -7,11 +7,9 @@ use Labstag\Form\Admin\Menu\LinkType; use Labstag\Form\Admin\Menu\PrincipalType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\MenuRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\MenuRequestHandler; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -26,9 +24,7 @@ class MenuController extends AdminControllerLib * @Route("/add", name="admin_menu_add", methods={"GET", "POST"}) */ public function add( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, + AttachFormService $service, Request $request, MenuRequestHandler $requestHandler, MenuRepository $repository @@ -53,14 +49,11 @@ public function add( $menu->setPosition(count($parent->getChildren())); $menu->setParent($parent); - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, - $menu, LinkType::class, - ['list' => 'admin_menu_index'], + $menu, 'admin/menu/form.html.twig' ); } @@ -87,9 +80,7 @@ public function divider(Menu $menu, MenuRequestHandler $requestHandler): Redirec * @Route("/update/{id}", name="admin_menu_update", methods={"GET", "POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, + AttachFormService $service, Menu $menu, MenuRequestHandler $requestHandler ) @@ -99,17 +90,11 @@ public function edit( $data = [$menu->getData()]; $menu->setData($data); - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, $form, $menu, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_menu_index', - ], 'admin/menu/form.html.twig' ); } @@ -195,20 +180,15 @@ public function move( * @Route("/new", name="admin_menu_new", methods={"GET", "POST"}) */ public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, + AttachFormService $service, MenuRequestHandler $requestHandler ): Response { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, - new Menu(), PrincipalType::class, - ['list' => 'admin_menu_index'], + new Menu(), 'admin/menu/form.html.twig' ); } @@ -222,27 +202,24 @@ public function trash(MenuRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], 'admin/menu/trash.html.twig', - [ - 'new' => 'admin_menu_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_menu_trash', - 'list' => 'admin_menu_index', - ], - [ - 'list' => 'admin_menu_index', - 'edit' => 'admin_menu_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - ] ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_menu_edit', + 'empty' => 'api_action_empty', + 'list' => 'admin_menu_index', + 'new' => 'admin_menu_new', + 'restore' => 'api_action_restore', + 'trash' => 'admin_menu_trash', + ]; + } + protected function setBreadcrumbsPageAdminMenu(): array { return [ diff --git a/apps/src/Controller/Admin/NoteInterneController.php b/apps/src/Controller/Admin/NoteInterneController.php index b45a6fd3d..5ea9b577e 100644 --- a/apps/src/Controller/Admin/NoteInterneController.php +++ b/apps/src/Controller/Admin/NoteInterneController.php @@ -5,12 +5,12 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\NoteInterne; use Labstag\Form\Admin\NoteInterneType; +use Labstag\Form\Admin\Search\NoteInterneType as SearchNoteInterneType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\NoteInterneRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\NoteInterneRequestHandler; +use Labstag\Search\NoteInterneSearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -25,29 +25,22 @@ class NoteInterneController extends AdminControllerLib * name="admin_noteinterne_edit", * methods={"GET","POST"} * ) + * @Route("/new", name="admin_noteinterne_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - NoteInterne $noteInterne, + AttachFormService $service, + ?NoteInterne $noteInterne, NoteInterneRequestHandler $requestHandler ): Response { $this->modalAttachmentDelete(); - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, NoteInterneType::class, + !is_null($noteInterne) ? $noteInterne : new NoteInterne(), $noteInterne, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_noteinterne_index', - 'show' => 'admin_noteinterne_show', - ], 'admin/note_interne/form.html.twig' ); } @@ -61,49 +54,7 @@ public function indexOrTrash(NoteInterneRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], 'admin/note_interne/index.html.twig', - [ - 'new' => 'admin_noteinterne_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_noteinterne_trash', - 'list' => 'admin_noteinterne_index', - ], - [ - 'list' => 'admin_noteinterne_index', - 'show' => 'admin_noteinterne_show', - 'preview' => 'admin_noteinterne_preview', - 'edit' => 'admin_noteinterne_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - 'workflow' => 'api_action_workflow', - ] - ); - } - - /** - * @Route("/new", name="admin_noteinterne_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - NoteInterneRequestHandler $requestHandler - ): Response - { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new NoteInterne(), - NoteInterneType::class, - ['list' => 'admin_noteinterne_index'], - 'admin/note_interne/form.html.twig' ); } @@ -118,18 +69,35 @@ public function showOrPreview( { return $this->renderShowOrPreview( $noteInterne, - 'admin/note_interne/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'list' => 'admin_noteinterne_index', - 'edit' => 'admin_noteinterne_edit', - 'trash' => 'admin_noteinterne_trash', - ] + 'admin/note_interne/show.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_noteinterne_edit', + 'empty' => 'api_action_empty', + 'list' => 'admin_noteinterne_index', + 'new' => 'admin_noteinterne_new', + 'preview' => 'admin_noteinterne_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_noteinterne_show', + 'trash' => 'admin_noteinterne_trash', + 'workflow' => 'api_action_workflow', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => SearchNoteInterneType::class, + 'data' => new NoteInterneSearch(), + ]; + } + protected function setBreadcrumbsPageAdminNoteinterne(): array { return [ diff --git a/apps/src/Controller/Admin/PostController.php b/apps/src/Controller/Admin/PostController.php index 892adafbe..62e5a8aea 100644 --- a/apps/src/Controller/Admin/PostController.php +++ b/apps/src/Controller/Admin/PostController.php @@ -5,12 +5,12 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\Post; use Labstag\Form\Admin\PostType; +use Labstag\Form\Admin\Search\PostType as SearchPostType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\PostRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\PostRequestHandler; +use Labstag\Search\PostSearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -21,29 +21,21 @@ class PostController extends AdminControllerLib { /** * @Route("/{id}/edit", name="admin_post_edit", methods={"GET","POST"}) + * @Route("/new", name="admin_post_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - Post $post, + AttachFormService $service, + ?Post $post, PostRequestHandler $requestHandler ): Response { $this->modalAttachmentDelete(); - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, PostType::class, - $post, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_post_index', - 'show' => 'admin_post_show', - ], + !is_null($post) ? $post : new Post(), 'admin/post/form.html.twig' ); } @@ -57,49 +49,7 @@ public function indexOrTrash(PostRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], 'admin/post/index.html.twig', - [ - 'new' => 'admin_post_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_post_trash', - 'list' => 'admin_post_index', - ], - [ - 'list' => 'admin_post_index', - 'show' => 'admin_post_show', - 'preview' => 'admin_post_preview', - 'edit' => 'admin_post_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - 'workflow' => 'api_action_workflow', - ] - ); - } - - /** - * @Route("/new", name="admin_post_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - PostRequestHandler $requestHandler - ): Response - { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new Post(), - PostType::class, - ['list' => 'admin_post_index'], - 'admin/post/form.html.twig' ); } @@ -114,18 +64,35 @@ public function showOrPreview( { return $this->renderShowOrPreview( $post, - 'admin/post/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'edit' => 'admin_post_edit', - 'list' => 'admin_post_index', - 'trash' => 'admin_post_trash', - ] + 'admin/post/show.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_post_edit', + 'empty' => 'api_action_empty', + 'list' => 'admin_post_index', + 'new' => 'admin_post_new', + 'preview' => 'admin_post_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_post_show', + 'trash' => 'admin_post_trash', + 'workflow' => 'api_action_workflow', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => SearchPostType::class, + 'data' => new PostSearch(), + ]; + } + protected function setBreadcrumbsPageAdminPost(): array { return [ diff --git a/apps/src/Controller/Admin/TemplateController.php b/apps/src/Controller/Admin/TemplateController.php index 52fe801e0..f51855eb1 100644 --- a/apps/src/Controller/Admin/TemplateController.php +++ b/apps/src/Controller/Admin/TemplateController.php @@ -4,13 +4,13 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\Template; +use Labstag\Form\Admin\Search\TemplateType as SearchTemplateType; use Labstag\Form\Admin\TemplateType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\TemplateRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\TemplateRequestHandler; +use Labstag\Search\TemplateSearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -21,27 +21,19 @@ class TemplateController extends AdminControllerLib { /** * @Route("/{id}/edit", name="admin_template_edit", methods={"GET","POST"}) + * @Route("/new", name="admin_template_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - Template $template, + AttachFormService $service, + ?Template $template, TemplateRequestHandler $requestHandler ): Response { - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, TemplateType::class, - $template, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_template_index', - 'show' => 'admin_template_show', - ] + !is_null($template) ? $template : new Template() ); } @@ -54,47 +46,7 @@ public function indexOrTrash(TemplateRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], - 'admin/template/index.html.twig', - [ - 'new' => 'admin_template_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_template_trash', - 'list' => 'admin_template_index', - ], - [ - 'list' => 'admin_template_index', - 'show' => 'admin_template_show', - 'preview' => 'admin_template_preview', - 'edit' => 'admin_template_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - ] - ); - } - - /** - * @Route("/new", name="admin_template_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - TemplateRequestHandler $requestHandler - ): Response - { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new Template(), - TemplateType::class, - ['list' => 'admin_template_index'] + 'admin/template/index.html.twig' ); } @@ -109,18 +61,34 @@ public function showOrPreview( { return $this->renderShowOrPreview( $template, - 'admin/template/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'list' => 'admin_template_index', - 'edit' => 'admin_template_edit', - 'trash' => 'admin_template_trash', - ] + 'admin/template/show.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_template_edit', + 'empty' => 'api_action_empty', + 'list' => 'admin_template_index', + 'new' => 'admin_template_new', + 'preview' => 'admin_template_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_template_show', + 'trash' => 'admin_template_trash', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => SearchTemplateType::class, + 'data' => new TemplateSearch(), + ]; + } + protected function setBreadcrumbsPageAdminTemplace(): array { return [ diff --git a/apps/src/Controller/Admin/User/AdresseUserController.php b/apps/src/Controller/Admin/User/AdresseUserController.php index bdf6a8d73..1f6ab714f 100644 --- a/apps/src/Controller/Admin/User/AdresseUserController.php +++ b/apps/src/Controller/Admin/User/AdresseUserController.php @@ -4,13 +4,13 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\AdresseUser; +use Labstag\Form\Admin\Search\User\AdresseUserType as UserAdresseUserType; use Labstag\Form\Admin\User\AdresseUserType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; use Labstag\Repository\AdresseUserRepository; -use Labstag\Repository\AttachmentRepository; use Labstag\RequestHandler\AdresseUserRequestHandler; -use Labstag\RequestHandler\AttachmentRequestHandler; +use Labstag\Search\User\AdresseUserSearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -25,27 +25,19 @@ class AdresseUserController extends AdminControllerLib * name="admin_adresseuser_edit", * methods={"GET","POST"} * ) + * @Route("/new", name="admin_adresseuser_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - AdresseUser $adresseUser, + AttachFormService $service, + ?AdresseUser $adresseUser, AdresseUserRequestHandler $requestHandler ): Response { - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, AdresseUserType::class, - $adresseUser, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_adresseuser_index', - 'show' => 'admin_adresseuser_show', - ] + !is_null($adresseUser) ? $adresseUser : new AdresseUser() ); } @@ -58,47 +50,7 @@ public function indexOrTrash(AdresseUserRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], - 'admin/user/adresse_user/index.html.twig', - [ - 'new' => 'admin_adresseuser_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_adresseuser_trash', - 'list' => 'admin_adresseuser_index', - ], - [ - 'list' => 'admin_adresseuser_index', - 'show' => 'admin_adresseuser_show', - 'preview' => 'admin_adresseuser_preview', - 'edit' => 'admin_adresseuser_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - ] - ); - } - - /** - * @Route("/new", name="admin_adresseuser_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - AdresseUserRequestHandler $requestHandler - ): Response - { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new AdresseUser(), - AdresseUserType::class, - ['list' => 'admin_adresseuser_index'] + 'admin/user/adresse_user/index.html.twig' ); } @@ -113,18 +65,34 @@ public function showOrPreview( { return $this->renderShowOrPreview( $adresseUser, - 'admin/user/adresse_user/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'edit' => 'admin_adresseuser_edit', - 'list' => 'admin_adresseuser_index', - 'trash' => 'admin_adresseuser_trash', - ] + 'admin/user/adresse_user/show.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_adresseuser_edit', + 'empty' => 'api_action_empty', + 'list' => 'admin_adresseuser_index', + 'new' => 'admin_adresseuser_new', + 'preview' => 'admin_adresseuser_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_adresseuser_show', + 'trash' => 'admin_adresseuser_trash', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => UserAdresseUserType::class, + 'data' => new AdresseUserSearch(), + ]; + } + protected function setBreadcrumbsPageAdminAdresseuser(): array { return [ diff --git a/apps/src/Controller/Admin/User/EmailUserController.php b/apps/src/Controller/Admin/User/EmailUserController.php index 8b176436b..6a640d845 100644 --- a/apps/src/Controller/Admin/User/EmailUserController.php +++ b/apps/src/Controller/Admin/User/EmailUserController.php @@ -4,13 +4,13 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\EmailUser; +use Labstag\Form\Admin\Search\User\EmailUserType as UserEmailUserType; use Labstag\Form\Admin\User\EmailUserType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\EmailUserRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\EmailUserRequestHandler; +use Labstag\Search\User\EmailUserSearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -25,27 +25,19 @@ class EmailUserController extends AdminControllerLib * name="admin_emailuser_edit", * methods={"GET","POST"} * ) + * @Route("/new", name="admin_emailuser_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - EmailUser $emailUser, + AttachFormService $service, + ?EmailUser $emailUser, EmailUserRequestHandler $requestHandler ): Response { - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, EmailUserType::class, - $emailUser, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_emailuser_index', - 'show' => 'admin_emailuser_show', - ] + !is_null($emailUser) ? $emailUser : new EmailUser() ); } @@ -58,48 +50,7 @@ public function indexOrTrash(EmailUserRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], - 'admin/user/email_user/index.html.twig', - [ - 'new' => 'admin_emailuser_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_emailuser_trash', - 'list' => 'admin_emailuser_index', - ], - [ - 'list' => 'admin_emailuser_index', - 'show' => 'admin_emailuser_show', - 'preview' => 'admin_emailuser_preview', - 'edit' => 'admin_emailuser_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - 'workflow' => 'api_action_workflow', - ] - ); - } - - /** - * @Route("/new", name="admin_emailuser_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - EmailUserRequestHandler $requestHandler - ): Response - { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new EmailUser(), - EmailUserType::class, - ['list' => 'admin_emailuser_index'] + 'admin/user/email_user/index.html.twig' ); } @@ -114,18 +65,35 @@ public function showOrPreview( { return $this->renderShowOrPreview( $emailUser, - 'admin/user/email_user/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'edit' => 'admin_emailuser_edit', - 'list' => 'admin_emailuser_index', - 'trash' => 'admin_emailuser_trash', - ] + 'admin/user/email_user/show.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_emailuser_edit', + 'empty' => 'api_action_empty', + 'list' => 'admin_emailuser_index', + 'new' => 'admin_emailuser_new', + 'preview' => 'admin_emailuser_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_emailuser_show', + 'trash' => 'admin_emailuser_trash', + 'workflow' => 'api_action_workflow', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => UserEmailUserType::class, + 'data' => new EmailUserSearch(), + ]; + } + protected function setBreadcrumbsPageAdminEmailuser(): array { return [ diff --git a/apps/src/Controller/Admin/User/GroupeController.php b/apps/src/Controller/Admin/User/GroupeController.php index fa5399c6b..9fdcba76e 100644 --- a/apps/src/Controller/Admin/User/GroupeController.php +++ b/apps/src/Controller/Admin/User/GroupeController.php @@ -4,14 +4,14 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\Groupe; +use Labstag\Form\Admin\Search\GroupeType as SearchGroupeType; use Labstag\Form\Admin\User\GroupeType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\GroupeRepository; use Labstag\Repository\WorkflowRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\GroupeRequestHandler; +use Labstag\Search\GroupeSearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -22,28 +22,19 @@ class GroupeController extends AdminControllerLib { /** * @Route("/{id}/edit", name="admin_groupuser_edit", methods={"GET","POST"}) + * @Route("/new", name="admin_groupuser_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - Groupe $groupe, + AttachFormService $service, + ?Groupe $groupe, GroupeRequestHandler $requestHandler ): Response { - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, GroupeType::class, - $groupe, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_groupuser_index', - 'guard' => 'admin_groupuser_guard', - 'show' => 'admin_groupuser_show', - ] + !is_null($groupe) ? $groupe : new Groupe() ); } @@ -104,47 +95,7 @@ public function index(GroupeRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], - 'admin/user/groupe/index.html.twig', - [ - 'new' => 'admin_groupuser_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_groupuser_trash', - 'list' => 'admin_groupuser_index', - ], - [ - 'list' => 'admin_groupuser_index', - 'show' => 'admin_groupuser_show', - 'edit' => 'admin_groupuser_edit', - 'preview' => 'admin_groupuser_preview', - 'delete' => 'api_action_delete', - 'guard' => 'admin_groupuser_guard', - 'destroy' => 'api_action_destroy', - ] - ); - } - - /** - * @Route("/new", name="admin_groupuser_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - GroupeRequestHandler $requestHandler - ): Response - { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new Groupe(), - GroupeType::class, - ['list' => 'admin_groupuser_index'] + 'admin/user/groupe/index.html.twig' ); } @@ -159,19 +110,35 @@ public function showOrPreview( { return $this->renderShowOrPreview( $groupe, - 'admin/user/groupe/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'edit' => 'admin_groupuser_edit', - 'guard' => 'admin_groupuser_guard', - 'list' => 'admin_groupuser_index', - 'trash' => 'admin_groupuser_trash', - ] + 'admin/user/groupe/show.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_groupuser_edit', + 'empty' => 'api_action_empty', + 'guard' => 'admin_groupuser_guard', + 'list' => 'admin_groupuser_index', + 'new' => 'admin_groupuser_new', + 'preview' => 'admin_groupuser_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_groupuser_show', + 'trash' => 'admin_groupuser_trash', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => SearchGroupeType::class, + 'data' => new GroupeSearch(), + ]; + } + protected function setBreadcrumbsPageAdminGroupuser(): array { return [ diff --git a/apps/src/Controller/Admin/User/LienUserController.php b/apps/src/Controller/Admin/User/LienUserController.php index 4503e6c37..7e3d5c322 100644 --- a/apps/src/Controller/Admin/User/LienUserController.php +++ b/apps/src/Controller/Admin/User/LienUserController.php @@ -4,13 +4,13 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\LienUser; +use Labstag\Form\Admin\Search\User\LienUserType as UserLienUserType; use Labstag\Form\Admin\User\LienUserType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\LienUserRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\LienUserRequestHandler; +use Labstag\Search\User\LienUserSearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -21,27 +21,19 @@ class LienUserController extends AdminControllerLib { /** * @Route("/{id}/edit", name="admin_lienuser_edit", methods={"GET","POST"}) + * @Route("/new", name="admin_lienuser_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - LienUser $lienUser, + AttachFormService $service, + ?LienUser $lienUser, LienUserRequestHandler $requestHandler ): Response { - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, LienUserType::class, - $lienUser, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_lienuser_index', - 'show' => 'admin_lienuser_show', - ] + !is_null($lienUser) ? $lienUser : new LienUser() ); } @@ -54,47 +46,7 @@ public function indexOrTrash(LienUserRepository $lienUserRepository): Response { return $this->listOrTrash( $lienUserRepository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], - 'admin/user/lien_user/index.html.twig', - [ - 'new' => 'admin_lienuser_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_lienuser_trash', - 'list' => 'admin_lienuser_index', - ], - [ - 'list' => 'admin_lienuser_index', - 'show' => 'admin_lienuser_show', - 'preview' => 'admin_lienuser_preview', - 'edit' => 'admin_lienuser_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - ] - ); - } - - /** - * @Route("/new", name="admin_lienuser_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - LienUserRequestHandler $requestHandler - ): Response - { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new LienUser(), - LienUserType::class, - ['list' => 'admin_lienuser_index'] + 'admin/user/lien_user/index.html.twig' ); } @@ -109,18 +61,34 @@ public function showOrPreview( { return $this->renderShowOrPreview( $lienUser, - 'admin/user/lien_user/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'list' => 'admin_lienuser_index', - 'edit' => 'admin_lienuser_edit', - 'trash' => 'admin_lienuser_trash', - ] + 'admin/user/lien_user/show.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_lienuser_edit', + 'empty' => 'api_action_empty', + 'list' => 'admin_lienuser_index', + 'new' => 'admin_lienuser_new', + 'preview' => 'admin_lienuser_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_lienuser_show', + 'trash' => 'admin_lienuser_trash', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => UserLienUserType::class, + 'data' => new LienUserSearch(), + ]; + } + protected function setBreadcrumbsPageAdminLienuser(): array { return [ diff --git a/apps/src/Controller/Admin/User/PhoneUserController.php b/apps/src/Controller/Admin/User/PhoneUserController.php index 9d8e91707..c268f63f9 100644 --- a/apps/src/Controller/Admin/User/PhoneUserController.php +++ b/apps/src/Controller/Admin/User/PhoneUserController.php @@ -4,13 +4,13 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\PhoneUser; +use Labstag\Form\Admin\Search\User\PhoneUserType as UserPhoneUserType; use Labstag\Form\Admin\User\PhoneUserType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\PhoneUserRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\PhoneUserRequestHandler; +use Labstag\Search\User\PhoneUserSearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -25,27 +25,19 @@ class PhoneUserController extends AdminControllerLib * name="admin_phoneuser_edit", * methods={"GET","POST"} * ) + * @Route("/new", name="admin_phoneuser_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - PhoneUser $phoneUser, + AttachFormService $service, + ?PhoneUser $phoneUser, PhoneUserRequestHandler $requestHandler ): Response { - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, PhoneUserType::class, - $phoneUser, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_phoneuser_index', - 'show' => 'admin_phoneuser_show', - ] + !is_null($phoneUser) ? $phoneUser : new PhoneUser() ); } @@ -58,48 +50,7 @@ public function indexOrTrash(PhoneUserRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], - 'admin/user/phone_user/index.html.twig', - [ - 'new' => 'admin_phoneuser_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_phoneuser_trash', - 'list' => 'admin_phoneuser_index', - ], - [ - 'list' => 'admin_phoneuser_index', - 'show' => 'admin_phoneuser_show', - 'preview' => 'admin_phoneuser_preview', - 'edit' => 'admin_phoneuser_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'restore' => 'api_action_restore', - 'workflow' => 'api_action_workflow', - ] - ); - } - - /** - * @Route("/new", name="admin_phoneuser_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - PhoneUserRequestHandler $requestHandler - ): Response - { - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - new PhoneUser(), - PhoneUserType::class, - ['list' => 'admin_phoneuser_index'] + 'admin/user/phone_user/index.html.twig' ); } @@ -114,18 +65,35 @@ public function showOrPreview( { return $this->renderShowOrPreview( $phoneUser, - 'admin/user/phone_user/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'list' => 'admin_phoneuser_index', - 'edit' => 'admin_phoneuser_edit', - 'trash' => 'admin_phoneuser_trash', - ] + 'admin/user/phone_user/show.html.twig' ); } + protected function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_phoneuser_edit', + 'empty' => 'api_action_empty', + 'list' => 'admin_phoneuser_index', + 'new' => 'admin_phoneuser_new', + 'preview' => 'admin_phoneuser_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_phoneuser_show', + 'trash' => 'admin_phoneuser_trash', + 'workflow' => 'api_action_workflow', + ]; + } + + protected function searchForm(): array + { + return [ + 'form' => UserPhoneUserType::class, + 'data' => new PhoneUserSearch(), + ]; + } + protected function setBreadcrumbsPageAdminPhoneuser(): array { return [ diff --git a/apps/src/Controller/Admin/User/UserController.php b/apps/src/Controller/Admin/User/UserController.php index 6edc12a68..e0b34581a 100644 --- a/apps/src/Controller/Admin/User/UserController.php +++ b/apps/src/Controller/Admin/User/UserController.php @@ -4,14 +4,14 @@ use Labstag\Annotation\IgnoreSoftDelete; use Labstag\Entity\User; +use Labstag\Form\Admin\Search\UserType as SearchUserType; use Labstag\Form\Admin\User\UserType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; -use Labstag\Repository\AttachmentRepository; use Labstag\Repository\UserRepository; use Labstag\Repository\WorkflowRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\UserRequestHandler; +use Labstag\Search\UserSearch; +use Labstag\Service\AttachFormService; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -22,32 +22,41 @@ class UserController extends AdminControllerLib { /** * @Route("/{id}/edit", name="admin_user_edit", methods={"GET","POST"}) + * @Route("/new", name="admin_user_new", methods={"GET","POST"}) */ public function edit( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - User $user, + AttachFormService $service, + ?User $user, UserRequestHandler $requestHandler ): Response { - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, UserType::class, - $user, - [ - 'delete' => 'api_action_delete', - 'list' => 'admin_user_index', - 'guard' => 'admin_user_guard', - 'show' => 'admin_user_show', - ], + !is_null($user) ? $user : new User(), 'admin/user/form.html.twig' ); } + public function getUrlAdmin(): array + { + return [ + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_user_edit', + 'empty' => 'api_action_empty', + 'guard' => 'admin_user_guard', + 'list' => 'admin_user_index', + 'new' => 'admin_user_new', + 'preview' => 'admin_user_preview', + 'restore' => 'api_action_restore', + 'show' => 'admin_user_show', + 'trash' => 'admin_user_trash', + 'workflow' => 'api_action_workflow', + ]; + } + /** * @Route("/{id}/guard", name="admin_user_guard") */ @@ -104,52 +113,7 @@ public function indexOrTrash(UserRepository $repository): Response { return $this->listOrTrash( $repository, - [ - 'trash' => 'findTrashForAdmin', - 'all' => 'findAllForAdmin', - ], - 'admin/user/index.html.twig', - [ - 'new' => 'admin_user_new', - 'empty' => 'api_action_empty', - 'trash' => 'admin_user_trash', - 'list' => 'admin_user_index', - ], - [ - 'list' => 'admin_user_index', - 'show' => 'admin_user_show', - 'preview' => 'admin_user_preview', - 'edit' => 'admin_user_edit', - 'delete' => 'api_action_delete', - 'destroy' => 'api_action_destroy', - 'guard' => 'admin_user_guard', - 'restore' => 'api_action_restore', - 'workflow' => 'api_action_workflow', - ] - ); - } - - /** - * @Route("/new", name="admin_user_new", methods={"GET","POST"}) - */ - public function new( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - UserRequestHandler $requestHandler - ): Response - { - $user = new User(); - - return $this->create( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, - $requestHandler, - $user, - UserType::class, - ['list' => 'admin_user_index'], - 'admin/user/form.html.twig' + 'admin/user/index.html.twig' ); } @@ -166,19 +130,18 @@ public function showOrPreview( return $this->renderShowOrPreview( $user, - 'admin/user/show.html.twig', - [ - 'delete' => 'api_action_delete', - 'restore' => 'api_action_restore', - 'destroy' => 'api_action_destroy', - 'list' => 'admin_user_index', - 'guard' => 'admin_user_guard', - 'edit' => 'admin_user_edit', - 'trash' => 'admin_user_trash', - ] + 'admin/user/show.html.twig' ); } + protected function searchForm(): array + { + return [ + 'form' => SearchUserType::class, + 'data' => new UserSearch(), + ]; + } + protected function setBreadcrumbsPageAdminUser(): array { return [ diff --git a/apps/src/Controller/AdminController.php b/apps/src/Controller/AdminController.php index 09300e6ac..583269246 100644 --- a/apps/src/Controller/AdminController.php +++ b/apps/src/Controller/AdminController.php @@ -11,11 +11,10 @@ use Labstag\Form\Admin\ParamType; use Labstag\Form\Admin\ProfilType; use Labstag\Lib\AdminControllerLib; -use Labstag\Reader\UploadAnnotationReader; use Labstag\Repository\AttachmentRepository; use Labstag\Repository\NoteInterneRepository; -use Labstag\RequestHandler\AttachmentRequestHandler; use Labstag\RequestHandler\UserRequestHandler; +use Labstag\Service\AttachFormService; use Labstag\Service\DataService; use Labstag\Service\OauthService; use Labstag\Service\TrashService; @@ -158,23 +157,18 @@ public function param( * @Route("/profil", name="admin_profil", methods={"GET","POST"}) */ public function profil( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, + AttachFormService $service, Security $security, UserRequestHandler $requestHandler ): Response { $this->modalAttachmentDelete(); - return $this->update( - $uploadAnnotReader, - $attachmentRepository, - $attachmentRH, + return $this->form( + $service, $requestHandler, ProfilType::class, $security->getUser(), - [], 'admin/profil.html.twig' ); } @@ -232,12 +226,10 @@ public function trash( 'btn-admin-header-emptyall', 'Tout vider', [ - 'is' => 'link-btnadminemptyall', - 'data-bs-toggle' => 'modal', - 'data-bs-target' => '#emptyall-modal', - 'data-token' => $token, - 'data-redirect' => $this->generateUrl('admin_trash'), - 'data-url' => $this->generateUrl('api_action_emptyall'), + 'is' => 'link-btnadminemptyall', + 'token' => $token, + 'redirect' => $this->generateUrl('admin_trash'), + 'url' => $this->generateUrl('api_action_emptyall'), ] ); } diff --git a/apps/src/Controller/Api/ActionsController.php b/apps/src/Controller/Api/ActionsController.php index da607152d..3495a37e6 100644 --- a/apps/src/Controller/Api/ActionsController.php +++ b/apps/src/Controller/Api/ActionsController.php @@ -339,7 +339,7 @@ private function deleteEntity($entity) private function deleteEntityByRepository($repository) { - $all = $repository->findTrashForAdmin(); + $all = $repository->findTrashForAdmin([]); $files = []; foreach ($all as $entity) { $this->entityManager->remove($entity); diff --git a/apps/src/Entity/Bookmark.php b/apps/src/Entity/Bookmark.php index de62ed88c..1b8c919c5 100644 --- a/apps/src/Entity/Bookmark.php +++ b/apps/src/Entity/Bookmark.php @@ -23,15 +23,20 @@ class Bookmark use SoftDeleteableEntity; /** - * @UploadableField(filename="img", path="post/img", slug="name") + * @UploadableField(filename="img", path="bookmark/img", slug="name") */ protected $file; /** - * @ORM\Column(type="text") + * @ORM\Column(type="text", nullable=true) */ private $content; + /** + * @ORM\Column(type="text", nullable=true) + */ + private $icon; + /** * @ORM\Id * @ORM\GeneratedValue(strategy="UUID") @@ -50,12 +55,12 @@ class Bookmark private $libelles; /** - * @ORM\Column(type="string", length=255) + * @ORM\Column(type="text", nullable=true) */ private $metaDescription; /** - * @ORM\Column(type="string", length=255) + * @ORM\Column(type="text", nullable=true) */ private $metaKeywords; @@ -129,6 +134,11 @@ public function getFile() return $this->file; } + public function getIcon(): ?string + { + return $this->icon; + } + public function getId(): ?string { return $this->id; @@ -204,7 +214,7 @@ public function removeLibelle(Libelle $libelle): self return $this; } - public function setContent(string $content): self + public function setContent(?string $content): self { $this->content = $content; @@ -218,6 +228,13 @@ public function setFile($file): self return $this; } + public function setIcon(?string $icon): self + { + $this->icon = $icon; + + return $this; + } + public function setImg(?Attachment $img): self { $this->img = $img; @@ -225,14 +242,14 @@ public function setImg(?Attachment $img): self return $this; } - public function setMetaDescription(string $metaDescription): self + public function setMetaDescription(?string $metaDescription): self { $this->metaDescription = $metaDescription; return $this; } - public function setMetaKeywords(string $metaKeywords): self + public function setMetaKeywords(?string $metaKeywords): self { $this->metaKeywords = $metaKeywords; diff --git a/apps/src/Entity/Edito.php b/apps/src/Entity/Edito.php index 6404a21bf..c7a93f84d 100644 --- a/apps/src/Entity/Edito.php +++ b/apps/src/Entity/Edito.php @@ -60,12 +60,12 @@ class Edito protected $title; /** - * @ORM\Column(type="string", length=255) + * @ORM\Column(type="string", length=255, nullable=true) */ private $metaDescription; /** - * @ORM\Column(type="string", length=255) + * @ORM\Column(type="string", length=255, nullable=true) */ private $metaKeywords; @@ -145,14 +145,14 @@ public function setFond(?Attachment $fond): self return $this; } - public function setMetaDescription(string $metaDescription): self + public function setMetaDescription(?string $metaDescription): self { $this->metaDescription = $metaDescription; return $this; } - public function setMetaKeywords(string $metaKeywords): self + public function setMetaKeywords(?string $metaKeywords): self { $this->metaKeywords = $metaKeywords; diff --git a/apps/src/Entity/Post.php b/apps/src/Entity/Post.php index 08fd791e7..c93eb56d1 100644 --- a/apps/src/Entity/Post.php +++ b/apps/src/Entity/Post.php @@ -67,12 +67,12 @@ class Post private $libelles; /** - * @ORM\Column(type="string", length=255) + * @ORM\Column(type="string", length=255, nullable=true) */ private $metaDescription; /** - * @ORM\Column(type="string", length=255) + * @ORM\Column(type="string", length=255, nullable=true) */ private $metaKeywords; @@ -247,14 +247,14 @@ public function setImg(?Attachment $img): self return $this; } - public function setMetaDescription(string $metaDescription): self + public function setMetaDescription(?string $metaDescription): self { $this->metaDescription = $metaDescription; return $this; } - public function setMetaKeywords(string $metaKeywords): self + public function setMetaKeywords(?string $metaKeywords): self { $this->metaKeywords = $metaKeywords; diff --git a/apps/src/EventSubscriber/KernelSubscriber.php b/apps/src/EventSubscriber/KernelSubscriber.php index fe35b4ef5..6e279b33b 100644 --- a/apps/src/EventSubscriber/KernelSubscriber.php +++ b/apps/src/EventSubscriber/KernelSubscriber.php @@ -50,6 +50,7 @@ class KernelSubscriber implements EventSubscriberInterface 'guard-changeroute', 'guard-refgrouproute', 'guard-refgroupworkflow', + 'confirm-close', 'confirm-delete', 'confirm-deleteattachment', 'confirm-destroy', diff --git a/apps/src/Form/Admin/AdresseType.php b/apps/src/Form/Admin/AdresseType.php index 1afc716f1..ae49a8484 100644 --- a/apps/src/Form/Admin/AdresseType.php +++ b/apps/src/Form/Admin/AdresseType.php @@ -25,6 +25,9 @@ public function buildForm( [ 'label' => $this->translator->trans('adresse.rue.label', [], 'admin.form'), 'help' => $this->translator->trans('adresse.rue.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('adresse.rue.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -34,8 +37,9 @@ public function buildForm( 'label' => $this->translator->trans('adresse.country.label', [], 'admin.form'), 'help' => $this->translator->trans('adresse.country.help', [], 'admin.form'), 'attr' => [ - 'is' => 'select-country', - 'choices' => 'true', + 'is' => 'select-country', + 'choices' => 'true', + 'placeholder' => $this->translator->trans('adresse.country.placeholder', [], 'admin.form'), ], ] ); @@ -45,7 +49,10 @@ public function buildForm( [ 'label' => $this->translator->trans('adresse.zipcode.label', [], 'admin.form'), 'help' => $this->translator->trans('adresse.zipcode.help', [], 'admin.form'), - 'attr' => ['is' => 'input-codepostal'], + 'attr' => [ + 'is' => 'input-codepostal', + 'placeholder' => $this->translator->trans('adresse.zipcode.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -54,7 +61,10 @@ public function buildForm( [ 'label' => $this->translator->trans('adresse.ville.label', [], 'admin.form'), 'help' => $this->translator->trans('adresse.ville.help', [], 'admin.form'), - 'attr' => ['is' => 'input-ville'], + 'attr' => [ + 'is' => 'input-ville', + 'placeholder' => $this->translator->trans('adresse.ville.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -63,7 +73,10 @@ public function buildForm( [ 'label' => $this->translator->trans('adresse.gps.label', [], 'admin.form'), 'help' => $this->translator->trans('adresse.gps.help', [], 'admin.form'), - 'attr' => ['is' => 'input-gps'], + 'attr' => [ + 'is' => 'input-gps', + 'placeholder' => $this->translator->trans('adresse.gps.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -72,6 +85,9 @@ public function buildForm( [ 'label' => $this->translator->trans('adresse.type.label', [], 'admin.form'), 'help' => $this->translator->trans('adresse.type.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('adresse.type.placeholder', [], 'admin.form'), + ], ] ); $builder->add( diff --git a/apps/src/Form/Admin/Bookmark/ImportType.php b/apps/src/Form/Admin/Bookmark/ImportType.php new file mode 100644 index 000000000..a1646ac05 --- /dev/null +++ b/apps/src/Form/Admin/Bookmark/ImportType.php @@ -0,0 +1,37 @@ +add( + 'file', + FileType::class, + [ + 'label' => $this->translator->trans('bookmark.import.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.import.help', [], 'admin.form'), + 'required' => false, + 'attr' => ['accept' => 'text/html'], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([]); + } +} diff --git a/apps/src/Form/Admin/Bookmark/PrincipalType.php b/apps/src/Form/Admin/Bookmark/PrincipalType.php new file mode 100644 index 000000000..df6617a0d --- /dev/null +++ b/apps/src/Form/Admin/Bookmark/PrincipalType.php @@ -0,0 +1,179 @@ +setTextType($builder); + $builder->add( + 'published', + DateTimeType::class, + [ + 'label' => $this->translator->trans('post.published.label', [], 'admin.form'), + 'help' => $this->translator->trans('post.published.help', [], 'admin.form'), + 'date_widget' => 'single_text', + 'time_widget' => 'single_text', + 'with_seconds' => true, + ] + ); + $builder->add( + 'url', + UrlType::class, + [ + 'label' => $this->translator->trans('bookmark.url.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.url.help', [], 'admin.form'), + 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans('bookmark.url.placeholder', [], 'admin.form'), + ], + ] + ); + $builder->add( + 'content', + CKEditorType::class, + [ + 'label' => $this->translator->trans('bookmark.content.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.content.help', [], 'admin.form'), + ] + ); + $this->setMeta($builder); + $builder->add( + 'file', + FileType::class, + [ + 'label' => $this->translator->trans('bookmark.file.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.file.help', [], 'admin.form'), + 'required' => false, + 'attr' => ['accept' => 'image/*'], + ] + ); + $builder->add( + 'refuser', + SearchableType::class, + [ + 'label' => $this->translator->trans('bookmark.refuser.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.refuser.help', [], 'admin.form'), + 'multiple' => false, + 'class' => User::class, + 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans('bookmark.refuser.placeholder', [], 'admin.form'), + ], + ] + ); + $builder->add( + 'refcategory', + SearchableType::class, + [ + 'label' => $this->translator->trans('bookmark.refcategory.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.refcategory.help', [], 'admin.form'), + 'multiple' => false, + 'class' => Category::class, + 'route' => 'api_search_category', + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'bookmark.refcategory.placeholder', + [], + 'admin.form' + ), + ], + ] + ); + $builder->add( + 'libelles', + SearchableType::class, + [ + 'label' => $this->translator->trans('bookmark.libelles.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.libelles.help', [], 'admin.form'), + 'class' => Libelle::class, + 'new' => new Libelle(), + 'add' => true, + 'route' => 'api_search_postlibelle', + 'attr' => [ + 'placeholder' => $this->translator->trans('bookmark.libelles.placeholder', [], 'admin.form'), + ], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => Bookmark::class, + ] + ); + } + + protected function setMeta($builder) + { + $meta = [ + 'metaDescription' => [ + 'label' => $this->translator->trans('bookmark.metaDescription.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.metaDescription.help', [], 'admin.form'), + ], + 'metaKeywords' => [ + 'label' => $this->translator->trans('bookmark.metaKeywords.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.metaKeywords.help', [], 'admin.form'), + ], + ]; + + foreach ($meta as $key => $values) { + $builder->add( + $key, + TextType::class, + array_merge( + $values, + ['required' => false] + ) + ); + } + } + + protected function setTextType($builder) + { + $texttype = [ + 'name' => [ + 'label' => $this->translator->trans('bookmark.name.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.name.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('bookmark.name.placeholder', [], 'admin.form'), + ], + ], + 'slug' => [ + 'label' => $this->translator->trans('bookmark.slug.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.slug.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('bookmark.slug.placeholder', [], 'admin.form'), + ], + 'required' => false, + ], + ]; + foreach ($texttype as $key => $args) { + $builder->add($key, TextType::class, $args); + } + } +} diff --git a/apps/src/Form/Admin/CategoryType.php b/apps/src/Form/Admin/CategoryType.php index 0342e8219..bb5bf04eb 100644 --- a/apps/src/Form/Admin/CategoryType.php +++ b/apps/src/Form/Admin/CategoryType.php @@ -25,6 +25,9 @@ public function buildForm( [ 'label' => $this->translator->trans('category.name.label', [], 'admin.form'), 'help' => $this->translator->trans('category.name.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('category.name.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -34,6 +37,9 @@ public function buildForm( 'label' => $this->translator->trans('category.slug.label', [], 'admin.form'), 'help' => $this->translator->trans('category.slug.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans('category.slug.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -46,6 +52,9 @@ public function buildForm( 'class' => Category::class, 'required' => false, 'route' => 'api_search_category', + 'attr' => [ + 'placeholder' => $this->translator->trans('category.parent.placeholder', [], 'admin.form'), + ], ] ); unset($options); diff --git a/apps/src/Form/Admin/Collections/Param/DisclaimerType.php b/apps/src/Form/Admin/Collections/Param/DisclaimerType.php index aa2ab7bbf..fa7b8293e 100644 --- a/apps/src/Form/Admin/Collections/Param/DisclaimerType.php +++ b/apps/src/Form/Admin/Collections/Param/DisclaimerType.php @@ -27,6 +27,13 @@ public function buildForm( 'Non' => '0', 'Oui' => '1', ], + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.disclaimer.activate.placeholder', + [], + 'admin.form' + ), + ], ] ); $builder->add( @@ -36,6 +43,13 @@ public function buildForm( 'label' => $this->translator->trans('param.disclaimer.title.label', [], 'admin.form'), 'help' => $this->translator->trans('param.disclaimer.title.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.disclaimer.title.placeholder', + [], + 'admin.form' + ), + ], ] ); $builder->add( @@ -54,6 +68,13 @@ public function buildForm( 'label' => $this->translator->trans('param.disclaimer.url-redirect.label', [], 'admin.form'), 'help' => $this->translator->trans('param.disclaimer.url-redirect.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.disclaimer.url-redirect.placeholder', + [], + 'admin.form' + ), + ], ] ); unset($options); diff --git a/apps/src/Form/Admin/Collections/Param/FormatDateType.php b/apps/src/Form/Admin/Collections/Param/FormatDateType.php index 243f6876d..3f3c4e232 100644 --- a/apps/src/Form/Admin/Collections/Param/FormatDateType.php +++ b/apps/src/Form/Admin/Collections/Param/FormatDateType.php @@ -20,6 +20,13 @@ public function buildForm( [ 'label' => $this->translator->trans('param.formatdate.admin.label', [], 'admin.form'), 'help' => $this->translator->trans('param.formatdate.admin.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.formatdate.admin.placeholder', + [], + 'admin.form' + ), + ], ] ); $builder->add( @@ -28,6 +35,13 @@ public function buildForm( [ 'label' => $this->translator->trans('param.formatdate.public.label', [], 'admin.form'), 'help' => $this->translator->trans('param.formatdate.public.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.formatdate.public.placeholder', + [], + 'admin.form' + ), + ], ] ); unset($options); diff --git a/apps/src/Form/Admin/Collections/Param/MetaSiteType.php b/apps/src/Form/Admin/Collections/Param/MetaSiteType.php index ab878ca5b..0719a0448 100644 --- a/apps/src/Form/Admin/Collections/Param/MetaSiteType.php +++ b/apps/src/Form/Admin/Collections/Param/MetaSiteType.php @@ -30,6 +30,13 @@ public function buildForm( 'label' => $this->translator->trans('param.metasite.viewport.label', [], 'admin.form'), 'help' => $this->translator->trans('param.metasite.viewport.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.metasite.viewport.placeholder', + [], + 'admin.form' + ), + ], ] ); $builder->add( @@ -39,6 +46,13 @@ public function buildForm( 'label' => $this->translator->trans('param.metasite.description.label', [], 'admin.form'), 'help' => $this->translator->trans('param.metasite.description.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.metasite.description.placeholder', + [], + 'admin.form' + ), + ], ] ); $builder->add( @@ -48,6 +62,13 @@ public function buildForm( 'label' => $this->translator->trans('param.metasite.keywords.label', [], 'admin.form'), 'help' => $this->translator->trans('param.metasite.keywords.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.metasite.keywords.placeholder', + [], + 'admin.form' + ), + ], ] ); unset($options); diff --git a/apps/src/Form/Admin/Collections/Param/NotificationType.php b/apps/src/Form/Admin/Collections/Param/NotificationType.php index e0825fb38..d9707646f 100644 --- a/apps/src/Form/Admin/Collections/Param/NotificationType.php +++ b/apps/src/Form/Admin/Collections/Param/NotificationType.php @@ -21,6 +21,13 @@ public function buildForm( [ 'label' => $this->translator->trans('param.notification.type.label', [], 'admin.form'), 'help' => $this->translator->trans('param.notification.type.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.notification.type.placeholder', + [], + 'admin.form' + ), + ], ] ); $builder->add( @@ -33,6 +40,13 @@ public function buildForm( 'Non' => '0', 'Oui' => '1', ], + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.notification.mail.placeholder', + [], + 'admin.form' + ), + ], ] ); $builder->add( @@ -45,6 +59,13 @@ public function buildForm( 'Non' => '0', 'Oui' => '1', ], + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.notification.notify.placeholder', + [], + 'admin.form' + ), + ], ] ); unset($options); diff --git a/apps/src/Form/Admin/Collections/Param/OauthType.php b/apps/src/Form/Admin/Collections/Param/OauthType.php index 57144a4ed..1bcdbcf5e 100644 --- a/apps/src/Form/Admin/Collections/Param/OauthType.php +++ b/apps/src/Form/Admin/Collections/Param/OauthType.php @@ -39,6 +39,13 @@ public function buildForm( 'Non' => '0', 'Oui' => '1', ], + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.oauth.activate.placeholder', + [], + 'admin.form' + ), + ], ] ); $types = $this->oauthService->getTypes(); @@ -55,6 +62,9 @@ public function buildForm( 'label' => $this->translator->trans('param.oauth.type.label', [], 'admin.form'), 'help' => $this->translator->trans('param.oauth.type.help', [], 'admin.form'), 'choices' => $choices, + 'attr' => [ + 'placeholder' => $this->translator->trans('param.oauth.type.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -64,6 +74,9 @@ public function buildForm( 'label' => $this->translator->trans('param.oauth.id.label', [], 'admin.form'), 'help' => $this->translator->trans('param.oauth.id.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans('param.oauth.id.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -73,6 +86,13 @@ public function buildForm( 'label' => $this->translator->trans('param.oauth.secret.label', [], 'admin.form'), 'help' => $this->translator->trans('param.oauth.secret.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.oauth.secret.placeholder', + [], + 'admin.form' + ), + ], ] ); unset($options); diff --git a/apps/src/Form/Admin/Collections/Param/TarteaucitronType.php b/apps/src/Form/Admin/Collections/Param/TarteaucitronType.php index cd985807a..05494cc78 100644 --- a/apps/src/Form/Admin/Collections/Param/TarteaucitronType.php +++ b/apps/src/Form/Admin/Collections/Param/TarteaucitronType.php @@ -24,6 +24,13 @@ public function buildForm( 'label' => $this->translator->trans('param.tarteaucitron.privacyUrl.label', [], 'admin.form'), 'help' => $this->translator->trans('param.tarteaucitron.privacyUrl.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.privacyUrl.placeholder', + [], + 'admin.form' + ), + ], ] ); @@ -35,6 +42,13 @@ public function buildForm( [ 'label' => $this->translator->trans('param.tarteaucitron.iconPosition.label', [], 'admin.form'), 'help' => $this->translator->trans('param.tarteaucitron.iconPosition.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.iconPosition.placeholder', + [], + 'admin.form' + ), + ], 'choices' => [ 'BottomRight' => 'BottomRight', 'BottomLeft' => 'BottomLeft', @@ -51,6 +65,13 @@ public function buildForm( 'label' => $this->translator->trans('param.tarteaucitron.readmoreLink.label', [], 'admin.form'), 'help' => $this->translator->trans('param.tarteaucitron.readmoreLink.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.readmoreLink.placeholder', + [], + 'admin.form' + ), + ], ] ); $builder->add( @@ -59,6 +80,13 @@ public function buildForm( [ 'label' => $this->translator->trans('param.tarteaucitron.mandatory.label', [], 'admin.form'), 'help' => $this->translator->trans('param.tarteaucitron.mandatory.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.mandatory.placeholder', + [], + 'admin.form' + ), + ], 'choices' => [ 'Non' => '0', 'Oui' => '1', @@ -88,16 +116,31 @@ private function setInputText($builder) { $tab = [ 'hashtag' => [ - 'label' => $this->translator->trans('param.tarteaucitron.hashtag.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.hashtag.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.hashtag.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.hashtag.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.hashtag.placeholder', + [], + 'admin.form' + ), ], 'cookieName' => [ - 'label' => $this->translator->trans('param.tarteaucitron.cookieName.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.cookieName.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.cookieName.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.cookieName.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.cookieName.placeholder', + [], + 'admin.form' + ), ], 'orientation' => [ - 'label' => $this->translator->trans('param.tarteaucitron.orientation.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.orientation.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.orientation.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.orientation.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.orientation.placeholder', + [], + 'admin.form' + ), ], ]; foreach ($tab as $id => $row) { @@ -107,6 +150,9 @@ private function setInputText($builder) [ 'label' => $row['label'], 'help' => $row['help'], + 'attr' => [ + 'placeholder' => $row['placeholder'], + ], ] ); } @@ -125,6 +171,9 @@ private function setInputTrueFalse($builder, $tab) 'Non' => '0', 'Oui' => '1', ], + 'attr' => [ + 'placeholder' => $row['placeholder'], + ], ] ); } @@ -134,24 +183,49 @@ private function setInputTrueFalsePartie1($builder) { $tab = [ 'groupServices' => [ - 'label' => $this->translator->trans('param.tarteaucitron.groupServices.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.groupServices.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.groupServices.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.groupServices.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.groupServices.placeholder', + [], + 'admin.form' + ), ], 'showAlertSmall' => [ - 'label' => $this->translator->trans('param.tarteaucitron.showAlertSmall.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.showAlertSmall.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.showAlertSmall.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.showAlertSmall.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.showAlertSmall.placeholder', + [], + 'admin.form' + ), ], 'cookieslist' => [ - 'label' => $this->translator->trans('param.tarteaucitron.cookieslist.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.cookieslist.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.cookieslist.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.cookieslist.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.cookieslist.placeholder', + [], + 'admin.form' + ), ], 'closePopup' => [ - 'label' => $this->translator->trans('param.tarteaucitron.closePopup.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.closePopup.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.closePopup.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.closePopup.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.closePopup.placeholder', + [], + 'admin.form' + ), ], 'showIcon' => [ - 'label' => $this->translator->trans('param.tarteaucitron.showIcon.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.showIcon.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.showIcon.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.showIcon.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.showIcon.placeholder', + [], + 'admin.form' + ), ], ]; $this->setInputTrueFalse($builder, $tab); @@ -161,40 +235,75 @@ private function setInputTrueFalsePartie2($builder) { $tab = [ 'adblocker' => [ - 'label' => $this->translator->trans('param.tarteaucitron.adblocker.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.adblocker.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.adblocker.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.adblocker.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.adblocker.placeholder', + [], + 'admin.form' + ), ], 'DenyAllCta' => [ - 'label' => $this->translator->trans('param.tarteaucitron.DenyAllCta.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.DenyAllCta.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.DenyAllCta.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.DenyAllCta.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.DenyAllCta.placeholder', + [], + 'admin.form' + ), ], 'AcceptAllCta' => [ - 'label' => $this->translator->trans('param.tarteaucitron.AcceptAllCta.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.AcceptAllCta.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.AcceptAllCta.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.AcceptAllCta.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.AcceptAllCta.placeholder', + [], + 'admin.form' + ), ], 'highPrivacy' => [ - 'label' => $this->translator->trans('param.tarteaucitron.highPrivacy.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.highPrivacy.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.highPrivacy.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.highPrivacy.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.highPrivacy.placeholder', + [], + 'admin.form' + ), ], 'handleBrowserDNTRequest' => [ - 'label' => $this->translator->trans( + 'label' => $this->translator->trans( 'param.tarteaucitron.handleBrowserDNTRequest.label', [], 'admin.form' ), - 'help' => $this->translator->trans( + 'help' => $this->translator->trans( 'param.tarteaucitron.handleBrowserDNTRequest.help', [], 'admin.form' ), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.handleBrowserDNTRequest.placeholder', + [], + 'admin.form' + ), ], 'removeCredit' => [ - 'label' => $this->translator->trans('param.tarteaucitron.removeCredit.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.removeCredit.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.removeCredit.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.removeCredit.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.removeCredit.placeholder', + [], + 'admin.form' + ), ], 'moreInfoLink' => [ - 'label' => $this->translator->trans('param.tarteaucitron.moreInfoLink.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.tarteaucitron.moreInfoLink.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.tarteaucitron.moreInfoLink.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.tarteaucitron.moreInfoLink.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans( + 'param.tarteaucitron.moreInfoLink.placeholder', + [], + 'admin.form' + ), ], ]; $this->setInputTrueFalse($builder, $tab); diff --git a/apps/src/Form/Admin/EditoType.php b/apps/src/Form/Admin/EditoType.php index 15f3dadbe..c0cf19c33 100644 --- a/apps/src/Form/Admin/EditoType.php +++ b/apps/src/Form/Admin/EditoType.php @@ -29,6 +29,9 @@ public function buildForm( [ 'label' => $this->translator->trans('edito.title.label', [], 'admin.form'), 'help' => $this->translator->trans('edito.title.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('edito.title.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -54,16 +57,24 @@ public function buildForm( 'metaDescription', TextType::class, [ - 'label' => $this->translator->trans('edito.metaDescription.label', [], 'admin.form'), - 'help' => $this->translator->trans('edito.metaDescription.help', [], 'admin.form'), + 'required' => false, + 'label' => $this->translator->trans('edito.metaDescription.label', [], 'admin.form'), + 'help' => $this->translator->trans('edito.metaDescription.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('edito.metaDescription.placeholder', [], 'admin.form'), + ], ] ); $builder->add( 'metaKeywords', TextType::class, [ - 'label' => $this->translator->trans('edito.metaKeywords.label', [], 'admin.form'), - 'help' => $this->translator->trans('edito.metaKeywords.help', [], 'admin.form'), + 'required' => false, + 'label' => $this->translator->trans('edito.metaKeywords.label', [], 'admin.form'), + 'help' => $this->translator->trans('edito.metaKeywords.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('edito.metaKeywords.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -85,6 +96,9 @@ public function buildForm( 'multiple' => false, 'class' => User::class, 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans('edito.refuser.placeholder', [], 'admin.form'), + ], ] ); unset($options); diff --git a/apps/src/Form/Admin/EmailType.php b/apps/src/Form/Admin/EmailType.php index f61ef4c3b..3d8e822c1 100644 --- a/apps/src/Form/Admin/EmailType.php +++ b/apps/src/Form/Admin/EmailType.php @@ -23,6 +23,9 @@ public function buildForm( [ 'label' => $this->translator->trans('email.adresse.label', [], 'admin.form'), 'help' => $this->translator->trans('email.adresse.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('email.adresse.placeholder', [], 'admin.form'), + ], ] ); } diff --git a/apps/src/Form/Admin/GeoCodeType.php b/apps/src/Form/Admin/GeoCodeType.php index 7c1e22099..d1ebf0dc3 100644 --- a/apps/src/Form/Admin/GeoCodeType.php +++ b/apps/src/Form/Admin/GeoCodeType.php @@ -20,52 +20,66 @@ public function buildForm(FormBuilderInterface $builder, array $options) [ 'label' => $this->translator->trans('geocode.countryCode.label', [], 'admin.form'), 'help' => $this->translator->trans('geocode.countryCode.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('geocode.countryCode.placeholder', [], 'admin.form'), + ], ] ); $tab = [ 'postalCode' => [ - 'label' => $this->translator->trans('param.geocode.postalCode.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.geocode.postalCode.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.geocode.postalCode.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.geocode.postalCode.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.geocode.postalCode.placeholder', [], 'admin.form'), ], 'placeName' => [ - 'label' => $this->translator->trans('param.geocode.placeName.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.geocode.placeName.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.geocode.placeName.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.geocode.placeName.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.geocode.placeName.placeholder', [], 'admin.form'), ], 'stateName' => [ - 'label' => $this->translator->trans('param.geocode.stateName.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.geocode.stateName.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.geocode.stateName.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.geocode.stateName.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.geocode.stateName.placeholder', [], 'admin.form'), ], 'stateCode' => [ - 'label' => $this->translator->trans('param.geocode.stateCode.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.geocode.stateCode.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.geocode.stateCode.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.geocode.stateCode.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.geocode.stateCode.placeholder', [], 'admin.form'), ], 'provinceName' => [ - 'label' => $this->translator->trans('param.geocode.provinceName.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.geocode.provinceName.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.geocode.provinceName.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.geocode.provinceName.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.geocode.provinceName.placeholder', [], 'admin.form'), ], 'provinceCode' => [ - 'label' => $this->translator->trans('param.geocode.provinceCode.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.geocode.provinceCode.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.geocode.provinceCode.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.geocode.provinceCode.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.geocode.provinceCode.placeholder', [], 'admin.form'), ], 'communityName' => [ - 'label' => $this->translator->trans('param.geocode.communityName.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.geocode.communityName.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.geocode.communityName.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.geocode.communityName.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.geocode.communityName.placeholder', [], 'admin.form'), ], 'communityCode' => [ - 'label' => $this->translator->trans('param.geocode.communityCode.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.geocode.communityCode.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.geocode.communityCode.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.geocode.communityCode.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.geocode.communityCode.placeholder', [], 'admin.form'), ], 'latitude' => [ - 'label' => $this->translator->trans('param.geocode.latitude.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.geocode.latitude.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.geocode.latitude.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.geocode.latitude.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.geocode.latitude.placeholder', [], 'admin.form'), ], 'longitude' => [ - 'label' => $this->translator->trans('param.geocode.longitude.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.geocode.longitude.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.geocode.longitude.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.geocode.longitude.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.geocode.longitude.placeholder', [], 'admin.form'), ], 'accuracy' => [ - 'label' => $this->translator->trans('param.geocode.accuracy.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.geocode.accuracy.help', [], 'admin.form'), + 'label' => $this->translator->trans('param.geocode.accuracy.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.geocode.accuracy.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.geocode.accuracy.placeholder', [], 'admin.form'), ], ]; @@ -90,6 +104,9 @@ private function setInputText($builder, $tab) [ 'label' => $row['label'], 'help' => $row['help'], + 'attr' => [ + 'placeholder' => $row['placeholder'], + ], ] ); } diff --git a/apps/src/Form/Admin/LibelleType.php b/apps/src/Form/Admin/LibelleType.php index 02e9a8279..10a1e17a3 100644 --- a/apps/src/Form/Admin/LibelleType.php +++ b/apps/src/Form/Admin/LibelleType.php @@ -24,6 +24,9 @@ public function buildForm( [ 'label' => $this->translator->trans('libelle.name.label', [], 'admin.form'), 'help' => $this->translator->trans('libelle.name.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('libelle.name.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -32,6 +35,9 @@ public function buildForm( [ 'label' => $this->translator->trans('libelle.slug.label', [], 'admin.form'), 'help' => $this->translator->trans('libelle.slug.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('libelle.slug.placeholder', [], 'admin.form'), + ], 'required' => false, ] ); diff --git a/apps/src/Form/Admin/LienType.php b/apps/src/Form/Admin/LienType.php index 99b23e58b..375115683 100644 --- a/apps/src/Form/Admin/LienType.php +++ b/apps/src/Form/Admin/LienType.php @@ -24,6 +24,9 @@ public function buildForm( [ 'label' => $this->translator->trans('lien.name.label', [], 'admin.form'), 'help' => $this->translator->trans('lien.name.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('lien.name.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -32,6 +35,9 @@ public function buildForm( [ 'label' => $this->translator->trans('lien.adresse.label', [], 'admin.form'), 'help' => $this->translator->trans('lien.adresse.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('lien.adresse.placeholder', [], 'admin.form'), + ], ] ); } diff --git a/apps/src/Form/Admin/Menu/DataType.php b/apps/src/Form/Admin/Menu/DataType.php index 18d7e7146..591e2b37f 100644 --- a/apps/src/Form/Admin/Menu/DataType.php +++ b/apps/src/Form/Admin/Menu/DataType.php @@ -22,6 +22,9 @@ public function buildForm( 'label' => $this->translator->trans('menu.data.route.name.label', [], 'admin.form'), 'help' => $this->translator->trans('menu.data.route.name.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans('menu.data.route.name.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -31,6 +34,9 @@ public function buildForm( 'label' => $this->translator->trans('menu.data.route.param.label', [], 'admin.form'), 'help' => $this->translator->trans('menu.data.route.param.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans('menu.data.route.param.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -40,6 +46,9 @@ public function buildForm( 'label' => $this->translator->trans('menu.data.route.url.label', [], 'admin.form'), 'help' => $this->translator->trans('menu.data.route.url.help', [], 'admin.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans('menu.data.route.url.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -56,6 +65,9 @@ public function buildForm( '_parent' => '_parent', '_top' => '_top', ], + 'attr' => [ + 'placeholder' => $this->translator->trans('menu.data.route.target.placeholder', [], 'admin.form'), + ], ] ); } diff --git a/apps/src/Form/Admin/Menu/LinkType.php b/apps/src/Form/Admin/Menu/LinkType.php index aa0dddc18..1b81857ac 100644 --- a/apps/src/Form/Admin/Menu/LinkType.php +++ b/apps/src/Form/Admin/Menu/LinkType.php @@ -23,6 +23,9 @@ public function buildForm( [ 'label' => $this->translator->trans('menu.link.libelle.label', [], 'admin.form'), 'help' => $this->translator->trans('menu.link.libelle.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('menu.link.libelle.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -31,6 +34,9 @@ public function buildForm( [ 'label' => $this->translator->trans('menu.link.icon.label', [], 'admin.form'), 'help' => $this->translator->trans('menu.link.icon.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('menu.link.icon.placeholder', [], 'admin.form'), + ], 'required' => false, ] ); diff --git a/apps/src/Form/Admin/Menu/PrincipalType.php b/apps/src/Form/Admin/Menu/PrincipalType.php index 7b3ed9479..81e75ae3c 100644 --- a/apps/src/Form/Admin/Menu/PrincipalType.php +++ b/apps/src/Form/Admin/Menu/PrincipalType.php @@ -22,6 +22,9 @@ public function buildForm( [ 'label' => $this->translator->trans('menu.principal.clef.label', [], 'admin.form'), 'help' => $this->translator->trans('menu.principal.clef.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('menu.principal.clef.placeholder', [], 'admin.form'), + ], ] ); } diff --git a/apps/src/Form/Admin/NoteInterneType.php b/apps/src/Form/Admin/NoteInterneType.php index 8df9da4b8..409591b75 100644 --- a/apps/src/Form/Admin/NoteInterneType.php +++ b/apps/src/Form/Admin/NoteInterneType.php @@ -30,6 +30,9 @@ public function buildForm( [ 'label' => $this->translator->trans('noteinterne.title.label', [], 'admin.form'), 'help' => $this->translator->trans('noteinterne.title.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('noteinterne.title.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -82,6 +85,9 @@ public function buildForm( 'multiple' => false, 'class' => User::class, 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans('noteinterne.refuser.placeholder', [], 'admin.form'), + ], ] ); } diff --git a/apps/src/Form/Admin/ParamType.php b/apps/src/Form/Admin/ParamType.php index f28443ec4..b7a1bfa4c 100644 --- a/apps/src/Form/Admin/ParamType.php +++ b/apps/src/Form/Admin/ParamType.php @@ -38,6 +38,9 @@ public function buildForm( 'multiple' => true, 'label' => $this->translator->trans('param.language.label', [], 'admin.form'), 'help' => $this->translator->trans('param.language.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('param.language.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -50,6 +53,9 @@ public function buildForm( 'Non' => '0', 'Oui' => '1', ], + 'attr' => [ + 'placeholder' => $this->translator->trans('param.generator.placeholder', [], 'admin.form'), + ], ] ); $url = 'https://unicode-org.github.io/icu/userguide/format_parse/datetime/'; @@ -80,6 +86,9 @@ public function buildForm( [ 'label' => $this->translator->trans('param.site_copyright.label', [], 'admin.form'), 'help' => $this->translator->trans('param.site_copyright.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('param.site_copyright.placeholder', [], 'admin.form'), + ], ] ); unset($options); @@ -123,29 +132,34 @@ private function setInputs($builder) { $inputs = [ 'title_format' => [ - 'class' => TextType::class, - 'label' => $this->translator->trans('param.title_format.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.title_format.help', [], 'admin.form'), + 'class' => TextType::class, + 'label' => $this->translator->trans('param.title_format.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.title_format.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.title_format.placeholder', [], 'admin.form'), ], 'robotstxt' => [ - 'class' => TextareaType::class, - 'label' => $this->translator->trans('param.robotstxt.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.robotstxt.help', [], 'admin.form'), + 'class' => TextareaType::class, + 'label' => $this->translator->trans('param.robotstxt.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.robotstxt.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.robotstxt.placeholder', [], 'admin.form'), ], 'languagedefault' => [ - 'class' => LanguageType::class, - 'label' => $this->translator->trans('param.languagedefault.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.languagedefault.help', [], 'admin.form'), + 'class' => LanguageType::class, + 'label' => $this->translator->trans('param.languagedefault.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.languagedefault.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.languagedefault.placeholder', [], 'admin.form'), ], 'site_no-reply' => [ - 'class' => EmailType::class, - 'label' => $this->translator->trans('param.site_no-reply.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.site_no-reply.help', [], 'admin.form'), + 'class' => EmailType::class, + 'label' => $this->translator->trans('param.site_no-reply.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.site_no-reply.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.site_no-reply.placeholder', [], 'admin.form'), ], 'site_url' => [ - 'class' => UrlType::class, - 'label' => $this->translator->trans('param.site_url.label', [], 'admin.form'), - 'help' => $this->translator->trans('param.site_url.help', [], 'admin.form'), + 'class' => UrlType::class, + 'label' => $this->translator->trans('param.site_url.label', [], 'admin.form'), + 'help' => $this->translator->trans('param.site_url.help', [], 'admin.form'), + 'placeholder' => $this->translator->trans('param.site_url.placeholder', [], 'admin.form'), ], ]; foreach ($inputs as $key => $row) { @@ -155,6 +169,9 @@ private function setInputs($builder) [ 'label' => $row['label'], 'help' => $row['help'], + 'attr' => [ + 'placeholder' => $row['placeholder'], + ], ] ); } diff --git a/apps/src/Form/Admin/PhoneType.php b/apps/src/Form/Admin/PhoneType.php index 9d6362917..58d93ca5a 100644 --- a/apps/src/Form/Admin/PhoneType.php +++ b/apps/src/Form/Admin/PhoneType.php @@ -35,6 +35,9 @@ public function buildForm( $optionsInput = [ 'label' => $this->translator->trans('phone.numero.label', [], 'admin.form'), 'help' => $this->translator->trans('phone.numero.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('phone.numero.placeholder', [], 'admin.form'), + ], ]; if (array_key_exists('data', $options)) { // @var PhoneUser $phoneuser @@ -59,8 +62,9 @@ public function buildForm( 'label' => $this->translator->trans('phone.country.label', [], 'admin.form'), 'help' => $this->translator->trans('phone.country.help', [], 'admin.form'), 'attr' => [ - 'is' => 'select-country', - 'choices' => 'true', + 'placeholder' => $this->translator->trans('phone.country.placeholder', [], 'admin.form'), + 'is' => 'select-country', + 'choices' => 'true', ], ] ); diff --git a/apps/src/Form/Admin/PostType.php b/apps/src/Form/Admin/PostType.php index 5813364e1..561079c48 100644 --- a/apps/src/Form/Admin/PostType.php +++ b/apps/src/Form/Admin/PostType.php @@ -26,23 +26,7 @@ public function buildForm( array $options ): void { - $builder->add( - 'title', - TextType::class, - [ - 'label' => $this->translator->trans('post.title.label', [], 'admin.form'), - 'help' => $this->translator->trans('post.title.help', [], 'admin.form'), - ] - ); - $builder->add( - 'slug', - TextType::class, - [ - 'label' => $this->translator->trans('post.slug.label', [], 'admin.form'), - 'help' => $this->translator->trans('post.slug.help', [], 'admin.form'), - 'required' => false, - ] - ); + $this->setTextType($builder); $builder->add( 'published', DateTimeType::class, @@ -82,6 +66,9 @@ public function buildForm( 'multiple' => false, 'class' => User::class, 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans('post.refuser.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -93,6 +80,9 @@ public function buildForm( 'multiple' => false, 'class' => Category::class, 'route' => 'api_search_category', + 'attr' => [ + 'placeholder' => $this->translator->trans('post.refcategory.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -113,6 +103,9 @@ public function buildForm( 'new' => new Libelle(), 'add' => true, 'route' => 'api_search_postlibelle', + 'attr' => [ + 'placeholder' => $this->translator->trans('post.libelles.placeholder', [], 'admin.form'), + ], ] ); unset($options); @@ -141,7 +134,38 @@ protected function setMeta($builder) ]; foreach ($meta as $key => $values) { - $builder->add($key, TextType::class, $values); + $builder->add( + $key, + TextType::class, + array_merge( + $values, + ['required' => false] + ) + ); + } + } + + protected function setTextType($builder) + { + $texttype = [ + 'title' => [ + 'label' => $this->translator->trans('post.title.label', [], 'admin.form'), + 'help' => $this->translator->trans('post.title.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('post.title.placeholder', [], 'admin.form'), + ], + ], + 'slug' => [ + 'label' => $this->translator->trans('post.slug.label', [], 'admin.form'), + 'help' => $this->translator->trans('post.slug.help', [], 'admin.form'), + 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans('post.slug.placeholder', [], 'admin.form'), + ], + ], + ]; + foreach ($texttype as $key => $args) { + $builder->add($key, TextType::class, $args); } } } diff --git a/apps/src/Form/Admin/ProfilType.php b/apps/src/Form/Admin/ProfilType.php index 78d6321fa..6855a6a4c 100644 --- a/apps/src/Form/Admin/ProfilType.php +++ b/apps/src/Form/Admin/ProfilType.php @@ -47,6 +47,9 @@ public function buildForm( [ 'label' => $this->translator->trans('profil.username.label', [], 'admin.form'), 'help' => $this->translator->trans('profil.username.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('profil.username.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -90,6 +93,9 @@ public function buildForm( 'label' => $this->translator->trans('profil.email.label', [], 'admin.form'), 'help' => $this->translator->trans('profil.email.help', [], 'admin.form'), 'choices' => $emails, + 'attr' => [ + 'placeholder' => $this->translator->trans('profil.email.placeholder', [], 'admin.form'), + ], ] ); } diff --git a/apps/src/Form/Admin/Search/BookmarkType.php b/apps/src/Form/Admin/Search/BookmarkType.php new file mode 100644 index 000000000..d6ff3e0db --- /dev/null +++ b/apps/src/Form/Admin/Search/BookmarkType.php @@ -0,0 +1,136 @@ +workflows = $workflows; + parent::__construct($translator); + } + + /** + * @inheritdoc + */ + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void + { + $builder->add( + 'name', + TextType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('bookmark.name.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('bookmark.name.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('bookmark.name.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'refuser', + SearchableType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('bookmark.refuser.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('bookmark.refuser.help', [], 'admin.search.form'), + 'multiple' => false, + 'class' => User::class, + 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans('bookmark.refuser.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'refcategory', + SearchableType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('bookmark.refcategory.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('bookmark.refcategory.help', [], 'admin.search.form'), + 'multiple' => false, + 'class' => Category::class, + 'route' => 'api_search_category', + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'bookmark.refcategory.placeholder', + [], + 'admin.search.form' + ), + ], + ] + ); + $workflow = $this->workflows->get(new Bookmark()); + $definition = $workflow->getDefinition(); + $places = $definition->getPlaces(); + $builder->add( + 'etape', + ChoiceType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('bookmark.etape.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('bookmark.etape.help', [], 'admin.search.form'), + 'choices' => $places, + 'attr' => [ + 'placeholder' => $this->translator->trans('bookmark.etape.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => BookmarkSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/Search/CategoryType.php b/apps/src/Form/Admin/Search/CategoryType.php new file mode 100644 index 000000000..c0a668fbd --- /dev/null +++ b/apps/src/Form/Admin/Search/CategoryType.php @@ -0,0 +1,67 @@ +add( + 'name', + TextType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('category.name.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('category.name.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('category.name.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => CategorySearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/Search/EditoType.php b/apps/src/Form/Admin/Search/EditoType.php new file mode 100644 index 000000000..3fb09457f --- /dev/null +++ b/apps/src/Form/Admin/Search/EditoType.php @@ -0,0 +1,127 @@ +workflows = $workflows; + parent::__construct($translator); + } + + /** + * @inheritdoc + */ + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void + { + $builder->add( + 'title', + TextType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('edito.title.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('edito.title.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('edito.title.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'refuser', + SearchableType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('edito.refuser.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('edito.refuser.help', [], 'admin.search.form'), + 'multiple' => false, + 'class' => User::class, + 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans('edito.refuser.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'published', + DateType::class, + [ + 'required' => false, + 'widget' => 'single_text', + 'label' => $this->translator->trans('edito.published.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('edito.published.help', [], 'admin.search.form'), + ] + ); + $workflow = $this->workflows->get(new Edito()); + $definition = $workflow->getDefinition(); + $places = $definition->getPlaces(); + $builder->add( + 'etape', + ChoiceType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('edito.etape.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('edito.etape.help', [], 'admin.search.form'), + 'choices' => $places, + 'attr' => [ + 'placeholder' => $this->translator->trans('edito.etape.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => EditoSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/Search/GeocodeType.php b/apps/src/Form/Admin/Search/GeocodeType.php new file mode 100644 index 000000000..53356d4dd --- /dev/null +++ b/apps/src/Form/Admin/Search/GeocodeType.php @@ -0,0 +1,142 @@ +add( + 'countrycode', + CountryType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('geocode.countrycode.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('geocode.countrycode.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'geocode.countrycode.placeholder', + [], + 'admin.search.form' + ), + ], + ] + ); + $this->setTextType($builder); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => GeocodeSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } + + protected function setTextType($builder) + { + $texttype = [ + 'postalcode' => [ + 'required' => false, + 'label' => $this->translator->trans('geocode.postalcode.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('geocode.postalcode.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'geocode.postalcode.placeholder', + [], + 'admin.search.form' + ), + ], + ], + 'placename' => [ + 'required' => false, + 'label' => $this->translator->trans('geocode.placename.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('geocode.placename.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'geocode.placename.placeholder', + [], + 'admin.search.form' + ), + ], + ], + 'statename' => [ + 'required' => false, + 'label' => $this->translator->trans('geocode.statename.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('geocode.statename.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'geocode.statename.placeholder', + [], + 'admin.search.form' + ), + ], + ], + 'provincename' => [ + 'required' => false, + 'label' => $this->translator->trans('geocode.provincename.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('geocode.provincename.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'geocode.provincename.placeholder', + [], + 'admin.search.form' + ), + ], + ], + 'communityname' => [ + 'required' => false, + 'label' => $this->translator->trans('geocode.communityname.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('geocode.communityname.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'geocode.communityname.placeholder', + [], + 'admin.search.form' + ), + ], + ], + ]; + foreach ($texttype as $key => $args) { + $builder->add($key, TextType::class, $args); + } + } +} diff --git a/apps/src/Form/Admin/Search/GroupeType.php b/apps/src/Form/Admin/Search/GroupeType.php new file mode 100644 index 000000000..df7cd9a64 --- /dev/null +++ b/apps/src/Form/Admin/Search/GroupeType.php @@ -0,0 +1,67 @@ +add( + 'name', + TextType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('groupe.name.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('groupe.name.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('groupe.name.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => GroupeSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/Search/LibelleType.php b/apps/src/Form/Admin/Search/LibelleType.php new file mode 100644 index 000000000..1e188abe0 --- /dev/null +++ b/apps/src/Form/Admin/Search/LibelleType.php @@ -0,0 +1,67 @@ +add( + 'nom', + TextType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('libelle.nom.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('libelle.nom.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('libelle.nom.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => LibelleSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/Search/NoteInterneType.php b/apps/src/Form/Admin/Search/NoteInterneType.php new file mode 100644 index 000000000..552f1495d --- /dev/null +++ b/apps/src/Form/Admin/Search/NoteInterneType.php @@ -0,0 +1,145 @@ +workflows = $workflows; + parent::__construct($translator); + } + + /** + * @inheritdoc + */ + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void + { + $builder->add( + 'title', + TextType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('noteinterne.title.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('noteinterne.title.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('noteinterne.title.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'refuser', + SearchableType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('noteinterne.refuser.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('noteinterne.refuser.help', [], 'admin.search.form'), + 'multiple' => false, + 'class' => User::class, + 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'noteinterne.refuser.placeholder', + [], + 'admin.search.form' + ), + ], + ] + ); + $builder->add( + 'dateDebut', + DateType::class, + [ + 'required' => false, + 'widget' => 'single_text', + 'label' => $this->translator->trans('noteinterne.date_debut.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('noteinterne.date_debut.help', [], 'admin.search.form'), + ] + ); + $builder->add( + 'dateFin', + DateType::class, + [ + 'required' => false, + 'widget' => 'single_text', + 'label' => $this->translator->trans('noteinterne.date_fin.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('noteinterne.date_fin.help', [], 'admin.search.form'), + ] + ); + $workflow = $this->workflows->get(new NoteInterne()); + $definition = $workflow->getDefinition(); + $places = $definition->getPlaces(); + $builder->add( + 'etape', + ChoiceType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('noteinterne.etape.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('noteinterne.etape.help', [], 'admin.search.form'), + 'choices' => $places, + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'noteinterne.etape.placeholder', + [], + 'admin.search.form' + ), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => NoteInterneSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/Search/PostType.php b/apps/src/Form/Admin/Search/PostType.php new file mode 100644 index 000000000..ea89b8ef9 --- /dev/null +++ b/apps/src/Form/Admin/Search/PostType.php @@ -0,0 +1,143 @@ +workflows = $workflows; + parent::__construct($translator); + } + + /** + * @inheritdoc + */ + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void + { + $builder->add( + 'title', + TextType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('post.title.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('post.title.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('post.title.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'refuser', + SearchableType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('post.refuser.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('post.refuser.help', [], 'admin.search.form'), + 'multiple' => false, + 'class' => User::class, + 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans('post.refuser.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'refcategory', + SearchableType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('post.refcategory.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('post.refcategory.help', [], 'admin.search.form'), + 'multiple' => false, + 'class' => Category::class, + 'route' => 'api_search_category', + 'attr' => [ + 'placeholder' => $this->translator->trans('post.refcategory.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'published', + DateType::class, + [ + 'required' => false, + 'widget' => 'single_text', + 'label' => $this->translator->trans('post.published.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('post.published.help', [], 'admin.search.form'), + ] + ); + $workflow = $this->workflows->get(new Post()); + $definition = $workflow->getDefinition(); + $places = $definition->getPlaces(); + $builder->add( + 'etape', + ChoiceType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('post.etape.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('post.etape.help', [], 'admin.search.form'), + 'choices' => $places, + 'attr' => [ + 'placeholder' => $this->translator->trans('post.etape.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => PostSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/Search/TemplateType.php b/apps/src/Form/Admin/Search/TemplateType.php new file mode 100644 index 000000000..8ef821b6b --- /dev/null +++ b/apps/src/Form/Admin/Search/TemplateType.php @@ -0,0 +1,67 @@ +add( + 'name', + TextType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('category.name.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('category.name.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('category.name.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => TemplateSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/Search/User/AdresseUserType.php b/apps/src/Form/Admin/Search/User/AdresseUserType.php new file mode 100644 index 000000000..5ba1fa31a --- /dev/null +++ b/apps/src/Form/Admin/Search/User/AdresseUserType.php @@ -0,0 +1,105 @@ +add( + 'country', + CountryType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('adresseuser.country.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('adresseuser.country.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'adresseuser.country.placeholder', + [], + 'admin.search.form' + ), + ], + ] + ); + $builder->add( + 'ville', + TextType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('adresseuser.ville.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('adresseuser.ville.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('adresseuser.ville.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'refuser', + SearchableType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('adresseuser.refuser.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('adresseuser.refuser.help', [], 'admin.search.form'), + 'multiple' => false, + 'class' => User::class, + 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'adresseuser.refuser.placeholder', + [], + 'admin.search.form' + ), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => AdresseUserSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/Search/User/EmailUserType.php b/apps/src/Form/Admin/Search/User/EmailUserType.php new file mode 100644 index 000000000..60a576ac3 --- /dev/null +++ b/apps/src/Form/Admin/Search/User/EmailUserType.php @@ -0,0 +1,75 @@ +add( + 'refuser', + SearchableType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('emailuser.refuser.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('emailuser.refuser.help', [], 'admin.search.form'), + 'multiple' => false, + 'class' => User::class, + 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'emailuser.refuser.placeholder', + [], + 'admin.search.form' + ), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => EmailUserSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/Search/User/LienUserType.php b/apps/src/Form/Admin/Search/User/LienUserType.php new file mode 100644 index 000000000..79e53c662 --- /dev/null +++ b/apps/src/Form/Admin/Search/User/LienUserType.php @@ -0,0 +1,75 @@ +add( + 'refuser', + SearchableType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('lienuser.refuser.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('lienuser.refuser.help', [], 'admin.search.form'), + 'multiple' => false, + 'class' => User::class, + 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'lienuser.refuser.placeholder', + [], + 'admin.search.form' + ), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => LienUserSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/Search/User/PhoneUserType.php b/apps/src/Form/Admin/Search/User/PhoneUserType.php new file mode 100644 index 000000000..8cc5dd785 --- /dev/null +++ b/apps/src/Form/Admin/Search/User/PhoneUserType.php @@ -0,0 +1,88 @@ +add( + 'country', + CountryType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('phoneuser.country.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('phoneuser.country.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('phoneuser.country.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'refuser', + SearchableType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('phoneuser.refuser.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('phoneuser.refuser.help', [], 'admin.search.form'), + 'multiple' => false, + 'class' => User::class, + 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'phoneuser.refuser.placeholder', + [], + 'admin.search.form' + ), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => PhoneUserSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/Search/UserType.php b/apps/src/Form/Admin/Search/UserType.php new file mode 100644 index 000000000..516972549 --- /dev/null +++ b/apps/src/Form/Admin/Search/UserType.php @@ -0,0 +1,128 @@ +workflows = $workflows; + parent::__construct($translator); + } + + /** + * @inheritdoc + */ + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void + { + $builder->add( + 'username', + TextType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('user.username.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('user.username.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('user.username.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'refgroupe', + SearchableType::class, + [ + 'label' => $this->translator->trans('user.refgroupe.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('user.refgroupe.help', [], 'admin.search.form'), + 'multiple' => false, + 'class' => Groupe::class, + 'route' => 'api_search_group', + 'attr' => [ + 'placeholder' => $this->translator->trans('user.refgroupe.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'email', + EmailType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('user.email.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('user.email.help', [], 'admin.search.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('user.email.placeholder', [], 'admin.search.form'), + ], + ] + ); + $workflow = $this->workflows->get(new User()); + $definition = $workflow->getDefinition(); + $places = $definition->getPlaces(); + $builder->add( + 'etape', + ChoiceType::class, + [ + 'required' => false, + 'label' => $this->translator->trans('user.etape.label', [], 'admin.search.form'), + 'help' => $this->translator->trans('user.etape.help', [], 'admin.search.form'), + 'choices' => $places, + 'attr' => [ + 'placeholder' => $this->translator->trans('user.etape.placeholder', [], 'admin.search.form'), + ], + ] + ); + $builder->add( + 'submit', + SubmitType::class, + [ + 'attr' => ['name' => ''], + ] + ); + $builder->add( + 'reset', + ResetType::class, + [ + 'attr' => ['name' => ''], + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => UserSearch::class, + 'csrf_protection' => false, + 'method' => 'GET', + ] + ); + } + + public function getBlockPrefix() + { + return ''; + } +} diff --git a/apps/src/Form/Admin/TemplateType.php b/apps/src/Form/Admin/TemplateType.php index d48d7efca..da782cc83 100644 --- a/apps/src/Form/Admin/TemplateType.php +++ b/apps/src/Form/Admin/TemplateType.php @@ -27,6 +27,9 @@ public function buildForm( [ 'label' => $this->translator->trans('template.name.label', [], 'admin.form'), 'help' => $this->translator->trans('template.name.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('template.name.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -35,6 +38,9 @@ public function buildForm( [ 'label' => $this->translator->trans('template.code.label', [], 'admin.form'), 'help' => $this->translator->trans('template.code.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('template.code.placeholder', [], 'admin.form'), + ], ] ); $builder->add( diff --git a/apps/src/Form/Admin/User/AdresseUserType.php b/apps/src/Form/Admin/User/AdresseUserType.php index de049c20f..0cb4c05c3 100644 --- a/apps/src/Form/Admin/User/AdresseUserType.php +++ b/apps/src/Form/Admin/User/AdresseUserType.php @@ -29,6 +29,9 @@ public function buildForm( 'multiple' => false, 'class' => User::class, 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans('adresseuser.refuser.placeholder', [], 'admin.form'), + ], ] ); } diff --git a/apps/src/Form/Admin/User/EmailUserType.php b/apps/src/Form/Admin/User/EmailUserType.php index 558cc9349..1afeb3a05 100644 --- a/apps/src/Form/Admin/User/EmailUserType.php +++ b/apps/src/Form/Admin/User/EmailUserType.php @@ -35,6 +35,9 @@ public function buildForm( [ 'label' => $this->translator->trans('emailuser.refuser.label', [], 'admin.form'), 'help' => $this->translator->trans('emailuser.refuser.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('emailuser.refuser.placeholder', [], 'admin.form'), + ], 'multiple' => false, 'class' => User::class, 'route' => 'api_search_user', diff --git a/apps/src/Form/Admin/User/GroupeType.php b/apps/src/Form/Admin/User/GroupeType.php index 2d902cad8..f6e27076a 100644 --- a/apps/src/Form/Admin/User/GroupeType.php +++ b/apps/src/Form/Admin/User/GroupeType.php @@ -25,6 +25,9 @@ public function buildForm( [ 'label' => $this->translator->trans('groupe.name.label', [], 'admin.form'), 'help' => $this->translator->trans('groupe.name.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('groupe.name.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -33,6 +36,9 @@ public function buildForm( [ 'label' => $this->translator->trans('groupe.code.label', [], 'admin.form'), 'help' => $this->translator->trans('groupe.code.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('groupe.code.placeholder', [], 'admin.form'), + ], ] ); } diff --git a/apps/src/Form/Admin/User/LienUserType.php b/apps/src/Form/Admin/User/LienUserType.php index 0b8ceab21..08ac0ce3c 100644 --- a/apps/src/Form/Admin/User/LienUserType.php +++ b/apps/src/Form/Admin/User/LienUserType.php @@ -30,6 +30,9 @@ public function buildForm( 'multiple' => false, 'class' => User::class, 'route' => 'api_search_user', + 'attr' => [ + 'placeholder' => $this->translator->trans('lienuser.refuser.placeholder', [], 'admin.form'), + ], ] ); } diff --git a/apps/src/Form/Admin/User/PhoneUserType.php b/apps/src/Form/Admin/User/PhoneUserType.php index 4a1d85aea..6430930b4 100644 --- a/apps/src/Form/Admin/User/PhoneUserType.php +++ b/apps/src/Form/Admin/User/PhoneUserType.php @@ -35,6 +35,9 @@ public function buildForm( [ 'label' => $this->translator->trans('phoneuser.refuser.label', [], 'admin.form'), 'help' => $this->translator->trans('phoneuser.refuser.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('phoneuser.refuser.placeholder', [], 'admin.form'), + ], 'multiple' => false, 'class' => User::class, 'route' => 'api_search_user', diff --git a/apps/src/Form/Admin/User/UserType.php b/apps/src/Form/Admin/User/UserType.php index 0129e7481..86ea662e1 100644 --- a/apps/src/Form/Admin/User/UserType.php +++ b/apps/src/Form/Admin/User/UserType.php @@ -50,6 +50,9 @@ public function buildForm( [ 'label' => $this->translator->trans('user.username.label', [], 'admin.form'), 'help' => $this->translator->trans('user.username.help', [], 'admin.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('user.username.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -79,6 +82,9 @@ public function buildForm( 'multiple' => false, 'class' => Groupe::class, 'route' => 'api_search_group', + 'attr' => [ + 'placeholder' => $this->translator->trans('user.refgroupe.placeholder', [], 'admin.form'), + ], ] ); $builder->add( @@ -113,6 +119,9 @@ public function buildForm( 'label' => $this->translator->trans('user.email.label', [], 'admin.form'), 'help' => $this->translator->trans('user.email.help', [], 'admin.form'), 'choices' => $emails, + 'attr' => [ + 'placeholder' => $this->translator->trans('user.email.placeholder', [], 'admin.form'), + ], ] ); } diff --git a/apps/src/Form/Security/LoginType.php b/apps/src/Form/Security/LoginType.php index ad97eeda8..209f7d38d 100644 --- a/apps/src/Form/Security/LoginType.php +++ b/apps/src/Form/Security/LoginType.php @@ -23,6 +23,9 @@ public function buildForm( [ 'label' => $this->translator->trans('login.username.label', [], 'security.form'), 'help' => $this->translator->trans('login.username.help', [], 'security.form'), + 'attr' => [ + 'placeholder' => $this->translator->trans('login.username.placeholder', [], 'security.form'), + ], ] ); $builder->add( diff --git a/apps/src/Form/Security/LostPasswordType.php b/apps/src/Form/Security/LostPasswordType.php index 02edebd21..b7f8054d8 100644 --- a/apps/src/Form/Security/LostPasswordType.php +++ b/apps/src/Form/Security/LostPasswordType.php @@ -22,6 +22,9 @@ public function buildForm( 'label' => $this->translator->trans('lostpassword.value.label', [], 'security.form'), 'help' => $this->translator->trans('lostpassword.value.help', [], 'security.form'), 'required' => false, + 'attr' => [ + 'placeholder' => $this->translator->trans('lostpassword.value.placeholder', [], 'security.form'), + ], ] ); $builder->add( diff --git a/apps/src/Lib/AdminControllerLib.php b/apps/src/Lib/AdminControllerLib.php index 522fea433..2223771a1 100644 --- a/apps/src/Lib/AdminControllerLib.php +++ b/apps/src/Lib/AdminControllerLib.php @@ -2,11 +2,13 @@ namespace Labstag\Lib; +use Doctrine\ORM\EntityManager; use Labstag\Entity\Attachment; use Labstag\Entity\User; use Labstag\Reader\UploadAnnotationReader; use Labstag\Repository\AttachmentRepository; use Labstag\RequestHandler\AttachmentRequestHandler; +use Labstag\Service\AttachFormService; use Labstag\Singleton\AdminBtnSingleton; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -32,30 +34,37 @@ abstract class AdminControllerLib extends ControllerLib protected string $urlHome = ''; - public function create( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, + public function form( + AttachFormService $service, RequestHandlerLib $handler, - object $entity, string $formType, - array $url = [], + object $entity, string $twig = 'admin/crud/form.html.twig' ): Response { - if (isset($url['list'])) { - $this->btnInstance()->addBtnList( - $url['list'] - ); - } - + $uploadAnnotReader = $service->getUploadAnnotationReader(); + $attachmentRepository = $service->getRepository(); + $attachmentRH = $service->getRequestHandler(); + $url = $this->getUrlAdmin(); + $this->denyAccessUnlessGranted( + empty($entity->getId()) ? 'new' : 'edit', + $entity + ); + $this->setBtnViewUpdate($url, $entity); $oldEntity = clone $entity; $form = $this->createForm($formType, $entity); - $this->btnInstance()->addBtnSave($form->getName(), 'Ajouter'); + $this->btnInstance()->addBtnSave( + $form->getName(), + empty($entity->getId()) ? 'Ajouter' : 'Sauvegarder' + ); $form->handleRequest($this->get('request_stack')->getCurrentRequest()); if ($form->isSubmitted() && $form->isValid()) { $this->upload($uploadAnnotReader, $attachmentRepository, $attachmentRH, $entity); $handler->handle($oldEntity, $entity); + $this->flashBagAdd( + 'success', + $this->translator->trans('data.save') + ); if (isset($url['list'])) { return new RedirectResponse( $this->generateUrl($url['list']) @@ -74,30 +83,18 @@ public function create( public function listOrTrash( ServiceEntityRepositoryLib $repository, - array $methods, - string $html, - array $url = [], - array $actions = [] + string $html ): Response { + $methods = $this->getMethodsList(); + $url = $this->getUrlAdmin(); $request = $this->get('request_stack')->getCurrentRequest(); $all = $request->attributes->all(); $route = $all['_route']; $routeParams = $all['_route_params']; $routeType = (0 != substr_count($route, 'trash')) ? 'trash' : 'all'; $method = $methods[$routeType]; - - if ('trash' == $routeType) { - $this->listOrTrashRouteTrash($url, $actions, $repository); - } elseif (isset($url['trash'])) { - $this->setTrashIcon($methods, $repository, $url, $actions); - } - - if (isset($url['new']) && 'trash' != $routeType) { - $this->btnInstance()->addBtnNew( - $url['new'] - ); - } + $this->addNewImport($repository, $methods, $routeType, $url); if ('trash' != $routeType) { $this->btnInstance()->addSupprimerSelection( @@ -123,9 +120,11 @@ public function listOrTrash( ); } + $query = $this->get('request_stack')->getCurrentRequest()->query; + $get = $query->all(); $pagination = $this->paginator->paginate( - $repository->{$method}(), - $this->get('request_stack')->getCurrentRequest()->query->getInt('page', 1), + $repository->{$method}($get), + $query->getInt('page', 1), 10 ); @@ -133,12 +132,32 @@ public function listOrTrash( throw new AccessDeniedException(); } + $parameters = [ + 'pagination' => $pagination, + 'actions' => $url, + ]; + $search = $this->searchForm(); + if (0 != count($search) && array_key_exists('form', $search) && array_key_exists('data', $search)) { + $get = $query->all(); + $data = $search['data']; + $data->search($get, $this->getDoctrine()); + $route = $this->get('request_stack')->getCurrentRequest()->get('_route'); + $url = $this->generateUrl($route); + $searchForm = $this->createForm( + $search['form'], + $data, + [ + 'attr' => ['id' => 'searchform'], + 'action' => $url, + ] + ); + + $parameters['searchform'] = $searchForm->createView(); + } + return $this->render( $html, - [ - 'pagination' => $pagination, - 'actions' => $actions, - ] + $parameters ); } @@ -186,10 +205,10 @@ public function render( public function renderShowOrPreview( object $entity, - string $twigShow, - array $url = [] + string $twigShow ): Response { + $url = $this->getUrlAdmin(); $routeCurrent = $this->get('request_stack')->getCurrentRequest()->get('_route'); $routeType = (0 != substr_count($routeCurrent, 'preview')) ? 'preview' : 'show'; $this->showOrPreviewadd($url, $routeType, $entity); @@ -223,46 +242,6 @@ public function renderShowOrPreview( ); } - public function update( - UploadAnnotationReader $uploadAnnotReader, - AttachmentRepository $attachmentRepository, - AttachmentRequestHandler $attachmentRH, - RequestHandlerLib $handler, - string $formType, - object $entity, - array $url = [], - string $twig = 'admin/crud/form.html.twig' - ): Response - { - $this->denyAccessUnlessGranted('edit', $entity); - $this->setBtnViewUpdate($url, $entity); - $oldEntity = clone $entity; - $form = $this->createForm($formType, $entity); - $this->btnInstance()->addBtnSave($form->getName(), 'Sauvegarder'); - $form->handleRequest($this->get('request_stack')->getCurrentRequest()); - if ($form->isSubmitted() && $form->isValid()) { - $this->upload($uploadAnnotReader, $attachmentRepository, $attachmentRH, $entity); - $handler->handle($oldEntity, $entity); - $this->flashBagAdd( - 'success', - $this->translator->trans('data.save') - ); - if (isset($url['list'])) { - return new RedirectResponse( - $this->generateUrl($url['list']) - ); - } - } - - return $this->render( - $twig, - [ - 'entity' => $entity, - 'form' => $form->createView(), - ] - ); - } - protected function btnInstance() { if (is_null($this->btns)) { @@ -304,6 +283,19 @@ protected function enableBtnGuard($entity): bool return (0 != count($routes)) ? true : false; } + protected function getMethodsList(): array + { + return [ + 'trash' => 'findTrashForAdmin', + 'all' => 'findAllForAdmin', + ]; + } + + protected function getUrlAdmin(): array + { + return []; + } + protected function isRouteEnable( string $route ) @@ -315,7 +307,6 @@ protected function isRouteEnable( protected function listOrTrashRouteTrash( array $url, - array $actions, ServiceEntityRepositoryLib $repository ) { @@ -345,8 +336,8 @@ protected function listOrTrashRouteTrash( $twig = $this->get('twig'); $globals = $twig->getGlobals(); $modal = $globals['modal'] ?? []; - $modal['destroy'] = (isset($actions['destroy'])); - $modal['restore'] = (isset($actions['restore'])); + $modal['destroy'] = (isset($url['destroy'])); + $modal['restore'] = (isset($url['restore'])); $twig->addGlobal('modal', $modal); $request = $this->get('request_stack')->getCurrentRequest(); @@ -399,6 +390,11 @@ protected function listOrTrashRouteTrash( ); } + protected function searchForm(): array + { + return []; + } + protected function setAttachment( AttachmentRepository $attachmentRepository, $accessor, @@ -534,6 +530,10 @@ protected function setBtnViewUpdate( object $entity ): void { + if (empty($entity->getId())) { + return; + } + $this->setBtnList($url); $this->setBtnShow($url, $entity); $this->setBtnGuard($url, $entity); @@ -550,16 +550,18 @@ protected function setHeaderTitle(): array protected function setTrashIcon( $methods, $repository, - $url, - $actions + $url ) { + /** @var EntityManager $entityManager */ $entityManager = $this->getDoctrine()->getManager(); $methodTrash = $methods['trash']; - $entityManager->getFilters()->disable('softdeleteable'); - $total = $repository->{$methodTrash}(); - $entityManager->getFilters()->enable('softdeleteable'); - if (0 != count($total)) { + $filters = $entityManager->getFilters(); + $filters->disable('softdeleteable'); + $trash = $repository->{$methodTrash}([]); + $total = count($trash->getQuery()->getResult()); + $filters->enable('softdeleteable'); + if (0 != $total) { $this->btnInstance()->addBtnTrash( $url['trash'] ); @@ -568,8 +570,8 @@ protected function setTrashIcon( $twig = $this->get('twig'); $globals = $twig->getGlobals(); $modal = $globals['modal'] ?? []; - $modal['delete'] = (isset($actions['delete'])); - $modal['workflow'] = (isset($actions['workflow'])); + $modal['delete'] = (isset($url['delete'])); + $modal['workflow'] = (isset($url['workflow'])); $twig->addGlobal('modal', $modal); } @@ -733,4 +735,30 @@ protected function upload( $accessor->setValue($entity, $annotation->getFilename(), $attachment); } } + + private function addNewImport( + ServiceEntityRepositoryLib $repository, + array $methods, + string $routeType, + array $url = [], + ) + { + if ('trash' == $routeType) { + $this->listOrTrashRouteTrash($url, $repository); + } elseif (isset($url['trash'])) { + $this->setTrashIcon($methods, $repository, $url); + } + + if (isset($url['new']) && 'trash' != $routeType) { + $this->btnInstance()->addBtnNew( + $url['new'] + ); + } + + if (isset($url['import']) && 'trash' != $routeType) { + $this->btnInstance()->addBtnImport( + $url['import'] + ); + } + } } diff --git a/apps/src/Lib/ServiceEntityRepositoryLib.php b/apps/src/Lib/ServiceEntityRepositoryLib.php index 9a573f92e..efcb4bf28 100644 --- a/apps/src/Lib/ServiceEntityRepositoryLib.php +++ b/apps/src/Lib/ServiceEntityRepositoryLib.php @@ -3,23 +3,15 @@ namespace Labstag\Lib; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; -use Doctrine\ORM\Query; +use Doctrine\ORM\QueryBuilder; abstract class ServiceEntityRepositoryLib extends ServiceEntityRepository { - public function findAllForAdmin(): Query + public function findAllForAdmin(array $get): QueryBuilder { - $methods = get_class_methods($this); - $name = ''; - - if (in_array('getClassMetadata', $methods)) { - $name = $this->getClassMetadata()->getName(); - } - - $dql = 'SELECT a FROM '.$name.' a'; - $entityManager = $this->getEntityManager(); + $queryBuilder = $this->createQueryBuilder('a'); - return $entityManager->createQuery($dql); + return $this->setQuery($queryBuilder, $get); } /** @@ -38,22 +30,15 @@ public function findOneRandom() return $query->getOneOrNullResult(); } - public function findTrashForAdmin(): array + public function findTrashForAdmin(array $get): QueryBuilder { - $methods = get_class_methods($this); - $name = ''; + $queryBuilder = $this->createQueryBuilder('a'); - if (in_array('getClassMetadata', $methods)) { - $name = $this->getClassMetadata()->getName(); - } - - $entityManager = $this->getEntityManager(); - $dql = $entityManager->createQueryBuilder(); - $dql->select('a'); - $dql->from($name, 'a'); - $dql->where('a.deletedAt IS NOT NULL'); + $query = $queryBuilder->where( + 'a.deletedAt IS NOT NULL' + ); - return $dql->getQuery()->getResult(); + return $this->setQuery($query, $get); } protected function getClassMetadataName(): string @@ -66,4 +51,11 @@ protected function getClassMetadataName(): string return $name; } + + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder + { + unset($get); + + return $query; + } } diff --git a/apps/src/Queue/Handler/ServiceMethodMessageHandler.php b/apps/src/Queue/Handler/ServiceMethodMessageHandler.php index cd6c0f1a0..7a92b259b 100644 --- a/apps/src/Queue/Handler/ServiceMethodMessageHandler.php +++ b/apps/src/Queue/Handler/ServiceMethodMessageHandler.php @@ -3,6 +3,7 @@ namespace Labstag\Queue\Handler; use Labstag\Queue\Message\ServiceMethodMessage; +use Labstag\Service\BookmarkService; use Psr\Container\ContainerInterface; use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Messenger\Handler\MessageHandlerInterface; @@ -33,6 +34,7 @@ public static function getSubscribedServices() { return [ MailerInterface::class => MailerInterface::class, + BookmarkService::class => BookmarkService::class, ]; } } diff --git a/apps/src/Repository/AdresseUserRepository.php b/apps/src/Repository/AdresseUserRepository.php index 711b03ddc..ba91f6c2a 100644 --- a/apps/src/Repository/AdresseUserRepository.php +++ b/apps/src/Repository/AdresseUserRepository.php @@ -2,7 +2,7 @@ namespace Labstag\Repository; -use Doctrine\ORM\Query; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\AdresseUser; @@ -17,28 +17,50 @@ public function __construct(ManagerRegistry $registry) parent::__construct($registry, AdresseUser::class); } - public function findAllForAdmin(): Query + public function findAllForAdmin(array $get): QueryBuilder { $queryBuilder = $this->createQueryBuilder('a'); - $query = $queryBuilder->leftJoin('a.refuser', 'u'); - $query->where( - 'u.id IS NOT NULL' - ); - return $query->getQuery(); + return $this->setQuery($queryBuilder, $get); } - public function findTrashForAdmin(): array + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder { - $queryBuilder = $this->createQueryBuilder('a'); - $query = $queryBuilder->leftJoin( - 'a.refuser', - 'u' - ); - $query->where( - 'u.deletedAt IS NOT NULL OR a.deletedAt IS NOT NULL' - ); - - return $query->getQuery()->getResult(); + $this->setQueryCountry($query, $get); + $this->setQueryVille($query, $get); + $this->setQueryRefUser($query, $get); + + return $query; + } + + protected function setQueryCountry(QueryBuilder &$query, array $get) + { + if (!isset($get['country']) || empty($get['country'])) { + return; + } + + $query->andWhere('a.country LIKE :country'); + $query->setParameter('country', '%'.$get['country'].'%'); + } + + protected function setQueryRefUser(QueryBuilder &$query, array $get) + { + if (!isset($get['refuser']) || empty($get['refuser'])) { + return; + } + + $query->leftJoin('a.refuser', 'u'); + $query->andWhere('u.id = :refuser'); + $query->setParameter('refuser', $get['refuser']); + } + + protected function setQueryVille(QueryBuilder &$query, array $get) + { + if (!isset($get['ville']) || empty($get['ville'])) { + return; + } + + $query->andWhere('a.ville LIKE :ville'); + $query->setParameter('ville', '%'.$get['ville'].'%'); } } diff --git a/apps/src/Repository/BookmarkRepository.php b/apps/src/Repository/BookmarkRepository.php index cfc3c274b..bcbef541c 100644 --- a/apps/src/Repository/BookmarkRepository.php +++ b/apps/src/Repository/BookmarkRepository.php @@ -2,6 +2,7 @@ namespace Labstag\Repository; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\Bookmark; @@ -65,4 +66,56 @@ public function findPublierLibelle($code) return $query->getQuery(); } + + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder + { + $this->setQueryEtape($query, $get); + $this->setQueryName($query, $get); + $this->setQueryRefUser($query, $get); + $this->setQueryRefCategory($query, $get); + + return $query; + } + + protected function setQueryEtape(QueryBuilder &$query, array $get) + { + if (!isset($get['etape']) || empty($get['etape'])) { + return; + } + + $query->andWhere('a.state LIKE :state'); + $query->setParameter('state', '%'.$get['etape'].'%'); + } + + protected function setQueryName(QueryBuilder &$query, array $get) + { + if (!isset($get['name']) || empty($get['name'])) { + return; + } + + $query->andWhere('a.name LIKE :name'); + $query->setParameter('name', '%'.$get['name'].'%'); + } + + protected function setQueryRefCategory(QueryBuilder &$query, array $get) + { + if (!isset($get['refcategory']) || empty($get['refcategory'])) { + return; + } + + $query->leftJoin('a.refcategory', 'u'); + $query->andWhere('u.id = :refcategory'); + $query->setParameter('refcategory', $get['refcategory']); + } + + protected function setQueryRefUser(QueryBuilder &$query, array $get) + { + if (!isset($get['refuser']) || empty($get['refuser'])) { + return; + } + + $query->leftJoin('a.refuser', 'u'); + $query->andWhere('u.id = :refuser'); + $query->setParameter('refuser', $get['refuser']); + } } diff --git a/apps/src/Repository/CategoryRepository.php b/apps/src/Repository/CategoryRepository.php index 1c64f710d..869a100bc 100644 --- a/apps/src/Repository/CategoryRepository.php +++ b/apps/src/Repository/CategoryRepository.php @@ -2,6 +2,7 @@ namespace Labstag\Repository; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\Category; @@ -17,69 +18,78 @@ public function __construct(ManagerRegistry $registry) parent::__construct($registry, Category::class); } - public function findAllParentForAdmin() + public function findAllParentForAdmin(array $get): QueryBuilder { - $methods = get_class_methods($this); - $name = ''; + $queryBuilder = $this->createQueryBuilder('a'); + $query = $queryBuilder->where('a.parent IS NULL'); - if (in_array('getClassMetadata', $methods)) { - $name = $this->getClassMetadata()->getName(); - } - - $dql = 'SELECT a FROM '.$name.' a WHERE a.parent IS NULL'; - $entityManager = $this->getEntityManager(); - - return $entityManager->createQuery($dql); + return $this->setQuery($query, $get); } public function findByBookmark() { - $entityManager = $this->getEntityManager(); - $dql = $entityManager->createQueryBuilder(); - $dql->select('a'); - $dql->from(Category::class, 'a'); - $dql->leftJoin('a.bookmarks', 'b'); - $dql->innerjoin('b.refuser', 'u'); - $dql->where('b.state LIKE :state'); - $dql->setParameters( + $queryBuilder = $this->createQueryBuilder('a'); + $query = $queryBuilder->leftJoin('a.bookmarks', 'b'); + $query->innerjoin('b.refuser', 'u'); + $query->where('b.state LIKE :state'); + $query->setParameters( ['state' => '%publie%'] ); - return $dql->getQuery()->getResult(); + return $query->getQuery()->getResult(); } public function findByPost() { - $entityManager = $this->getEntityManager(); - $dql = $entityManager->createQueryBuilder(); - $dql->select('a'); - $dql->from(Category::class, 'a'); - $dql->leftJoin('a.posts', 'p'); - $dql->innerjoin('p.refuser', 'u'); - $dql->where('p.state LIKE :state'); - $dql->setParameters( + $queryBuilder = $this->createQueryBuilder('a'); + $query = $queryBuilder->leftJoin('a.posts', 'p'); + $query->innerjoin('p.refuser', 'u'); + $query->where('p.state LIKE :state'); + $query->setParameters( ['state' => '%publie%'] ); - return $dql->getQuery()->getResult(); + return $query->getQuery()->getResult(); } - public function findTrashParentForAdmin(): array + public function findName(string $field) { - $methods = get_class_methods($this); - $name = ''; + $queryBuilder = $this->createQueryBuilder('u'); + $query = $queryBuilder->where( + 'u.name LIKE :name' + ); + $query->setParameters( + [ + 'name' => '%'.$field.'%', + ] + ); - if (in_array('getClassMetadata', $methods)) { - $name = $this->getClassMetadata()->getName(); - } + return $query->getQuery()->getResult(); + } + + public function findTrashParentForAdmin(array $get): QueryBuilder + { + $queryBuilder = $this->createQueryBuilder('a'); + $query = $queryBuilder->where('a.deletedAt IS NOT NULL'); + $query->andwhere('a.parent IS NULL'); - $entityManager = $this->getEntityManager(); - $dql = $entityManager->createQueryBuilder(); - $dql->select('a'); - $dql->from($name, 'a'); - $dql->where('a.deletedAt IS NOT NULL'); - $dql->andwhere('a.parent IS NULL'); + return $this->setQuery($query, $get); + } + + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder + { + $this->setQueryName($query, $get); + + return $query; + } + + protected function setQueryName(QueryBuilder &$query, array $get) + { + if (!isset($get['name']) || empty($get['name'])) { + return; + } - return $dql->getQuery()->getResult(); + $query->andWhere('a.name LIKE :name'); + $query->setParameter('name', '%'.$get['name'].'%'); } } diff --git a/apps/src/Repository/EditoRepository.php b/apps/src/Repository/EditoRepository.php index 0fa7b8dec..7e8e1470c 100644 --- a/apps/src/Repository/EditoRepository.php +++ b/apps/src/Repository/EditoRepository.php @@ -2,7 +2,7 @@ namespace Labstag\Repository; -use Doctrine\ORM\Query; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\Edito; @@ -18,18 +18,11 @@ public function __construct(ManagerRegistry $registry) parent::__construct($registry, Edito::class); } - public function findAllForAdmin(): Query + public function findAllForAdmin(array $get): QueryBuilder { $queryBuilder = $this->createQueryBuilder('a'); - $query = $queryBuilder->leftJoin( - 'a.refuser', - 'u' - ); - $query->where( - 'u.id IS NOT NULL' - ); - return $query->getQuery(); + return $this->setQuery($queryBuilder, $get); } public function findOnePublier() @@ -49,17 +42,54 @@ public function findOnePublier() return $query->getQuery()->getOneOrNullResult(); } - public function findTrashForAdmin(): array + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder { - $queryBuilder = $this->createQueryBuilder('a'); - $query = $queryBuilder->leftJoin( - 'a.refuser', - 'u' - ); - $query->where( - 'u.deletedAt IS NOT NULL OR a.deletedAt IS NOT NULL' - ); + $this->setQueryEtape($query, $get); + $this->setQueryPublished($query, $get); + $this->setQueryTitle($query, $get); + $this->setQueryRefUser($query, $get); + + return $query; + } + + protected function setQueryEtape(QueryBuilder &$query, array $get) + { + if (!isset($get['etape']) || empty($get['etape'])) { + return; + } + + $query->andWhere('a.state LIKE :state'); + $query->setParameter('state', '%'.$get['etape'].'%'); + } + + protected function setQueryPublished(QueryBuilder &$query, array $get) + { + if (!isset($get['published']) || empty($get['published'])) { + return; + } + + $query->andWhere('DATE(a.published) = :published'); + $query->setParameter('published', $get['published']); + } + + protected function setQueryRefUser(QueryBuilder &$query, array $get) + { + if (!isset($get['refuser']) || empty($get['refuser'])) { + return; + } + + $query->leftJoin('a.refuser', 'u'); + $query->andWhere('u.id = :refuser'); + $query->setParameter('refuser', $get['refuser']); + } + + protected function setQueryTitle(QueryBuilder &$query, array $get) + { + if (!isset($get['title']) || empty($get['title'])) { + return; + } - return $query->getQuery()->getResult(); + $query->andWhere('a.title LIKE :title'); + $query->setParameter('title', '%'.$get['title'].'%'); } } diff --git a/apps/src/Repository/EmailUserRepository.php b/apps/src/Repository/EmailUserRepository.php index 912b99f94..86bdc4563 100644 --- a/apps/src/Repository/EmailUserRepository.php +++ b/apps/src/Repository/EmailUserRepository.php @@ -2,7 +2,7 @@ namespace Labstag\Repository; -use Doctrine\ORM\Query; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\EmailUser; @@ -18,32 +18,11 @@ public function __construct(ManagerRegistry $registry) parent::__construct($registry, EmailUser::class); } - public function findAllForAdmin(): Query + public function findAllForAdmin(array $get): QueryBuilder { $queryBuilder = $this->createQueryBuilder('a'); - $query = $queryBuilder->leftJoin( - 'a.refuser', - 'u' - ); - $query->where( - 'u.id IS NOT NULL' - ); - - return $query->getQuery(); - } - - public function findTrashForAdmin(): array - { - $queryBuilder = $this->createQueryBuilder('a'); - $query = $queryBuilder->leftJoin( - 'a.refuser', - 'u' - ); - $query->where( - 'u.deletedAt IS NOT NULL OR a.deletedAt IS NOT NULL' - ); - return $query->getQuery()->getResult(); + return $this->setQuery($queryBuilder, $get); } public function getEmailsUserVerif(User $user, bool $verif): array @@ -61,4 +40,22 @@ public function getEmailsUserVerif(User $user, bool $verif): array return $query->getQuery()->getResult(); } + + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder + { + $this->setQueryRefUser($query, $get); + + return $query; + } + + protected function setQueryRefUser(QueryBuilder &$query, array $get) + { + if (!isset($get['refuser']) || empty($get['refuser'])) { + return; + } + + $query->leftJoin('a.refuser', 'u'); + $query->andWhere('u.id = :refuser'); + $query->setParameter('refuser', $get['refuser']); + } } diff --git a/apps/src/Repository/GeoCodeRepository.php b/apps/src/Repository/GeoCodeRepository.php index 03249e608..748e7a1d0 100644 --- a/apps/src/Repository/GeoCodeRepository.php +++ b/apps/src/Repository/GeoCodeRepository.php @@ -2,6 +2,7 @@ namespace Labstag\Repository; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\GeoCode; @@ -16,4 +17,88 @@ public function __construct(ManagerRegistry $registry) { parent::__construct($registry, GeoCode::class); } + + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder + { + $this->setQueryCountryCode($query, $get); + $this->setQueryPostalCode($query, $get); + $this->setQueryPlaceName($query, $get); + $this->setQueryStateName($query, $get); + $this->setQueryProvinceName($query, $get); + $this->setQueryCommunityName($query, $get); + $this->setQueryRefUser($query, $get); + + return $query; + } + + protected function setQueryCommunityName(QueryBuilder &$query, array $get) + { + if (!isset($get['communityname']) || empty($get['communityname'])) { + return; + } + + $query->andWhere('a.communityName LIKE :communityname'); + $query->setParameter('communityname', '%'.$get['communityname'].'%'); + } + + protected function setQueryCountryCode(QueryBuilder &$query, array $get) + { + if (!isset($get['countrycode']) || empty($get['countrycode'])) { + return; + } + + $query->andWhere('a.countryCode LIKE :countrycode'); + $query->setParameter('countrycode', '%'.$get['countrycode'].'%'); + } + + protected function setQueryPlaceName(QueryBuilder &$query, array $get) + { + if (!isset($get['placename']) || empty($get['placename'])) { + return; + } + + $query->andWhere('a.placeName LIKE :placename'); + $query->setParameter('placename', '%'.$get['placename'].'%'); + } + + protected function setQueryPostalCode(QueryBuilder &$query, array $get) + { + if (!isset($get['postalcode']) || empty($get['postalcode'])) { + return; + } + + $query->andWhere('a.postalCode LIKE :postalcode'); + $query->setParameter('postalcode', '%'.$get['postalcode'].'%'); + } + + protected function setQueryProvinceName(QueryBuilder &$query, array $get) + { + if (!isset($get['provincename']) || empty($get['provincename'])) { + return; + } + + $query->andWhere('a.provinceName LIKE :provincename'); + $query->setParameter('provincename', '%'.$get['provincename'].'%'); + } + + protected function setQueryRefUser(QueryBuilder &$query, array $get) + { + if (!isset($get['refuser']) || empty($get['refuser'])) { + return; + } + + $query->leftJoin('a.refuser', 'u'); + $query->andWhere('u.id = :refuser'); + $query->setParameter('refuser', $get['refuser']); + } + + protected function setQueryStateName(QueryBuilder &$query, array $get) + { + if (!isset($get['statename']) || empty($get['statename'])) { + return; + } + + $query->andWhere('a.stateName LIKE :statename'); + $query->setParameter('statename', '%'.$get['statename'].'%'); + } } diff --git a/apps/src/Repository/GroupeRepository.php b/apps/src/Repository/GroupeRepository.php index 598be7a3d..136bda29d 100644 --- a/apps/src/Repository/GroupeRepository.php +++ b/apps/src/Repository/GroupeRepository.php @@ -2,6 +2,7 @@ namespace Labstag\Repository; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\Groupe; @@ -16,4 +17,36 @@ public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Groupe::class); } + + public function findName(string $field) + { + $queryBuilder = $this->createQueryBuilder('u'); + $query = $queryBuilder->where( + 'u.name LIKE :name' + ); + $query->setParameters( + [ + 'name' => '%'.$field.'%', + ] + ); + + return $query->getQuery()->getResult(); + } + + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder + { + $this->setQueryName($query, $get); + + return $query; + } + + protected function setQueryName(QueryBuilder &$query, array $get) + { + if (!isset($get['name']) || empty($get['name'])) { + return; + } + + $query->andWhere('a.name LIKE :name'); + $query->setParameter('name', '%'.$get['name'].'%'); + } } diff --git a/apps/src/Repository/LibelleRepository.php b/apps/src/Repository/LibelleRepository.php index af2af76cd..741fc7c5b 100644 --- a/apps/src/Repository/LibelleRepository.php +++ b/apps/src/Repository/LibelleRepository.php @@ -2,6 +2,7 @@ namespace Labstag\Repository; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\Libelle; @@ -19,34 +20,29 @@ public function __construct(ManagerRegistry $registry) public function findByBookmark() { - $entityManager = $this->getEntityManager(); - $dql = $entityManager->createQueryBuilder(); - $dql->select('a'); - $dql->from(Libelle::class, 'a'); - $dql->innerJoin('a.bookmarks', 'b'); - $dql->innerjoin('b.refuser', 'u'); - $dql->where('b.state LIKE :state'); - $dql->setParameters( + $queryBuilder = $this->createQueryBuilder('a'); + $query = $queryBuilder->from(Libelle::class, 'a'); + $query->innerJoin('a.bookmarks', 'b'); + $query->innerjoin('b.refuser', 'u'); + $query->where('b.state LIKE :state'); + $query->setParameters( ['state' => '%publie%'] ); - return $dql->getQuery()->getResult(); + return $query->getQuery()->getResult(); } public function findByPost() { - $entityManager = $this->getEntityManager(); - $dql = $entityManager->createQueryBuilder(); - $dql->select('a'); - $dql->from(Libelle::class, 'a'); - $dql->innerJoin('a.posts', 'p'); - $dql->innerjoin('p.refuser', 'u'); - $dql->where('p.state LIKE :state'); - $dql->setParameters( + $queryBuilder = $this->createQueryBuilder('a'); + $query = $queryBuilder->innerJoin('a.posts', 'p'); + $query->innerjoin('p.refuser', 'u'); + $query->where('p.state LIKE :state'); + $query->setParameters( ['state' => '%publie%'] ); - return $dql->getQuery()->getResult(); + return $query->getQuery()->getResult(); } public function findNom(string $field) @@ -63,4 +59,21 @@ public function findNom(string $field) return $query->getQuery()->getResult(); } + + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder + { + $this->setQueryNom($query, $get); + + return $query; + } + + protected function setQueryNom(QueryBuilder &$query, array $get) + { + if (!isset($get['nom']) || empty($get['nom'])) { + return; + } + + $query->andWhere('a.nom LIKE :nom'); + $query->setParameter('nom', '%'.$get['nom'].'%'); + } } diff --git a/apps/src/Repository/LienUserRepository.php b/apps/src/Repository/LienUserRepository.php index 9b3efc6fc..f0dc0e2fa 100644 --- a/apps/src/Repository/LienUserRepository.php +++ b/apps/src/Repository/LienUserRepository.php @@ -2,7 +2,7 @@ namespace Labstag\Repository; -use Doctrine\ORM\Query; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\LienUser; @@ -17,31 +17,28 @@ public function __construct(ManagerRegistry $registry) parent::__construct($registry, LienUser::class); } - public function findAllForAdmin(): Query + public function findAllForAdmin(array $get): QueryBuilder { $queryBuilder = $this->createQueryBuilder('a'); - $query = $queryBuilder->leftJoin( - 'a.refuser', - 'u' - ); - $query->where( - 'u.id IS NOT NULL' - ); - - return $query->getQuery(); + + return $this->setQuery($queryBuilder, $get); } - public function findTrashForAdmin(): array + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder { - $queryBuilder = $this->createQueryBuilder('a'); - $query = $queryBuilder->leftJoin( - 'a.refuser', - 'u' - ); - $query->where( - 'u.deletedAt IS NOT NULL OR a.deletedAt IS NOT NULL' - ); - - return $query->getQuery()->getResult(); + $this->setQueryRefUser($query, $get); + + return $query; + } + + protected function setQueryRefUser(QueryBuilder &$query, array $get) + { + if (!isset($get['refuser']) || empty($get['refuser'])) { + return; + } + + $query->leftJoin('a.refuser', 'u'); + $query->andWhere('u.id = :refuser'); + $query->setParameter('refuser', $get['refuser']); } } diff --git a/apps/src/Repository/MenuRepository.php b/apps/src/Repository/MenuRepository.php index af11b1f40..e865c9ce8 100644 --- a/apps/src/Repository/MenuRepository.php +++ b/apps/src/Repository/MenuRepository.php @@ -20,7 +20,6 @@ public function __construct(ManagerRegistry $registry) public function findAllCode() { $queryBuilder = $this->createQueryBuilder('u'); - $query = $queryBuilder->select('u'); $query = $queryBuilder->where( 'u.position=0' ); diff --git a/apps/src/Repository/NoteInterneRepository.php b/apps/src/Repository/NoteInterneRepository.php index 76c2f913c..fc738b29b 100644 --- a/apps/src/Repository/NoteInterneRepository.php +++ b/apps/src/Repository/NoteInterneRepository.php @@ -2,7 +2,7 @@ namespace Labstag\Repository; -use Doctrine\ORM\Query; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\NoteInterne; @@ -18,18 +18,11 @@ public function __construct(ManagerRegistry $registry) parent::__construct($registry, NoteInterne::class); } - public function findAllForAdmin(): Query + public function findAllForAdmin(array $get): QueryBuilder { $queryBuilder = $this->createQueryBuilder('a'); - $query = $queryBuilder->leftJoin( - 'a.refuser', - 'u' - ); - $query->where( - 'u.id IS NOT NULL' - ); - return $query->getQuery(); + return $this->setQuery($queryBuilder, $get); } public function findPublier() @@ -50,17 +43,65 @@ public function findPublier() return $query->getQuery()->getResult(); } - public function findTrashForAdmin(): array + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder { - $queryBuilder = $this->createQueryBuilder('a'); - $query = $queryBuilder->leftJoin( - 'a.refuser', - 'u' - ); - $query->where( - 'u.deletedAt IS NOT NULL OR a.deletedAt IS NOT NULL' - ); + $this->setQueryEtape($query, $get); + $this->setQueryDateDebut($query, $get); + $this->setQueryDateFin($query, $get); + $this->setQueryTitle($query, $get); + $this->setQueryRefUser($query, $get); - return $query->getQuery()->getResult(); + return $query; + } + + protected function setQueryDateDebut(QueryBuilder &$query, array $get) + { + if (!isset($get['date_debut']) || empty($get['date_debut'])) { + return; + } + + $query->andWhere('DATE(a.dateDebut) = :date_debut'); + $query->setParameter('date_debut', $get['date_debut']); + } + + protected function setQueryDateFin(QueryBuilder &$query, array $get) + { + if (!isset($get['date_fin']) || empty($get['date_fin'])) { + return; + } + + $query->andWhere('DATE(a.dateFin) = :date_fin'); + $query->setParameter('date_fin', $get['date_fin']); + } + + protected function setQueryEtape(QueryBuilder &$query, array $get) + { + if (!isset($get['etape']) || empty($get['etape'])) { + return; + } + + $query->andWhere('a.state LIKE :state'); + $query->setParameter('state', '%'.$get['etape'].'%'); + } + + protected function setQueryRefUser(QueryBuilder &$query, array $get) + { + if (!isset($get['refuser']) || empty($get['refuser'])) { + return; + } + + $query->leftJoin('a.refuser', 'u'); + $query->andWhere('u.id = :refuser'); + $query->setParameter('refuser', $get['refuser']); + } + + protected function setQueryTitle(QueryBuilder &$query, array $get) + { + if (!isset($get['title']) || empty($get['title'])) { + return; + } + + $query->andWhere('a.title LIKE :title'); + $query->setParameter('title', '%'.$get['title'].'%'); } } diff --git a/apps/src/Repository/PhoneUserRepository.php b/apps/src/Repository/PhoneUserRepository.php index 4e56d4e69..3921fd6ea 100644 --- a/apps/src/Repository/PhoneUserRepository.php +++ b/apps/src/Repository/PhoneUserRepository.php @@ -2,7 +2,7 @@ namespace Labstag\Repository; -use Doctrine\ORM\Query; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\PhoneUser; @@ -17,31 +17,39 @@ public function __construct(ManagerRegistry $registry) parent::__construct($registry, PhoneUser::class); } - public function findAllForAdmin(): Query + public function findAllForAdmin(array $get): QueryBuilder { $queryBuilder = $this->createQueryBuilder('a'); - $query = $queryBuilder->leftJoin( - 'a.refuser', - 'u' - ); - $query->where( - 'u.id IS NOT NULL' - ); - - return $query->getQuery(); + + return $this->setQuery($queryBuilder, $get); } - public function findTrashForAdmin(): array + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder { - $queryBuilder = $this->createQueryBuilder('a'); - $query = $queryBuilder->leftJoin( - 'a.refuser', - 'u' - ); - $query->where( - 'u.deletedAt IS NOT NULL OR a.deletedAt IS NOT NULL' - ); - - return $query->getQuery()->getResult(); + $this->setQueryCountry($query, $get); + $this->setQueryRefUser($query, $get); + + return $query; + } + + protected function setQueryCountry(QueryBuilder &$query, array $get) + { + if (!isset($get['country']) || empty($get['country'])) { + return; + } + + $query->andWhere('a.country LIKE :country'); + $query->setParameter('country', '%'.$get['country'].'%'); + } + + protected function setQueryRefUser(QueryBuilder &$query, array $get) + { + if (!isset($get['refuser']) || empty($get['refuser'])) { + return; + } + + $query->leftJoin('a.refuser', 'u'); + $query->andWhere('u.id = :refuser'); + $query->setParameter('refuser', $get['refuser']); } } diff --git a/apps/src/Repository/PostRepository.php b/apps/src/Repository/PostRepository.php index 8d1897a4d..492c39888 100644 --- a/apps/src/Repository/PostRepository.php +++ b/apps/src/Repository/PostRepository.php @@ -2,6 +2,7 @@ namespace Labstag\Repository; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\Post; @@ -20,8 +21,7 @@ public function __construct(ManagerRegistry $registry) public function findDateArchive() { $queryBuilder = $this->createQueryBuilder('p'); - $query = $queryBuilder->innerjoin('p.refuser', 'u'); - $query->select( + $query = $queryBuilder->select( 'date_format(p.published,\'%Y-%m\') as code, p.published, COUNT(p)' ); $query->where( @@ -119,4 +119,67 @@ public function findPublierUsername($username) return $query->getQuery(); } + + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder + { + $this->setQueryEtape($query, $get); + $this->setQueryPublished($query, $get); + $this->setQueryTitle($query, $get); + $this->setQueryRefUser($query, $get); + $this->setQueryRefCategory($query, $get); + + return $query; + } + + protected function setQueryEtape(QueryBuilder &$query, array $get) + { + if (!isset($get['etape']) || empty($get['etape'])) { + return; + } + + $query->andWhere('a.state LIKE :state'); + $query->setParameter('state', '%'.$get['etape'].'%'); + } + + protected function setQueryPublished(QueryBuilder &$query, array $get) + { + if (!isset($get['published']) || empty($get['published'])) { + return; + } + + $query->andWhere('DATE(a.published) = :published'); + $query->setParameter('published', $get['published']); + } + + protected function setQueryRefCategory(QueryBuilder &$query, array $get) + { + if (!isset($get['refcategory']) || empty($get['refcategory'])) { + return; + } + + $query->leftJoin('a.refcategory', 'u'); + $query->andWhere('u.id = :refcategory'); + $query->setParameter('refcategory', $get['refcategory']); + } + + protected function setQueryRefUser(QueryBuilder &$query, array $get) + { + if (!isset($get['refuser']) || empty($get['refuser'])) { + return; + } + + $query->leftJoin('a.refuser', 'u'); + $query->andWhere('u.id = :refuser'); + $query->setParameter('refuser', $get['refuser']); + } + + protected function setQueryTitle(QueryBuilder &$query, array $get) + { + if (!isset($get['title']) || empty($get['title'])) { + return; + } + + $query->andWhere('a.title LIKE :title'); + $query->setParameter('title', '%'.$get['title'].'%'); + } } diff --git a/apps/src/Repository/TemplateRepository.php b/apps/src/Repository/TemplateRepository.php index daa3f9e86..242427eb3 100644 --- a/apps/src/Repository/TemplateRepository.php +++ b/apps/src/Repository/TemplateRepository.php @@ -2,6 +2,7 @@ namespace Labstag\Repository; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\Template; @@ -16,4 +17,21 @@ public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Template::class); } + + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder + { + $this->setQueryName($query, $get); + + return $query; + } + + protected function setQueryName(QueryBuilder &$query, array $get) + { + if (!isset($get['name']) || empty($get['name'])) { + return; + } + + $query->andWhere('a.name LIKE :name'); + $query->setParameter('name', '%'.$get['name'].'%'); + } } diff --git a/apps/src/Repository/UserRepository.php b/apps/src/Repository/UserRepository.php index d3a7f822d..493092c08 100644 --- a/apps/src/Repository/UserRepository.php +++ b/apps/src/Repository/UserRepository.php @@ -2,6 +2,7 @@ namespace Labstag\Repository; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\User; @@ -51,4 +52,43 @@ public function findUserName(string $field) return $query->getQuery()->getResult(); } + + protected function setQuery(QueryBuilder $query, array $get): QueryBuilder + { + $this->setQueryEtape($query, $get); + $this->setQueryUsername($query, $get); + $this->setQueryEmail($query, $get); + + return $query; + } + + protected function setQueryEmail(QueryBuilder &$query, array $get) + { + if (!isset($get['email']) || empty($get['email'])) { + return; + } + + $query->andWhere('a.email = :email'); + $query->setParameter('email', $get['email']); + } + + protected function setQueryEtape(QueryBuilder &$query, array $get) + { + if (!isset($get['etape']) || empty($get['etape'])) { + return; + } + + $query->andWhere('a.state LIKE :state'); + $query->setParameter('state', '%'.$get['etape'].'%'); + } + + protected function setQueryUsername(QueryBuilder &$query, array $get) + { + if (!isset($get['username']) || empty($get['username'])) { + return; + } + + $query->andWhere('a.username LIKE :username'); + $query->setParameter('username', '%'.$get['username'].'%'); + } } diff --git a/apps/src/Search/BookmarkSearch.php b/apps/src/Search/BookmarkSearch.php new file mode 100644 index 000000000..773953d26 --- /dev/null +++ b/apps/src/Search/BookmarkSearch.php @@ -0,0 +1,29 @@ +getRepository(User::class); + $categoryRepo = $doctrine->getRepository(Category::class); + foreach ($get as $key => $value) { + $this->{$key} = $value; + $this->{$key} = ('refuser' == $key) ? $userRepo->find($value) : $this->{$key}; + $this->{$key} = ('refcategory' == $key) ? $categoryRepo->find($value) : $this->{$key}; + } + } +} diff --git a/apps/src/Search/CategorySearch.php b/apps/src/Search/CategorySearch.php new file mode 100644 index 000000000..69c927ecb --- /dev/null +++ b/apps/src/Search/CategorySearch.php @@ -0,0 +1,17 @@ + $value) { + $this->{$key} = $value; + } + } +} diff --git a/apps/src/Search/EditoSearch.php b/apps/src/Search/EditoSearch.php new file mode 100644 index 000000000..81e9f31e4 --- /dev/null +++ b/apps/src/Search/EditoSearch.php @@ -0,0 +1,46 @@ +getRepository(User::class); + foreach ($get as $key => $value) { + $this->{$key} = $value; + if ('published' == $key) { + if (!empty($value)) { + [ + $year, + $month, + $day, + ] = explode('-', $value); + $date->setDate($year, $month, $day); + $this->{$key} = $date; + + continue; + } + + $this->{$key} = null; + + continue; + } + + $this->{$key} = ('refuser' == $key) ? $userRepo->find($value) : $this->{$key}; + } + } +} diff --git a/apps/src/Search/GeocodeSearch.php b/apps/src/Search/GeocodeSearch.php new file mode 100644 index 000000000..00ccd2d62 --- /dev/null +++ b/apps/src/Search/GeocodeSearch.php @@ -0,0 +1,27 @@ + $value) { + $this->{$key} = $value; + } + } +} diff --git a/apps/src/Search/GroupeSearch.php b/apps/src/Search/GroupeSearch.php new file mode 100644 index 000000000..fb9845a01 --- /dev/null +++ b/apps/src/Search/GroupeSearch.php @@ -0,0 +1,17 @@ + $value) { + $this->{$key} = $value; + } + } +} diff --git a/apps/src/Search/LibelleSearch.php b/apps/src/Search/LibelleSearch.php new file mode 100644 index 000000000..d82322cc8 --- /dev/null +++ b/apps/src/Search/LibelleSearch.php @@ -0,0 +1,17 @@ + $value) { + $this->{$key} = $value; + } + } +} diff --git a/apps/src/Search/NoteInterneSearch.php b/apps/src/Search/NoteInterneSearch.php new file mode 100644 index 000000000..9b0867648 --- /dev/null +++ b/apps/src/Search/NoteInterneSearch.php @@ -0,0 +1,48 @@ +getRepository(User::class); + foreach ($get as $key => $value) { + $this->{$key} = $value; + if ('dateDebut' == $key || 'dateFin' == $key) { + if (!empty($value)) { + [ + $year, + $month, + $day, + ] = explode('-', $value); + $date->setDate($year, $month, $day); + $this->{$key} = $date; + + continue; + } + + $this->{$key} = null; + + continue; + } + + $this->{$key} = ('refuser' == $key) ? $userRepo->find($value) : $this->{$key}; + } + } +} diff --git a/apps/src/Search/PostSearch.php b/apps/src/Search/PostSearch.php new file mode 100644 index 000000000..00a89f7b8 --- /dev/null +++ b/apps/src/Search/PostSearch.php @@ -0,0 +1,51 @@ +getRepository(User::class); + $categoryRepo = $doctrine->getRepository(Category::class); + foreach ($get as $key => $value) { + $this->{$key} = $value; + if ('published' == $key) { + if (!empty($value)) { + [ + $year, + $month, + $day, + ] = explode('-', $value); + $date->setDate($year, $month, $day); + $this->{$key} = $date; + + continue; + } + + $this->{$key} = null; + + continue; + } + + $this->{$key} = ('refuser' == $key) ? $userRepo->find($value) : $this->{$key}; + $this->{$key} = ('refcategory' == $key) ? $categoryRepo->find($value) : $this->{$key}; + } + } +} diff --git a/apps/src/Search/TemplateSearch.php b/apps/src/Search/TemplateSearch.php new file mode 100644 index 000000000..2b96b58ba --- /dev/null +++ b/apps/src/Search/TemplateSearch.php @@ -0,0 +1,17 @@ + $value) { + $this->{$key} = $value; + } + } +} diff --git a/apps/src/Search/User/AdresseUserSearch.php b/apps/src/Search/User/AdresseUserSearch.php new file mode 100644 index 000000000..c5fb7052e --- /dev/null +++ b/apps/src/Search/User/AdresseUserSearch.php @@ -0,0 +1,25 @@ +getRepository(User::class); + foreach ($get as $key => $value) { + $this->{$key} = $value; + + $this->{$key} = ('refuser' == $key) ? $userRepo->find($value) : $this->{$key}; + } + } +} diff --git a/apps/src/Search/User/EmailUserSearch.php b/apps/src/Search/User/EmailUserSearch.php new file mode 100644 index 000000000..3024a4335 --- /dev/null +++ b/apps/src/Search/User/EmailUserSearch.php @@ -0,0 +1,21 @@ +getRepository(User::class); + foreach ($get as $key => $value) { + $this->{$key} = $value; + + $this->{$key} = ('refuser' == $key) ? $userRepo->find($value) : $this->{$key}; + } + } +} diff --git a/apps/src/Search/User/LienUserSearch.php b/apps/src/Search/User/LienUserSearch.php new file mode 100644 index 000000000..9ba753bdb --- /dev/null +++ b/apps/src/Search/User/LienUserSearch.php @@ -0,0 +1,21 @@ +getRepository(User::class); + foreach ($get as $key => $value) { + $this->{$key} = $value; + + $this->{$key} = ('refuser' == $key) ? $userRepo->find($value) : $this->{$key}; + } + } +} diff --git a/apps/src/Search/User/PhoneUserSearch.php b/apps/src/Search/User/PhoneUserSearch.php new file mode 100644 index 000000000..349237f18 --- /dev/null +++ b/apps/src/Search/User/PhoneUserSearch.php @@ -0,0 +1,23 @@ +getRepository(User::class); + foreach ($get as $key => $value) { + $this->{$key} = $value; + + $this->{$key} = ('refuser' == $key) ? $userRepo->find($value) : $this->{$key}; + } + } +} diff --git a/apps/src/Search/UserSearch.php b/apps/src/Search/UserSearch.php new file mode 100644 index 000000000..3d1a62810 --- /dev/null +++ b/apps/src/Search/UserSearch.php @@ -0,0 +1,26 @@ +getRepository(Groupe::class); + foreach ($get as $key => $value) { + $this->{$key} = $value; + $this->{$key} = ('refgroupe' == $key) ? $groupeRepo->find($value) : $this->{$key}; + } + } +} diff --git a/apps/src/Service/AttachFormService.php b/apps/src/Service/AttachFormService.php new file mode 100644 index 000000000..5ce0382cb --- /dev/null +++ b/apps/src/Service/AttachFormService.php @@ -0,0 +1,43 @@ +uploadAnnotReader = $uploadAnnotReader; + $this->attachmentRepository = $attachmentRepository; + $this->attachmentRH = $attachmentRH; + } + + public function getRepository(): AttachmentRepository + { + return $this->attachmentRepository; + } + + public function getRequestHandler(): AttachmentRequestHandler + { + return $this->attachmentRH; + } + + public function getUploadAnnotationReader(): UploadAnnotationReader + { + return $this->uploadAnnotReader; + } +} diff --git a/apps/src/Service/BookmarkService.php b/apps/src/Service/BookmarkService.php new file mode 100644 index 000000000..1161fc7f1 --- /dev/null +++ b/apps/src/Service/BookmarkService.php @@ -0,0 +1,191 @@ +requestHandler = $requestHandler; + $this->entityManager = $entityManager; + $this->uploadAnnotReader = $uploadAnnotReader; + $this->attachmentRH = $attachmentRH; + $this->containerBag = $containerBag; + $this->userRepo = $userRepo; + $this->bookmarkRepo = $bookmarkRepo; + $this->logger = $logger; + } + + public function process( + string $userid, + string $url, + string $name, + string $icon, + DateTime $date + ) + { + $user = $this->userRepo->find($userid); + $bookmark = $this->bookmarkRepo->findOneBy( + ['url' => $url] + ); + if ($bookmark instanceof Bookmark) { + return; + } + + $bookmark = new bookmark(); + $old = clone $bookmark; + $bookmark->setRefuser($user); + $bookmark->setUrl($url); + $bookmark->setIcon($icon); + $bookmark->setName($name); + $bookmark->setPublished($date); + + try { + $headers = get_headers($url, 1); + if (self::CLIENTNUMBER < substr($headers[0], 9, 3)) { + return; + } + + $meta = get_meta_tags($url); + $description = $meta['description'] ?? null; + $code = 'twitter:description'; + $description = (is_null($description) && isset($meta[$code])) ? $meta[$code] : $description; + $bookmark->setMetaDescription($description); + $bookmark->setContent($description); + $keywords = $meta['keywords'] ?? null; + $bookmark->setMetaKeywords($keywords); + $image = $meta['twitter:image'] ?? null; + $image = (is_null($image) && isset($meta['og:image'])) ? $meta['og:image'] : $image; + $this->upload($bookmark, $image); + $this->entityManager->persist($bookmark); + $this->entityManager->flush(); + $this->requestHandler->handle($old, $bookmark); + } catch (Exception $exception) { + dump($exception->getMessage()); + $this->setErrorLogger($exception); + } + } + + protected function getParameter(string $name) + { + return $this->containerBag->get($name); + } + + protected function setErrorLogger($exception) + { + $errorMsg = sprintf( + 'Exception : Erreur %s dans %s L.%s : %s', + $exception->getCode(), + $exception->getFile(), + $exception->getLine(), + $exception->getMessage() + ); + $this->logger->error($errorMsg); + } + + protected function upload(Bookmark $bookmark, $image) + { + if (is_null($image) || !$this->uploadAnnotReader->isUploadable($bookmark)) { + return; + } + + // @var resource $finfo + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $annotations = $this->uploadAnnotReader->getUploadableFields($bookmark); + $slugger = new AsciiSlugger(); + foreach ($annotations as $annotation) { + $path = $this->getParameter('file_directory').'/'.$annotation->getPath(); + $accessor = PropertyAccess::createPropertyAccessor(); + $title = $accessor->getValue($bookmark, $annotation->getSlug()); + $slug = $slugger->slug($title); + $attachment = new Attachment(); + $old = clone $attachment; + + try { + $pathinfo = pathinfo($image); + $content = file_get_contents($image); + // @var resource $tmpfile + $tmpfile = tmpfile(); + $data = stream_get_meta_data($tmpfile); + file_put_contents($data['uri'], $content); + $file = new UploadedFile( + $data['uri'], + $slug.'.'.$pathinfo['extension'], + (string) finfo_file($finfo, $data['uri']), + null, + true + ); + $filename = $file->getClientOriginalName(); + if (!is_dir($path)) { + mkdir($path, 0777, true); + } + + $file->move( + $path, + $filename + ); + $file = $path.'/'.$filename; + } catch (Exception $exception) { + $this->setErrorLogger($exception); + } + + $file = $path.'/'.$filename; + $attachment->setMimeType(mime_content_type($file)); + $attachment->setSize(filesize($file)); + $size = getimagesize($file); + $attachment->setDimensions(is_array($size) ? $size : []); + $attachment->setName( + str_replace( + $this->getParameter('kernel.project_dir').'/public/', + '', + $file + ) + ); + $this->attachmentRH->handle($old, $attachment); + $accessor->setValue($bookmark, $annotation->getFilename(), $attachment); + } + } +} diff --git a/apps/src/Service/TrashService.php b/apps/src/Service/TrashService.php index fee9c4a5c..efb2dfa5c 100644 --- a/apps/src/Service/TrashService.php +++ b/apps/src/Service/TrashService.php @@ -43,8 +43,8 @@ public function all() 'Labstag\\Entity\\'.$file->getFilenameWithoutExtension() ); $repository = $this->manager->getRepository($entity); - $trash = $repository->findTrashForAdmin(); - if (0 == count($trash)) { + $trash = $repository->findTrashForAdmin([]); + if (0 == count($trash->getQuery()->getResult())) { continue; } @@ -58,7 +58,7 @@ public function all() ), 'properties' => $this->getProperties($repositoryFile), 'entity' => $entity, - 'total' => count($trash), + 'total' => count($trash->getQuery()->getResult()), 'token' => $this->csrfTokenManager->getToken('empty')->getValue(), ]; } diff --git a/apps/src/Singleton/AdminBtnSingleton.php b/apps/src/Singleton/AdminBtnSingleton.php index 6dd0ea7df..321627d92 100644 --- a/apps/src/Singleton/AdminBtnSingleton.php +++ b/apps/src/Singleton/AdminBtnSingleton.php @@ -83,13 +83,11 @@ public function addBtnDelete( $code = 'delete'.$entity->getId(); $token = $this->csrfTokenManager->getToken($code)->getValue(); $attr = [ - 'id' => 'DeleteForm', - 'is' => 'link-btnadmindelete', - 'data-token' => $token, - 'data-bs-toggle' => 'modal', - 'data-bs-target' => '#delete-modal', - 'data-redirect' => $this->router->generate($route['list']), - 'data-url' => $this->router->generate( + 'id' => 'DeleteForm', + 'is' => 'link-btnadmindelete', + 'token' => $token, + 'redirect' => $this->router->generate($route['list']), + 'url' => $this->router->generate( $route['delete'], $routeParam ), @@ -130,12 +128,10 @@ public function addBtnDestroy( $code = 'destroy'.$entity->getId(); $token = $this->csrfTokenManager->getToken($code)->getValue(); $attr = [ - 'data-bs-toggle' => 'modal', - 'data-token' => $token, - 'data-bs-target' => '#destroy-modal', - 'is' => 'link-btnadmindestroy', - 'data-redirect' => $this->router->generate($route['list']), - 'data-url' => $this->router->generate( + 'token' => $token, + 'is' => 'link-btnadmindestroy', + 'redirect' => $this->router->generate($route['list']), + 'url' => $this->router->generate( $route['destroy'], $routeParam ), @@ -192,12 +188,10 @@ public function addBtnEmpty(array $route, string $entity, string $text = 'Vider' $code = 'empty'; $token = $this->csrfTokenManager->getToken($code)->getValue(); $attr = [ - 'is' => 'link-btnadminempty', - 'data-bs-toggle' => 'modal', - 'data-token' => $token, - 'data-bs-target' => '#empty-modal', - 'data-redirect' => $this->router->generate($route['list']), - 'data-url' => $this->router->generate( + 'is' => 'link-btnadminempty', + 'token' => $token, + 'redirect' => $this->router->generate($route['list']), + 'url' => $this->router->generate( $route['empty'], ['entity' => $entity] ), @@ -233,6 +227,23 @@ public function addBtnGuard( return $this; } + public function addBtnImport(string $route, string $text = 'Import'): self + { + if ('' == $route || !$this->isRouteEnable($route)) { + return $this; + } + + $this->add( + 'btn-admin-header-import', + $text, + [ + 'href' => $this->router->generate($route), + ] + ); + + return $this; + } + public function addBtnList(string $route, string $text = 'Liste'): self { if ('' == $route || !$this->isRouteEnable($route)) { @@ -293,17 +304,15 @@ public function addBtnRestore( $code = 'restore'.$entity->getId(); $token = $this->csrfTokenManager->getToken($code)->getValue(); $attr = [ - 'data-bs-toggle' => 'modal', - 'data-token' => $token, - 'data-bs-target' => '#restore-modal', - 'is' => 'link-btnadminrestore', - 'data-redirect' => $this->router->generate( + 'token' => $token, + 'is' => 'link-btnadminrestore', + 'redirect' => $this->router->generate( $route['list'], [ 'entity' => $this->classEntity($entity), ] ), - 'data-url' => $this->router->generate( + 'url' => $this->router->generate( $route['restore'], $routeParam ), @@ -324,8 +333,8 @@ public function addBtnSave(string $form, string $text = 'Sauvegarder'): self 'btn-admin-header-save', $text, [ - 'id' => 'SaveForm', - 'data-form' => $form, + 'id' => 'SaveForm', + 'form' => $form, ] ); @@ -389,12 +398,10 @@ public function addRestoreSelection( 'btn-admin-header-restories', $title, [ - 'is' => 'link-btnadminrestories', - 'data-bs-toggle' => 'modal', - 'data-token' => $token, - 'data-bs-target' => '#restories-modal', - 'data-redirect' => $this->router->generate($routes['redirect']['href'], $routes['redirect']['params']), - 'data-url' => $this->router->generate($routes['url']['href'], $routes['url']['params']), + 'is' => 'link-btnadminrestories', + 'token' => $token, + 'redirect' => $this->router->generate($routes['redirect']['href'], $routes['redirect']['params']), + 'url' => $this->router->generate($routes['url']['href'], $routes['url']['params']), ] ); @@ -416,13 +423,15 @@ public function addSupprimerSelection( $modal = $globals['modal'] ?? []; $modal['deleties'] = true; $this->twig->addGlobal('modal', $modal); - $this->setBtnAdd( + $this->add( 'btn-admin-header-deleties', - 'link-btnadmindeleties', - 'deleties-modal', $title, - $token, - $routes + [ + 'is' => 'link-btnadmindeleties', + 'token' => $token, + 'redirect' => $this->router->generate($routes['redirect']['href'], $routes['redirect']['params']), + 'url' => $this->router->generate($routes['url']['href'], $routes['url']['params']), + ] ); return $this; @@ -443,13 +452,15 @@ public function addViderSelection( $modal = $globals['modal'] ?? []; $modal['empties'] = true; $this->twig->addGlobal('modal', $modal); - $this->setBtnAdd( + $this->add( 'btn-admin-header-empties', - 'link-btnadminempties', - 'empties-modal', $title, - $token, - $routes + [ + 'is' => 'link-btnadminempties', + 'token' => $token, + 'redirect' => $this->router->generate($routes['redirect']['href'], $routes['redirect']['params']), + 'url' => $this->router->generate($routes['url']['href'], $routes['url']['params']), + ] ); return $this; @@ -538,27 +549,4 @@ private function arrayKeyExistsUrl($routes) || !array_key_exists('params', $routes['url']) || !$this->isRouteEnable($routes['url']['href']); } - - private function setBtnAdd( - $name, - $isinput, - $target, - $title, - $token, - $routes - ) - { - $this->add( - $name, - $title, - [ - 'is' => $isinput, - 'data-bs-toggle' => 'modal', - 'data-bs-target' => '#'.$target, - 'data-token' => $token, - 'data-redirect' => $this->router->generate($routes['redirect']['href'], $routes['redirect']['params']), - 'data-url' => $this->router->generate($routes['url']['href'], $routes['url']['params']), - ] - ); - } } diff --git a/apps/symfony.lock b/apps/symfony.lock index 36b5f5ac0..0f85dc0f2 100644 --- a/apps/symfony.lock +++ b/apps/symfony.lock @@ -31,9 +31,6 @@ "bluemmb/faker-picsum-photos-provider": { "version": "v2.0" }, - "brick/math": { - "version": "0.9.1" - }, "composer/package-versions-deprecated": { "version": "1.11.99" }, @@ -317,24 +314,6 @@ "ralouphie/getallheaders": { "version": "3.0.3" }, - "ramsey/collection": { - "version": "1.1.1" - }, - "ramsey/uuid": { - "version": "4.1.1" - }, - "ramsey/uuid-doctrine": { - "version": "1.3", - "recipe": { - "repo": "github.com/symfony/recipes-contrib", - "branch": "master", - "version": "1.3", - "ref": "471aed0fbf5620b8d7f92b7a5ebbbf6c0945c27a" - }, - "files": [ - "config/packages/ramsey_uuid_doctrine.yaml" - ] - }, "rtheunissen/oauth2-reddit": { "version": "v2.0.2" }, @@ -663,6 +642,9 @@ "symfony/property-info": { "version": "v5.1.7" }, + "symfony/proxy-manager-bridge": { + "version": "v5.3.4" + }, "symfony/rate-limiter": { "version": "v5.3.4" }, @@ -691,7 +673,7 @@ "repo": "github.com/symfony/recipes", "branch": "master", "version": "5.3", - "ref": "227eba5e0c7e8fc4beda3537c3d81dc23ba08182" + "ref": "9c4fcf79873f7400c885b90935f7163233615d6f" }, "files": [ "config/packages/security.yaml" diff --git a/apps/templates/admin.html.twig b/apps/templates/admin.html.twig index 861251a8a..fd825c211 100644 --- a/apps/templates/admin.html.twig +++ b/apps/templates/admin.html.twig @@ -31,7 +31,7 @@