diff --git a/.gitignore b/.gitignore index 2338294..5ed3829 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ - ###> symfony/framework-bundle ### /.env.local /.env.local.php @@ -20,6 +19,16 @@ /public/assets/ /assets/vendor/ ###< symfony/asset-mapper ### -.idea -composer.lock \ No newline at end of file +# IDE (JetBrains PhpStorm, Rider, etc.) +.idea/ + +# Node.js +/node_modules/ + +# Fichiers temporaires ou locaux +/public/build/ + +# Docker (local override) +/docker-compose.override.yml + diff --git a/composer.lock b/composer.lock index 58fd270..466f205 100644 --- a/composer.lock +++ b/composer.lock @@ -549,16 +549,16 @@ }, { "name": "doctrine/doctrine-migrations-bundle", - "version": "3.4.1", + "version": "3.4.2", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineMigrationsBundle.git", - "reference": "e858ce0f5c12b266dce7dce24834448355155da7" + "reference": "5a6ac7120c2924c4c070a869d08b11ccf9e277b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineMigrationsBundle/zipball/e858ce0f5c12b266dce7dce24834448355155da7", - "reference": "e858ce0f5c12b266dce7dce24834448355155da7", + "url": "https://api.github.com/repos/doctrine/DoctrineMigrationsBundle/zipball/5a6ac7120c2924c4c070a869d08b11ccf9e277b9", + "reference": "5a6ac7120c2924c4c070a869d08b11ccf9e277b9", "shasum": "" }, "require": { @@ -572,7 +572,6 @@ "composer/semver": "^3.0", "doctrine/coding-standard": "^12", "doctrine/orm": "^2.6 || ^3", - "doctrine/persistence": "^2.0 || ^3", "phpstan/phpstan": "^1.4 || ^2", "phpstan/phpstan-deprecation-rules": "^1 || ^2", "phpstan/phpstan-phpunit": "^1 || ^2", @@ -615,7 +614,7 @@ ], "support": { "issues": "https://github.com/doctrine/DoctrineMigrationsBundle/issues", - "source": "https://github.com/doctrine/DoctrineMigrationsBundle/tree/3.4.1" + "source": "https://github.com/doctrine/DoctrineMigrationsBundle/tree/3.4.2" }, "funding": [ { @@ -631,7 +630,7 @@ "type": "tidelift" } ], - "time": "2025-01-27T22:48:22+00:00" + "time": "2025-03-11T17:36:26+00:00" }, { "name": "doctrine/event-manager", @@ -1067,16 +1066,16 @@ }, { "name": "doctrine/orm", - "version": "3.3.2", + "version": "3.3.3", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "c9557c588b3a70ed93caff069d0aa75737f25609" + "reference": "1f1891d3e20ef9881e81c2f32c53e9dc88dfc9a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/c9557c588b3a70ed93caff069d0aa75737f25609", - "reference": "c9557c588b3a70ed93caff069d0aa75737f25609", + "url": "https://api.github.com/repos/doctrine/orm/zipball/1f1891d3e20ef9881e81c2f32c53e9dc88dfc9a7", + "reference": "1f1891d3e20ef9881e81c2f32c53e9dc88dfc9a7", "shasum": "" }, "require": { @@ -1096,7 +1095,7 @@ "symfony/var-exporter": "^6.3.9 || ^7.0" }, "require-dev": { - "doctrine/coding-standard": "^12.0", + "doctrine/coding-standard": "^13.0", "phpbench/phpbench": "^1.0", "phpdocumentor/guides-cli": "^1.4", "phpstan/extension-installer": "^1.4", @@ -1104,7 +1103,7 @@ "phpstan/phpstan-deprecation-rules": "^2", "phpunit/phpunit": "^10.4.0", "psr/log": "^1 || ^2 || ^3", - "squizlabs/php_codesniffer": "3.7.2", + "squizlabs/php_codesniffer": "3.12.0", "symfony/cache": "^5.4 || ^6.2 || ^7.0" }, "suggest": { @@ -1151,9 +1150,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/3.3.2" + "source": "https://github.com/doctrine/orm/tree/3.3.3" }, - "time": "2025-02-04T19:43:15+00:00" + "time": "2025-05-02T17:42:51+00:00" }, { "name": "doctrine/persistence", @@ -1530,16 +1529,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.6.1", + "version": "5.6.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8" + "reference": "92dde6a5919e34835c506ac8c523ef095a95ed62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", - "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/92dde6a5919e34835c506ac8c523ef095a95ed62", + "reference": "92dde6a5919e34835c506ac8c523ef095a95ed62", "shasum": "" }, "require": { @@ -1588,9 +1587,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.1" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.2" }, - "time": "2024-12-07T09:39:29+00:00" + "time": "2025-04-13T19:20:35+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -4782,7 +4781,7 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", @@ -4840,7 +4839,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.32.0" }, "funding": [ { @@ -4860,16 +4859,16 @@ }, { "name": "symfony/polyfill-intl-icu", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-icu.git", - "reference": "d80a05e9904d2c2b9b95929f3e4b5d3a8f418d78" + "reference": "763d2a91fea5681509ca01acbc1c5e450d127811" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/d80a05e9904d2c2b9b95929f3e4b5d3a8f418d78", - "reference": "d80a05e9904d2c2b9b95929f3e4b5d3a8f418d78", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/763d2a91fea5681509ca01acbc1c5e450d127811", + "reference": "763d2a91fea5681509ca01acbc1c5e450d127811", "shasum": "" }, "require": { @@ -4924,7 +4923,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-icu/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-icu/tree/v1.32.0" }, "funding": [ { @@ -4940,20 +4939,20 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-12-21T18:38:29+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773" + "reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/c36586dcf89a12315939e00ec9b4474adcb1d773", - "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/9614ac4d8061dc257ecc64cba1b140873dce8ad3", + "reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3", "shasum": "" }, "require": { @@ -5007,7 +5006,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.32.0" }, "funding": [ { @@ -5023,11 +5022,11 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-09-10T14:38:51+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -5088,7 +5087,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.32.0" }, "funding": [ { @@ -5108,19 +5107,20 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", "shasum": "" }, "require": { + "ext-iconv": "*", "php": ">=7.2" }, "provide": { @@ -5168,7 +5168,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0" }, "funding": [ { @@ -5184,11 +5184,11 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-12-23T08:48:59+00:00" }, { "name": "symfony/polyfill-php83", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php83.git", @@ -5244,7 +5244,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-php83/tree/v1.32.0" }, "funding": [ { @@ -5264,16 +5264,16 @@ }, { "name": "symfony/polyfill-php84", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php84.git", - "reference": "e5493eb51311ab0b1cc2243416613f06ed8f18bd" + "reference": "000df7860439609837bbe28670b0be15783b7fbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/e5493eb51311ab0b1cc2243416613f06ed8f18bd", - "reference": "e5493eb51311ab0b1cc2243416613f06ed8f18bd", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/000df7860439609837bbe28670b0be15783b7fbf", + "reference": "000df7860439609837bbe28670b0be15783b7fbf", "shasum": "" }, "require": { @@ -5320,7 +5320,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php84/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-php84/tree/v1.32.0" }, "funding": [ { @@ -5336,7 +5336,7 @@ "type": "tidelift" } ], - "time": "2024-09-09T12:04:04+00:00" + "time": "2025-02-20T12:04:08+00:00" }, { "name": "symfony/process", @@ -7480,16 +7480,16 @@ }, { "name": "twig/extra-bundle", - "version": "v3.20.0", + "version": "v3.21.0", "source": { "type": "git", "url": "https://github.com/twigphp/twig-extra-bundle.git", - "reference": "9df5e1dbb6a68c0665ae5603f6f2c20815647876" + "reference": "62d1cf47a1aa009cbd07b21045b97d3d5cb79896" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/9df5e1dbb6a68c0665ae5603f6f2c20815647876", - "reference": "9df5e1dbb6a68c0665ae5603f6f2c20815647876", + "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/62d1cf47a1aa009cbd07b21045b97d3d5cb79896", + "reference": "62d1cf47a1aa009cbd07b21045b97d3d5cb79896", "shasum": "" }, "require": { @@ -7538,7 +7538,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.20.0" + "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.21.0" }, "funding": [ { @@ -7550,20 +7550,20 @@ "type": "tidelift" } ], - "time": "2025-02-08T09:47:15+00:00" + "time": "2025-02-19T14:29:33+00:00" }, { "name": "twig/twig", - "version": "v3.20.0", + "version": "v3.21.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "3468920399451a384bef53cf7996965f7cd40183" + "reference": "285123877d4dd97dd7c11842ac5fb7e86e60d81d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/3468920399451a384bef53cf7996965f7cd40183", - "reference": "3468920399451a384bef53cf7996965f7cd40183", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/285123877d4dd97dd7c11842ac5fb7e86e60d81d", + "reference": "285123877d4dd97dd7c11842ac5fb7e86e60d81d", "shasum": "" }, "require": { @@ -7617,7 +7617,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.20.0" + "source": "https://github.com/twigphp/Twig/tree/v3.21.1" }, "funding": [ { @@ -7629,7 +7629,7 @@ "type": "tidelift" } ], - "time": "2025-02-13T08:34:43+00:00" + "time": "2025-05-03T07:21:55+00:00" }, { "name": "webmozart/assert", @@ -7760,16 +7760,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.13.0", + "version": "1.13.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "024473a478be9df5fdaca2c793f2232fe788e414" + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/024473a478be9df5fdaca2c793f2232fe788e414", - "reference": "024473a478be9df5fdaca2c793f2232fe788e414", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c", + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c", "shasum": "" }, "require": { @@ -7808,7 +7808,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.13.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.1" }, "funding": [ { @@ -7816,7 +7816,7 @@ "type": "tidelift" } ], - "time": "2025-02-12T12:17:51+00:00" + "time": "2025-04-29T12:36:36+00:00" }, { "name": "nikic/php-parser", @@ -8315,16 +8315,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.22", + "version": "9.6.23", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c" + "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f80235cb4d3caa59ae09be3adf1ded27521d1a9c", - "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", + "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", "shasum": "" }, "require": { @@ -8335,7 +8335,7 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.12.1", + "myclabs/deep-copy": "^1.13.1", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=7.3", @@ -8398,7 +8398,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.22" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.23" }, "funding": [ { @@ -8409,12 +8409,20 @@ "url": "https://github.com/sebastianbergmann", "type": "github" }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, { "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", "type": "tidelift" } ], - "time": "2024-12-05T13:48:26+00:00" + "time": "2025-05-02T06:40:34+00:00" }, { "name": "sebastian/cli-parser", @@ -9655,21 +9663,21 @@ }, { "name": "symfony/maker-bundle", - "version": "v1.62.1", + "version": "v1.63.0", "source": { "type": "git", "url": "https://github.com/symfony/maker-bundle.git", - "reference": "468ff2708200c95ebc0d85d3174b6c6711b8a590" + "reference": "69478ab39bc303abfbe3293006a78b09a8512425" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/468ff2708200c95ebc0d85d3174b6c6711b8a590", - "reference": "468ff2708200c95ebc0d85d3174b6c6711b8a590", + "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/69478ab39bc303abfbe3293006a78b09a8512425", + "reference": "69478ab39bc303abfbe3293006a78b09a8512425", "shasum": "" }, "require": { "doctrine/inflector": "^2.0", - "nikic/php-parser": "^4.18|^5.0", + "nikic/php-parser": "^5.0", "php": ">=8.1", "symfony/config": "^6.4|^7.0", "symfony/console": "^6.4|^7.0", @@ -9727,7 +9735,7 @@ ], "support": { "issues": "https://github.com/symfony/maker-bundle/issues", - "source": "https://github.com/symfony/maker-bundle/tree/v1.62.1" + "source": "https://github.com/symfony/maker-bundle/tree/v1.63.0" }, "funding": [ { @@ -9743,20 +9751,20 @@ "type": "tidelift" } ], - "time": "2025-01-15T00:21:40+00:00" + "time": "2025-04-26T01:41:37+00:00" }, { "name": "symfony/phpunit-bridge", - "version": "v7.2.0", + "version": "v7.2.6", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "2bbde92ab25a0e2c88160857af7be9db5da0d145" + "reference": "6106ae85a0e3ed509d339b7f924788c9cc4e7cfb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/2bbde92ab25a0e2c88160857af7be9db5da0d145", - "reference": "2bbde92ab25a0e2c88160857af7be9db5da0d145", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/6106ae85a0e3ed509d339b7f924788c9cc4e7cfb", + "reference": "6106ae85a0e3ed509d339b7f924788c9cc4e7cfb", "shasum": "" }, "require": { @@ -9809,7 +9817,7 @@ "description": "Provides utilities for PHPUnit, especially user deprecation notices management", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v7.2.0" + "source": "https://github.com/symfony/phpunit-bridge/tree/v7.2.6" }, "funding": [ { @@ -9825,7 +9833,7 @@ "type": "tidelift" } ], - "time": "2024-11-13T16:15:23+00:00" + "time": "2025-04-09T08:35:42+00:00" }, { "name": "symfony/web-profiler-bundle", diff --git a/src/Controller/AnnouncementController.php b/src/Controller/AnnouncementController.php index 3a5fde2..19899a7 100644 --- a/src/Controller/AnnouncementController.php +++ b/src/Controller/AnnouncementController.php @@ -3,7 +3,7 @@ namespace App\Controller; use App\Entity\Announcement; -use App\Entity\Employee; +use App\Entity\Intern; use App\Form\AnnouncementType; use App\Repository\AnnouncementRepository; use App\Repository\InternApplicationRepository; @@ -41,6 +41,19 @@ final class AnnouncementController extends AbstractController } } + if (in_array('ROLE_INTERN', $user->getRoles())) { + $showFavorites = $request->query->get('show_favorites'); + + /** @var Intern $intern */ + $intern = $user; + + if ($showFavorites) { + $announcements = $this->announcementRepository->findFavoritesByIntern($intern); + } else { + $announcements = $this->announcementRepository->findBy(['status' => 'Verified']); + } + } + if (in_array('ROLE_EMPLOYEE', $user->getRoles())) { $company = $user->getCompany(); @@ -49,10 +62,6 @@ final class AnnouncementController extends AbstractController } } - if (in_array('ROLE_INTERN', $user->getRoles())) { - $announcements = $this->announcementRepository->findBy(['status' => 'Verified']); - } - if ($companyName || $location || $category) { $announcements = $this->announcementRepository->searchAnnouncements($companyName, $location, $category); } @@ -69,6 +78,7 @@ final class AnnouncementController extends AbstractController 'announcements' => $announcements, 'favorites' => $favorites, 'showNonValidated' => $request->query->get('show_non_validated', false), + 'showFavorites' => $request->query->get('show_favorites', false) ]); } @@ -77,13 +87,17 @@ final class AnnouncementController extends AbstractController #[Route('/new', name: 'app_announcement_new', methods: ['GET', 'POST'])] public function new(Request $request,): Response { - $user = $this->getUser(); + /*$user = $this->getUser(); - if (!$user instanceof Employee) { - $this->addFlash('error', "Vous n'etes pas autorisé à faire cette action."); - return $this->redirectToRoute('app_index'); - } - $company = $user->getCompany(); + if (in_array('ROLE_EMPLOYEE', $user->getRoles())) { + $company = $user->getCompany(); + + if (!$company) + { + echo "Compétez votre profile avant de créer une annonce"; + $this->redirectToRoute('app_user_edit',['id' => $user->getId(),]); + } + }*/ $announcement = new Announcement(); $form = $this->createForm(AnnouncementType::class, $announcement); @@ -92,7 +106,6 @@ final class AnnouncementController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $announcement->setCreationDate(new \DateTime()); $announcement->setStatus('notVerified'); - $announcement->setCompany($company); $this->entityManager->persist($announcement); $this->entityManager->flush(); @@ -102,7 +115,6 @@ final class AnnouncementController extends AbstractController return $this->render('announcement/new.html.twig', [ 'announcement' => $announcement, 'form' => $form, - 'company' => $company, ]); } diff --git a/src/Controller/SkillController.php b/src/Controller/SkillController.php index 9cab9e8..a6b66e6 100644 --- a/src/Controller/SkillController.php +++ b/src/Controller/SkillController.php @@ -19,7 +19,7 @@ final class SkillController extends AbstractController { public function __construct( private readonly EntityManagerInterface $entityManager, - private readonly AnnouncementRepository $skillRepository, + private readonly SkillRepository $skillRepository, ){} #[Route(name: 'app_skill_index', methods: ['GET'])] public function index(): Response diff --git a/src/Repository/AnnouncementRepository.php b/src/Repository/AnnouncementRepository.php index 0e0094b..064af71 100644 --- a/src/Repository/AnnouncementRepository.php +++ b/src/Repository/AnnouncementRepository.php @@ -3,6 +3,7 @@ namespace App\Repository; use App\Entity\Announcement; +use App\Entity\Intern; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; @@ -38,28 +39,13 @@ class AnnouncementRepository extends ServiceEntityRepository return $queryBuilder->getQuery()->getResult(); } - // /** - // * @return Announcement[] Returns an array of Announcement objects - // */ - // public function findByExampleField($value): array - // { - // return $this->createQueryBuilder('a') - // ->andWhere('a.exampleField = :val') - // ->setParameter('val', $value) - // ->orderBy('a.id', 'ASC') - // ->setMaxResults(10) - // ->getQuery() - // ->getResult() - // ; - // } - - // public function findOneBySomeField($value): ?Announcement - // { - // return $this->createQueryBuilder('a') - // ->andWhere('a.exampleField = :val') - // ->setParameter('val', $value) - // ->getQuery() - // ->getOneOrNullResult() - // ; - // } + public function findFavoritesByIntern(Intern $intern): array + { + return $this->createQueryBuilder('a') + ->innerJoin('a.favoritesInterns', 'fav') + ->andWhere('fav.intern = :intern') + ->setParameter('intern', $intern) + ->getQuery() + ->getResult(); + } } diff --git a/templates/announcement/index.html.twig b/templates/announcement/index.html.twig index 41e9939..f601196 100644 --- a/templates/announcement/index.html.twig +++ b/templates/announcement/index.html.twig @@ -16,6 +16,17 @@ {% endif %} + {% if 'ROLE_INTERN' in app.user.roles %} +
+ {% endif %} + + {% if 'ROLE_EMPLOYEE' in app.user.roles %} diff --git a/templates/announcement/show.html.twig b/templates/announcement/show.html.twig index 112e78e..4395871 100644 --- a/templates/announcement/show.html.twig +++ b/templates/announcement/show.html.twig @@ -59,16 +59,6 @@ Candidater à cette offre - - {% endif %} {% if 'ROLE_ADMIN' in app.user.roles %} @@ -88,6 +78,20 @@ {% endif %} + + {% endif %} + + {% if 'ROLE_INTERN' in app.user.roles %} + + {% endif %} diff --git a/templates/degree/index.html.twig b/templates/degree/index.html.twig index b5b86e8..f394046 100644 --- a/templates/degree/index.html.twig +++ b/templates/degree/index.html.twig @@ -56,11 +56,23 @@ - - + {% if 'ROLE_INTERN' in app.user.roles %} +Prénom : {{ app.user.lastName }}
Adresse : {{ app.user.address }}
Téléphone : {{ app.user.tel }}
-Email : {{ app.user.mail }}
+Email : {{ app.user.mail }}
Sélectionner vos compétences - - -