Loading composer.lock +54 −64 Changes for composer.lock: 54 added lines, 64 removed lines. Original line number Diff line number Diff line Loading @@ -1276,16 +1276,16 @@ }, { "name": "doctrine/lexer", "version": "1.2.2", "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", "reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c" "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/doctrine/lexer/zipball/9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c", "reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c", "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", "shasum": "" }, "require": { Loading @@ -1293,7 +1293,7 @@ }, "require-dev": { "doctrine/coding-standard": "^9.0", "phpstan/phpstan": "1.3", "phpstan/phpstan": "^1.3", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", "vimeo/psalm": "^4.11" }, Loading Loading @@ -1332,7 +1332,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", "source": "https://github.com/doctrine/lexer/tree/1.2.2" "source": "https://github.com/doctrine/lexer/tree/1.2.3" }, "funding": [ { Loading @@ -1348,7 +1348,7 @@ "type": "tidelift" } ], "time": "2022-01-12T08:27:12+00:00" "time": "2022-02-28T11:07:21+00:00" }, { "name": "doctrine/orm", Loading Loading @@ -3720,16 +3720,16 @@ }, { "name": "laminas/laminas-mvc-i18n", "version": "1.3.0", "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/laminas/laminas-mvc-i18n.git", "reference": "1df255e2840eafdd814f5f7f4a46ef192aa5f880" "reference": "3f6c81d839507dee8bbf74a09a9bfc65ecd3bb88" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/laminas/laminas-mvc-i18n/zipball/1df255e2840eafdd814f5f7f4a46ef192aa5f880", "reference": "1df255e2840eafdd814f5f7f4a46ef192aa5f880", "url": "https://api.github.com/repos/laminas/laminas-mvc-i18n/zipball/3f6c81d839507dee8bbf74a09a9bfc65ecd3bb88", "reference": "3f6c81d839507dee8bbf74a09a9bfc65ecd3bb88", "shasum": "" }, "require": { Loading Loading @@ -3793,7 +3793,7 @@ "type": "community_bridge" } ], "time": "2021-11-30T17:32:48+00:00" "time": "2022-02-25T14:13:55+00:00" }, { "name": "laminas/laminas-mvc-plugin-fileprg", Loading Loading @@ -5154,41 +5154,36 @@ }, { "name": "ocramius/proxy-manager", "version": "2.13.0", "version": "2.14.0", "source": { "type": "git", "url": "https://github.com/Ocramius/ProxyManager.git", "reference": "21e2b4aa7d7661e7641cc6362fc8635ddcfa8464" "reference": "dbcdf2c925c774d3521107174672665a2f0f7255" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/21e2b4aa7d7661e7641cc6362fc8635ddcfa8464", "reference": "21e2b4aa7d7661e7641cc6362fc8635ddcfa8464", "url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/dbcdf2c925c774d3521107174672665a2f0f7255", "reference": "dbcdf2c925c774d3521107174672665a2f0f7255", "shasum": "" }, "require": { "composer-runtime-api": "^2.1.0", "laminas/laminas-code": "^4.3.0", "php": "~7.4.1 || ~8.0.0", "laminas/laminas-code": "^4.4.2", "php": "~8.0.0", "webimpress/safe-writer": "^2.2.0" }, "conflict": { "doctrine/annotations": "<1.6.1", "laminas/laminas-stdlib": "<3.2.1", "thecodingmachine/safe": "<1.3.3", "zendframework/zend-stdlib": "<3.2.1" "thecodingmachine/safe": "<1.3.3" }, "require-dev": { "codelicia/xulieta": "^0.1.6", "doctrine/coding-standard": "^8.2.1", "doctrine/coding-standard": "^9.0.0", "ext-phar": "*", "infection/infection": "^0.21.5", "nikic/php-parser": "^4.10.5", "phpbench/phpbench": "^0.17.1 || 1.0.0-alpha2", "phpunit/phpunit": "^9.5.4", "slevomat/coding-standard": "^6.3.10", "phpbench/phpbench": "^1.0.3", "phpunit/phpunit": "^9.5.6", "roave/infection-static-analysis-plugin": "^1.8", "squizlabs/php_codesniffer": "^3.6.0", "vimeo/psalm": "^4.4.1" "vimeo/psalm": "^4.8.1" }, "suggest": { "laminas/laminas-json": "To have the JsonRpc adapter (Remote Object feature)", Loading @@ -5197,11 +5192,6 @@ "ocramius/generated-hydrator": "To have very fast object to array to object conversion for ghost objects" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.0.x-dev" } }, "autoload": { "psr-4": { "ProxyManager\\": "src/ProxyManager" Loading @@ -5215,7 +5205,7 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", "homepage": "http://ocramius.github.io/" "homepage": "https://ocramius.github.io/" } ], "description": "A library providing utilities to generate, instantiate and generally operate with Object Proxies", Loading @@ -5229,7 +5219,7 @@ ], "support": { "issues": "https://github.com/Ocramius/ProxyManager/issues", "source": "https://github.com/Ocramius/ProxyManager/tree/2.13.0" "source": "https://github.com/Ocramius/ProxyManager/tree/2.14.0" }, "funding": [ { Loading @@ -5241,7 +5231,7 @@ "type": "tidelift" } ], "time": "2021-06-09T10:16:06+00:00" "time": "2022-02-28T13:55:36+00:00" }, { "name": "paragonie/random_compat", Loading Loading @@ -5742,16 +5732,16 @@ }, { "name": "symfony/console", "version": "v6.0.3", "version": "v6.0.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", "reference": "22e8efd019c3270c4f79376234a3f8752cd25490" "reference": "3bebf4108b9e07492a2a4057d207aa5a77d146b1" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/console/zipball/22e8efd019c3270c4f79376234a3f8752cd25490", "reference": "22e8efd019c3270c4f79376234a3f8752cd25490", "url": "https://api.github.com/repos/symfony/console/zipball/3bebf4108b9e07492a2a4057d207aa5a77d146b1", "reference": "3bebf4108b9e07492a2a4057d207aa5a77d146b1", "shasum": "" }, "require": { Loading Loading @@ -5817,7 +5807,7 @@ "terminal" ], "support": { "source": "https://github.com/symfony/console/tree/v6.0.3" "source": "https://github.com/symfony/console/tree/v6.0.5" }, "funding": [ { Loading @@ -5833,7 +5823,7 @@ "type": "tidelift" } ], "time": "2022-01-26T17:23:29+00:00" "time": "2022-02-25T10:48:52+00:00" }, { "name": "symfony/deprecation-contracts", Loading Loading @@ -6672,12 +6662,12 @@ }, "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\String\\": "" }, "files": [ "Resources/functions.php" ], "psr-4": { "Symfony\\Component\\String\\": "" }, "exclude-from-classmap": [ "/Tests/" ] Loading Loading @@ -6727,16 +6717,16 @@ }, { "name": "symfony/var-dumper", "version": "v6.0.3", "version": "v6.0.5", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", "reference": "7b701676fc64f9ef11f9b4870f16b48f66be4834" "reference": "60d6a756d5f485df5e6e40b337334848f79f61ce" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7b701676fc64f9ef11f9b4870f16b48f66be4834", "reference": "7b701676fc64f9ef11f9b4870f16b48f66be4834", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/60d6a756d5f485df5e6e40b337334848f79f61ce", "reference": "60d6a756d5f485df5e6e40b337334848f79f61ce", "shasum": "" }, "require": { Loading Loading @@ -6795,7 +6785,7 @@ "dump" ], "support": { "source": "https://github.com/symfony/var-dumper/tree/v6.0.3" "source": "https://github.com/symfony/var-dumper/tree/v6.0.5" }, "funding": [ { Loading @@ -6811,7 +6801,7 @@ "type": "tidelift" } ], "time": "2022-01-17T16:30:44+00:00" "time": "2022-02-21T17:15:17+00:00" }, { "name": "unicaen/app", Loading Loading @@ -8320,16 +8310,16 @@ }, { "name": "symfony/dependency-injection", "version": "v6.0.3", "version": "v6.0.5", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", "reference": "bf53dbf6e8f3eec14f44c53fa4c3b4905ab19ee4" "reference": "481846cbd2441cf3444340ee53486fc24da525bd" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/bf53dbf6e8f3eec14f44c53fa4c3b4905ab19ee4", "reference": "bf53dbf6e8f3eec14f44c53fa4c3b4905ab19ee4", "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/481846cbd2441cf3444340ee53486fc24da525bd", "reference": "481846cbd2441cf3444340ee53486fc24da525bd", "shasum": "" }, "require": { Loading Loading @@ -8388,7 +8378,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/v6.0.3" "source": "https://github.com/symfony/dependency-injection/tree/v6.0.5" }, "funding": [ { Loading @@ -8404,20 +8394,20 @@ "type": "tidelift" } ], "time": "2022-01-26T17:23:29+00:00" "time": "2022-02-24T10:01:27+00:00" }, { "name": "symfony/filesystem", "version": "v6.0.3", "version": "v6.0.5", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", "reference": "6ae49c4fda17322171a2b8dc5f70bc6edbc498e1" "reference": "6646c13f787057d64701a3a0235cf9567c6ccbbd" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/filesystem/zipball/6ae49c4fda17322171a2b8dc5f70bc6edbc498e1", "reference": "6ae49c4fda17322171a2b8dc5f70bc6edbc498e1", "url": "https://api.github.com/repos/symfony/filesystem/zipball/6646c13f787057d64701a3a0235cf9567c6ccbbd", "reference": "6646c13f787057d64701a3a0235cf9567c6ccbbd", "shasum": "" }, "require": { Loading Loading @@ -8451,7 +8441,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { "source": "https://github.com/symfony/filesystem/tree/v6.0.3" "source": "https://github.com/symfony/filesystem/tree/v6.0.5" }, "funding": [ { Loading @@ -8467,7 +8457,7 @@ "type": "tidelift" } ], "time": "2022-01-02T09:55:41+00:00" "time": "2022-02-28T07:42:30+00:00" }, { "name": "tysonandre/var_representation_polyfill", Loading module/Application/src/ORM/Event/Listeners/ParametreEntityListener.php +25 −0 Changes for module/Application/src/ORM/Event/Listeners/ParametreEntityListener.php: 25 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ class ParametreEntityListener implements EventSubscriber $this->metadata = $this->em->getClassMetadata(get_class($this->entity)); $this->hydrator = new ClassMethodsHydrator(); $this->hydrator->setUnderscoreSeparatedKeys(false); $disabledFilters = $this->disableFilters(); /* Gestion de l'historique en délégation à l'HistoriqueListener */ $histoListener = new HistoriqueListener(); Loading Loading @@ -79,6 +80,8 @@ class ParametreEntityListener implements EventSubscriber } } $this->enableFilters($disabledFilters); $this->isSaving = false; } Loading Loading @@ -290,6 +293,28 @@ class ParametreEntityListener implements EventSubscriber protected function disableFilters() { $filters = $this->em->getFilters()->getEnabledFilters(); foreach ($filters as $name => $filter) { $this->em->getFilters()->disable($name); } return $filters; } protected function enableFilters(array $filters) { foreach ($filters as $name => $filter) { $this->em->getFilters()->enable($name); } } protected function getColumns(): array { $columns = $this->metadata->fieldNames; Loading module/Application/src/ORM/Filter/AbstractFilter.php +79 −0 Changes for module/Application/src/ORM/Filter/AbstractFilter.php: 79 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ namespace Application\ORM\Filter; use Application\Entity\Db\Annee; use Application\Service\Traits\ContextServiceAwareTrait; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Query\Filter\SQLFilter; /** Loading @@ -11,5 +14,81 @@ use Doctrine\ORM\Query\Filter\SQLFilter; */ abstract class AbstractFilter extends SQLFilter { use ContextServiceAwareTrait; protected array $enabledEntities = []; /** * Désactive le filtre pour une ou des entités données * * @param string|string[] $entity * * @return self */ public function disableForEntity($entity) { if (is_array($entity)) { foreach ($entity as $e) { unset($this->enabledEntities[$e]); } } else { unset($this->enabledEntities[$entity]); } return $this; } /** * Active le filtre pour une ou des entités données * * @param string|string[] $entity * * @return self */ public function enableForEntity($entity) { if (is_array($entity)) { foreach ($entity as $e) { $this->enabledEntities[$e] = true; } } else { $this->enabledEntities[$entity] = true; } return $this; } public function isEnabled(ClassMetaData|string $entity): bool { if ($entity instanceof ClassMetadata) { $entity = $entity->name; } return isset($this->enabledEntities[$entity]); } /** * Initialisation rapide du filtre!! * * @param string|string[] $entity * @param Annee|null $annee * * @return self */ public function init($entity, $annee = null) { if ($entity) { $this->enableForEntity($entity); } return $this; } } No newline at end of file module/Application/src/ORM/Filter/AnneeFilter.php +5 −69 Changes for module/Application/src/ORM/Filter/AnneeFilter.php: 5 added lines, 69 removed lines. Original line number Diff line number Diff line Loading @@ -13,81 +13,17 @@ use Application\Entity\Db\Annee; */ class AnneeFilter extends AbstractFilter { use ContextServiceAwareTrait; protected $enabledEntities = []; public function addFilterConstraint(ClassMetaData $targetEntity, $targetTableAlias) public function addFilterConstraint(ClassMetaData $targetEntity, $targetTableAlias): string { if (isset($this->enabledEntities[$targetEntity->name])) { return $targetTableAlias . '.ANNEE_ID = ' . $this->getServiceContext()->getAnnee()->getId(); } if (!$targetEntity->hasAssociation('annee')) { return ''; } /** * Désactive le filtre pour une ou des entités données * * @param string|string[] $entity * * @return self */ public function disableForEntity($entity) { if (is_array($entity)) { foreach ($entity as $e) { unset($this->enabledEntities[$e]); } } else { unset($this->enabledEntities[$entity]); } return $this; } /** * Active le filtre pour une ou des entités données * * @param string|string[] $entity * * @return self */ public function enableForEntity($entity) { if (is_array($entity)) { foreach ($entity as $e) { $this->enabledEntities[$e] = true; } } else { $this->enabledEntities[$entity] = true; } return $this; } /** * Initialisation rapide du filtre!! * * @param string|string[] $entity * @param Annee|null $annee * * @return self */ public function init($entity, $annee = null) { if ($entity) { $this->enableForEntity($entity); if ($this->isEnabled($targetEntity)) { return $targetTableAlias . '.ANNEE_ID = ' . $this->getServiceContext()->getAnnee()->getId(); } return $this; return ''; } } No newline at end of file module/Application/src/ORM/Filter/HistoriqueFilter.php +2 −68 Changes for module/Application/src/ORM/Filter/HistoriqueFilter.php: 2 added lines, 68 removed lines. Original line number Diff line number Diff line Loading @@ -12,85 +12,19 @@ use Doctrine\ORM\Mapping\ClassMetaData; */ class HistoriqueFilter extends AbstractFilter { use ContextServiceAwareTrait; protected $enabledEntities = []; public function addFilterConstraint(ClassMetaData $targetEntity, $targetTableAlias) public function addFilterConstraint(ClassMetaData $targetEntity, $targetTableAlias): string { // Check if the entity implements the required interface if (!$targetEntity->reflClass->implementsInterface('UnicaenApp\Entity\HistoriqueAwareInterface')) { return ""; } if (isset($this->enabledEntities[$targetEntity->name])) { if ($this->isEnabled($targetEntity)) { return $targetTableAlias . '.HISTO_DESTRUCTION IS NULL'; } else { return ''; } } /** * Désactive le filtre pour une ou des entités données * * @param string|string[] $entity * * @return self */ public function disableForEntity($entity) { if (is_array($entity)) { foreach ($entity as $e) { unset($this->enabledEntities[$e]); } } else { unset($this->enabledEntities[$entity]); } return $this; } /** * Active le filtre pour une ou des entités données * * @param string|string[] $entity * * @return self */ public function enableForEntity($entity) { if (is_array($entity)) { foreach ($entity as $e) { $this->enabledEntities[$e] = true; } } else { $this->enabledEntities[$entity] = true; } return $this; } /** * Initialisation rapide du filtre!! * * @param string|string[] $entity * * @return self */ public function init($entity) { if ($entity) { $this->enableForEntity($entity); } return $this; } } No newline at end of file Loading
composer.lock +54 −64 Changes for composer.lock: 54 added lines, 64 removed lines. Original line number Diff line number Diff line Loading @@ -1276,16 +1276,16 @@ }, { "name": "doctrine/lexer", "version": "1.2.2", "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", "reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c" "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/doctrine/lexer/zipball/9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c", "reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c", "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", "shasum": "" }, "require": { Loading @@ -1293,7 +1293,7 @@ }, "require-dev": { "doctrine/coding-standard": "^9.0", "phpstan/phpstan": "1.3", "phpstan/phpstan": "^1.3", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", "vimeo/psalm": "^4.11" }, Loading Loading @@ -1332,7 +1332,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", "source": "https://github.com/doctrine/lexer/tree/1.2.2" "source": "https://github.com/doctrine/lexer/tree/1.2.3" }, "funding": [ { Loading @@ -1348,7 +1348,7 @@ "type": "tidelift" } ], "time": "2022-01-12T08:27:12+00:00" "time": "2022-02-28T11:07:21+00:00" }, { "name": "doctrine/orm", Loading Loading @@ -3720,16 +3720,16 @@ }, { "name": "laminas/laminas-mvc-i18n", "version": "1.3.0", "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/laminas/laminas-mvc-i18n.git", "reference": "1df255e2840eafdd814f5f7f4a46ef192aa5f880" "reference": "3f6c81d839507dee8bbf74a09a9bfc65ecd3bb88" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/laminas/laminas-mvc-i18n/zipball/1df255e2840eafdd814f5f7f4a46ef192aa5f880", "reference": "1df255e2840eafdd814f5f7f4a46ef192aa5f880", "url": "https://api.github.com/repos/laminas/laminas-mvc-i18n/zipball/3f6c81d839507dee8bbf74a09a9bfc65ecd3bb88", "reference": "3f6c81d839507dee8bbf74a09a9bfc65ecd3bb88", "shasum": "" }, "require": { Loading Loading @@ -3793,7 +3793,7 @@ "type": "community_bridge" } ], "time": "2021-11-30T17:32:48+00:00" "time": "2022-02-25T14:13:55+00:00" }, { "name": "laminas/laminas-mvc-plugin-fileprg", Loading Loading @@ -5154,41 +5154,36 @@ }, { "name": "ocramius/proxy-manager", "version": "2.13.0", "version": "2.14.0", "source": { "type": "git", "url": "https://github.com/Ocramius/ProxyManager.git", "reference": "21e2b4aa7d7661e7641cc6362fc8635ddcfa8464" "reference": "dbcdf2c925c774d3521107174672665a2f0f7255" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/21e2b4aa7d7661e7641cc6362fc8635ddcfa8464", "reference": "21e2b4aa7d7661e7641cc6362fc8635ddcfa8464", "url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/dbcdf2c925c774d3521107174672665a2f0f7255", "reference": "dbcdf2c925c774d3521107174672665a2f0f7255", "shasum": "" }, "require": { "composer-runtime-api": "^2.1.0", "laminas/laminas-code": "^4.3.0", "php": "~7.4.1 || ~8.0.0", "laminas/laminas-code": "^4.4.2", "php": "~8.0.0", "webimpress/safe-writer": "^2.2.0" }, "conflict": { "doctrine/annotations": "<1.6.1", "laminas/laminas-stdlib": "<3.2.1", "thecodingmachine/safe": "<1.3.3", "zendframework/zend-stdlib": "<3.2.1" "thecodingmachine/safe": "<1.3.3" }, "require-dev": { "codelicia/xulieta": "^0.1.6", "doctrine/coding-standard": "^8.2.1", "doctrine/coding-standard": "^9.0.0", "ext-phar": "*", "infection/infection": "^0.21.5", "nikic/php-parser": "^4.10.5", "phpbench/phpbench": "^0.17.1 || 1.0.0-alpha2", "phpunit/phpunit": "^9.5.4", "slevomat/coding-standard": "^6.3.10", "phpbench/phpbench": "^1.0.3", "phpunit/phpunit": "^9.5.6", "roave/infection-static-analysis-plugin": "^1.8", "squizlabs/php_codesniffer": "^3.6.0", "vimeo/psalm": "^4.4.1" "vimeo/psalm": "^4.8.1" }, "suggest": { "laminas/laminas-json": "To have the JsonRpc adapter (Remote Object feature)", Loading @@ -5197,11 +5192,6 @@ "ocramius/generated-hydrator": "To have very fast object to array to object conversion for ghost objects" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.0.x-dev" } }, "autoload": { "psr-4": { "ProxyManager\\": "src/ProxyManager" Loading @@ -5215,7 +5205,7 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", "homepage": "http://ocramius.github.io/" "homepage": "https://ocramius.github.io/" } ], "description": "A library providing utilities to generate, instantiate and generally operate with Object Proxies", Loading @@ -5229,7 +5219,7 @@ ], "support": { "issues": "https://github.com/Ocramius/ProxyManager/issues", "source": "https://github.com/Ocramius/ProxyManager/tree/2.13.0" "source": "https://github.com/Ocramius/ProxyManager/tree/2.14.0" }, "funding": [ { Loading @@ -5241,7 +5231,7 @@ "type": "tidelift" } ], "time": "2021-06-09T10:16:06+00:00" "time": "2022-02-28T13:55:36+00:00" }, { "name": "paragonie/random_compat", Loading Loading @@ -5742,16 +5732,16 @@ }, { "name": "symfony/console", "version": "v6.0.3", "version": "v6.0.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", "reference": "22e8efd019c3270c4f79376234a3f8752cd25490" "reference": "3bebf4108b9e07492a2a4057d207aa5a77d146b1" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/console/zipball/22e8efd019c3270c4f79376234a3f8752cd25490", "reference": "22e8efd019c3270c4f79376234a3f8752cd25490", "url": "https://api.github.com/repos/symfony/console/zipball/3bebf4108b9e07492a2a4057d207aa5a77d146b1", "reference": "3bebf4108b9e07492a2a4057d207aa5a77d146b1", "shasum": "" }, "require": { Loading Loading @@ -5817,7 +5807,7 @@ "terminal" ], "support": { "source": "https://github.com/symfony/console/tree/v6.0.3" "source": "https://github.com/symfony/console/tree/v6.0.5" }, "funding": [ { Loading @@ -5833,7 +5823,7 @@ "type": "tidelift" } ], "time": "2022-01-26T17:23:29+00:00" "time": "2022-02-25T10:48:52+00:00" }, { "name": "symfony/deprecation-contracts", Loading Loading @@ -6672,12 +6662,12 @@ }, "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\String\\": "" }, "files": [ "Resources/functions.php" ], "psr-4": { "Symfony\\Component\\String\\": "" }, "exclude-from-classmap": [ "/Tests/" ] Loading Loading @@ -6727,16 +6717,16 @@ }, { "name": "symfony/var-dumper", "version": "v6.0.3", "version": "v6.0.5", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", "reference": "7b701676fc64f9ef11f9b4870f16b48f66be4834" "reference": "60d6a756d5f485df5e6e40b337334848f79f61ce" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7b701676fc64f9ef11f9b4870f16b48f66be4834", "reference": "7b701676fc64f9ef11f9b4870f16b48f66be4834", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/60d6a756d5f485df5e6e40b337334848f79f61ce", "reference": "60d6a756d5f485df5e6e40b337334848f79f61ce", "shasum": "" }, "require": { Loading Loading @@ -6795,7 +6785,7 @@ "dump" ], "support": { "source": "https://github.com/symfony/var-dumper/tree/v6.0.3" "source": "https://github.com/symfony/var-dumper/tree/v6.0.5" }, "funding": [ { Loading @@ -6811,7 +6801,7 @@ "type": "tidelift" } ], "time": "2022-01-17T16:30:44+00:00" "time": "2022-02-21T17:15:17+00:00" }, { "name": "unicaen/app", Loading Loading @@ -8320,16 +8310,16 @@ }, { "name": "symfony/dependency-injection", "version": "v6.0.3", "version": "v6.0.5", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", "reference": "bf53dbf6e8f3eec14f44c53fa4c3b4905ab19ee4" "reference": "481846cbd2441cf3444340ee53486fc24da525bd" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/bf53dbf6e8f3eec14f44c53fa4c3b4905ab19ee4", "reference": "bf53dbf6e8f3eec14f44c53fa4c3b4905ab19ee4", "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/481846cbd2441cf3444340ee53486fc24da525bd", "reference": "481846cbd2441cf3444340ee53486fc24da525bd", "shasum": "" }, "require": { Loading Loading @@ -8388,7 +8378,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/v6.0.3" "source": "https://github.com/symfony/dependency-injection/tree/v6.0.5" }, "funding": [ { Loading @@ -8404,20 +8394,20 @@ "type": "tidelift" } ], "time": "2022-01-26T17:23:29+00:00" "time": "2022-02-24T10:01:27+00:00" }, { "name": "symfony/filesystem", "version": "v6.0.3", "version": "v6.0.5", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", "reference": "6ae49c4fda17322171a2b8dc5f70bc6edbc498e1" "reference": "6646c13f787057d64701a3a0235cf9567c6ccbbd" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/filesystem/zipball/6ae49c4fda17322171a2b8dc5f70bc6edbc498e1", "reference": "6ae49c4fda17322171a2b8dc5f70bc6edbc498e1", "url": "https://api.github.com/repos/symfony/filesystem/zipball/6646c13f787057d64701a3a0235cf9567c6ccbbd", "reference": "6646c13f787057d64701a3a0235cf9567c6ccbbd", "shasum": "" }, "require": { Loading Loading @@ -8451,7 +8441,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { "source": "https://github.com/symfony/filesystem/tree/v6.0.3" "source": "https://github.com/symfony/filesystem/tree/v6.0.5" }, "funding": [ { Loading @@ -8467,7 +8457,7 @@ "type": "tidelift" } ], "time": "2022-01-02T09:55:41+00:00" "time": "2022-02-28T07:42:30+00:00" }, { "name": "tysonandre/var_representation_polyfill", Loading
module/Application/src/ORM/Event/Listeners/ParametreEntityListener.php +25 −0 Changes for module/Application/src/ORM/Event/Listeners/ParametreEntityListener.php: 25 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ class ParametreEntityListener implements EventSubscriber $this->metadata = $this->em->getClassMetadata(get_class($this->entity)); $this->hydrator = new ClassMethodsHydrator(); $this->hydrator->setUnderscoreSeparatedKeys(false); $disabledFilters = $this->disableFilters(); /* Gestion de l'historique en délégation à l'HistoriqueListener */ $histoListener = new HistoriqueListener(); Loading Loading @@ -79,6 +80,8 @@ class ParametreEntityListener implements EventSubscriber } } $this->enableFilters($disabledFilters); $this->isSaving = false; } Loading Loading @@ -290,6 +293,28 @@ class ParametreEntityListener implements EventSubscriber protected function disableFilters() { $filters = $this->em->getFilters()->getEnabledFilters(); foreach ($filters as $name => $filter) { $this->em->getFilters()->disable($name); } return $filters; } protected function enableFilters(array $filters) { foreach ($filters as $name => $filter) { $this->em->getFilters()->enable($name); } } protected function getColumns(): array { $columns = $this->metadata->fieldNames; Loading
module/Application/src/ORM/Filter/AbstractFilter.php +79 −0 Changes for module/Application/src/ORM/Filter/AbstractFilter.php: 79 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ namespace Application\ORM\Filter; use Application\Entity\Db\Annee; use Application\Service\Traits\ContextServiceAwareTrait; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Query\Filter\SQLFilter; /** Loading @@ -11,5 +14,81 @@ use Doctrine\ORM\Query\Filter\SQLFilter; */ abstract class AbstractFilter extends SQLFilter { use ContextServiceAwareTrait; protected array $enabledEntities = []; /** * Désactive le filtre pour une ou des entités données * * @param string|string[] $entity * * @return self */ public function disableForEntity($entity) { if (is_array($entity)) { foreach ($entity as $e) { unset($this->enabledEntities[$e]); } } else { unset($this->enabledEntities[$entity]); } return $this; } /** * Active le filtre pour une ou des entités données * * @param string|string[] $entity * * @return self */ public function enableForEntity($entity) { if (is_array($entity)) { foreach ($entity as $e) { $this->enabledEntities[$e] = true; } } else { $this->enabledEntities[$entity] = true; } return $this; } public function isEnabled(ClassMetaData|string $entity): bool { if ($entity instanceof ClassMetadata) { $entity = $entity->name; } return isset($this->enabledEntities[$entity]); } /** * Initialisation rapide du filtre!! * * @param string|string[] $entity * @param Annee|null $annee * * @return self */ public function init($entity, $annee = null) { if ($entity) { $this->enableForEntity($entity); } return $this; } } No newline at end of file
module/Application/src/ORM/Filter/AnneeFilter.php +5 −69 Changes for module/Application/src/ORM/Filter/AnneeFilter.php: 5 added lines, 69 removed lines. Original line number Diff line number Diff line Loading @@ -13,81 +13,17 @@ use Application\Entity\Db\Annee; */ class AnneeFilter extends AbstractFilter { use ContextServiceAwareTrait; protected $enabledEntities = []; public function addFilterConstraint(ClassMetaData $targetEntity, $targetTableAlias) public function addFilterConstraint(ClassMetaData $targetEntity, $targetTableAlias): string { if (isset($this->enabledEntities[$targetEntity->name])) { return $targetTableAlias . '.ANNEE_ID = ' . $this->getServiceContext()->getAnnee()->getId(); } if (!$targetEntity->hasAssociation('annee')) { return ''; } /** * Désactive le filtre pour une ou des entités données * * @param string|string[] $entity * * @return self */ public function disableForEntity($entity) { if (is_array($entity)) { foreach ($entity as $e) { unset($this->enabledEntities[$e]); } } else { unset($this->enabledEntities[$entity]); } return $this; } /** * Active le filtre pour une ou des entités données * * @param string|string[] $entity * * @return self */ public function enableForEntity($entity) { if (is_array($entity)) { foreach ($entity as $e) { $this->enabledEntities[$e] = true; } } else { $this->enabledEntities[$entity] = true; } return $this; } /** * Initialisation rapide du filtre!! * * @param string|string[] $entity * @param Annee|null $annee * * @return self */ public function init($entity, $annee = null) { if ($entity) { $this->enableForEntity($entity); if ($this->isEnabled($targetEntity)) { return $targetTableAlias . '.ANNEE_ID = ' . $this->getServiceContext()->getAnnee()->getId(); } return $this; return ''; } } No newline at end of file
module/Application/src/ORM/Filter/HistoriqueFilter.php +2 −68 Changes for module/Application/src/ORM/Filter/HistoriqueFilter.php: 2 added lines, 68 removed lines. Original line number Diff line number Diff line Loading @@ -12,85 +12,19 @@ use Doctrine\ORM\Mapping\ClassMetaData; */ class HistoriqueFilter extends AbstractFilter { use ContextServiceAwareTrait; protected $enabledEntities = []; public function addFilterConstraint(ClassMetaData $targetEntity, $targetTableAlias) public function addFilterConstraint(ClassMetaData $targetEntity, $targetTableAlias): string { // Check if the entity implements the required interface if (!$targetEntity->reflClass->implementsInterface('UnicaenApp\Entity\HistoriqueAwareInterface')) { return ""; } if (isset($this->enabledEntities[$targetEntity->name])) { if ($this->isEnabled($targetEntity)) { return $targetTableAlias . '.HISTO_DESTRUCTION IS NULL'; } else { return ''; } } /** * Désactive le filtre pour une ou des entités données * * @param string|string[] $entity * * @return self */ public function disableForEntity($entity) { if (is_array($entity)) { foreach ($entity as $e) { unset($this->enabledEntities[$e]); } } else { unset($this->enabledEntities[$entity]); } return $this; } /** * Active le filtre pour une ou des entités données * * @param string|string[] $entity * * @return self */ public function enableForEntity($entity) { if (is_array($entity)) { foreach ($entity as $e) { $this->enabledEntities[$e] = true; } } else { $this->enabledEntities[$entity] = true; } return $this; } /** * Initialisation rapide du filtre!! * * @param string|string[] $entity * * @return self */ public function init($entity) { if ($entity) { $this->enableForEntity($entity); } return $this; } } No newline at end of file