Skip to content

Commit

Permalink
chore: upgraded symfony recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
dehy committed Dec 5, 2023
1 parent 248a136 commit 96bf243
Show file tree
Hide file tree
Showing 26 changed files with 1,769 additions and 1,336 deletions.
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8&charset=utf8mb4"
#DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=14&charset=utf8"
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=14&charset=utf8"
DATABASE_URL="mysql://symfony:ChangeMe@database:3306/app?serverVersion=10.11.5-MariaDB&charset=utf8mb4"
###< doctrine/doctrine-bundle ###

###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=doctrine://default
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###< symfony/messenger ###

###> symfony/mailer ###
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,7 @@ yarn-error.log
###< friendsofphp/php-cs-fixer ###

/REVISION

###> phpstan/phpstan ###
phpstan.neon
###< phpstan/phpstan ###
2 changes: 2 additions & 0 deletions assets/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);
10 changes: 7 additions & 3 deletions bin/phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ if (!ini_get('date.timezone')) {
}

if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
if (PHP_VERSION_ID >= 80000) {
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
} else {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
}
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
Expand Down
18 changes: 17 additions & 1 deletion config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
api_platform:
title: 'Mon Club de Tir à l''Arc'
title: 'Mon Club de Tir à l''Arc'
version: 1.0.0
formats:
jsonld: ['application/ld+json']
docs_formats:
jsonld: ['application/ld+json']
jsonopenapi: ['application/vnd.openapi+json']
html: ['text/html']
defaults:
stateless: true
cache_headers:
vary: ['Content-Type', 'Authorization', 'Origin']
extra_properties:
standard_put: true
rfc_7807_compliant_errors: true
event_listeners_backward_compatibility_layer: false
keep_legacy_inflector: false
8 changes: 7 additions & 1 deletion config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ doctrine:

# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '14'
#server_version: '15'

profiling_collect_backtrace: '%kernel.debug%'
types:
ArrowType: App\DBAL\Types\ArrowType
BowType: App\DBAL\Types\BowType
Expand All @@ -26,10 +27,14 @@ doctrine:
TargetTypeType: App\DBAL\Types\TargetTypeType
orm:
auto_generate_proxy_classes: true
enable_lazy_ghost_objects: true
report_fields_where_declared: true
validate_xml_mapping: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
type: attribute
is_bundle: false
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
Expand All @@ -45,6 +50,7 @@ when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
Expand Down
2 changes: 1 addition & 1 deletion config/packages/framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
annotations: false
http_method_override: false
handle_all_throwables: true
default_locale: fr
Expand All @@ -14,7 +15,6 @@ framework:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
storage_factory_id: session.storage.factory.native

#esi: true
#fragments: true
Expand Down
8 changes: 2 additions & 6 deletions config/packages/notifier.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
framework:
notifier:
#chatter_transports:
# slack: '%env(SLACK_DSN)%'
# telegram: '%env(TELEGRAM_DSN)%'
#texter_transports:
# twilio: '%env(TWILIO_DSN)%'
# nexmo: '%env(NEXMO_DSN)%'
chatter_transports:
texter_transports:
channel_policy:
# use chat/slack, chat/telegram, sms/twilio or sms/nexmo
urgent: ['email']
Expand Down
15 changes: 5 additions & 10 deletions config/packages/sentry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ when@prod:
options:
release: '%env(string:APP_REVISION)%'

# If you are using Monolog, you also need these additional configuration and services to log the errors correctly:
# If you are using Monolog, you also need this additional configuration to log the errors correctly:
# https://docs.sentry.io/platforms/php/guides/symfony/#monolog-integration
# register_error_listener: false
# register_error_handler: false

# monolog:
# handlers:
# sentry:
# type: service
# id: Sentry\Monolog\Handler

# services:
# Sentry\Monolog\Handler:
# arguments:
# $hub: '@Sentry\State\HubInterface'
# $level: !php/const Monolog\Logger::ERROR
# $bubble: false
# type: sentry
# level: !php/const Monolog\Logger::ERROR
# hub_id: Sentry\State\HubInterface
2 changes: 2 additions & 0 deletions config/packages/translation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ framework:
# dsn: '%env(LOCO_DSN)%'
# lokalise:
# dsn: '%env(LOKALISE_DSN)%'
# phrase:
# dsn: '%env(PHRASE_DSN)%'
8 changes: 2 additions & 6 deletions config/packages/webpack_encore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ webpack_encore:

# If you have multiple builds:
# builds:
# pass "frontend" as the 3rg arg to the Twig functions
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}

# frontend: '%kernel.project_dir%/public/frontend/build'

# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Put in config/packages/prod/webpack_encore.yaml
# cache: true
# pass the build name as the 3rd argument to the Twig functions
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}

framework:
assets:
Expand Down
3 changes: 3 additions & 0 deletions config/routes/security.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_security_logout:
resource: security.route_loader.logout
type: service
3 changes: 3 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ services:
Twig\Extra\Intl\IntlExtension:
alias: 'twig.extension.intl'

Doctrine\Common\Annotations\Reader:
class: Doctrine\Common\Annotations\AnnotationReader

# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"devDependencies": {
"@babel/core": "^7.20.7",
"@babel/preset-env": "^7.20.2",
"@babel/core": "^7.17.0",
"@babel/preset-env": "^7.16.0",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-regular-svg-icons": "^6.2.1",
Expand All @@ -11,7 +11,7 @@
"@symfony/stimulus-bridge": "^3.2.1",
"@symfony/stimulus-bridge-types": "^1.0.0",
"@symfony/ux-chartjs": "file:vendor/symfony/ux-chartjs/assets",
"@symfony/webpack-encore": "^4.2.0",
"@symfony/webpack-encore": "^4.0.0",
"@testing-library/dom": "^9.3.1",
"@types/bootstrap": "^5.2.6",
"@types/jest": "^29.5.4",
Expand All @@ -21,17 +21,17 @@
"chart.js": "^3.4.1",
"chartjs-plugin-annotation": "^2.1.2",
"chartjs-plugin-datalabels": "^2.2.0",
"core-js": "^3.27.2",
"core-js": "^3.23.0",
"file-loader": "^6.2.0",
"leaflet": "^1.9.3",
"pdfjs-dist": "^3.3.122",
"regenerator-runtime": "^0.13.11",
"regenerator-runtime": "^0.13.9",
"sass": "^1.58.0",
"sass-loader": "^13.2.0",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"webpack-notifier": "^1.15.0"
},
"license": "UNLICENSED",
Expand Down
9 changes: 9 additions & 0 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
parameters:
# level: 6
level: 3
paths:
- bin/
- config/
- public/
- src/
- tests/
5 changes: 0 additions & 5 deletions phpstan.neon

This file was deleted.

5 changes: 1 addition & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.6" />
</php>

<testsuites>
Expand All @@ -34,8 +34,5 @@
</listeners>

<extensions>
<extension class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension" />
<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--<extension class="Symfony\Component\Panther\ServerExtension" />-->
</extensions>
</phpunit>
5 changes: 0 additions & 5 deletions src/Entity/ContestEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
#[ORM\Entity(repositoryClass: ContestEventRepository::class)]
class ContestEvent extends Event
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;

#[ORM\Column(type: 'ContestType', nullable: true)]
private ?string $contestType = null;

Expand Down
9 changes: 5 additions & 4 deletions src/Entity/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
#[ORM\HasLifecycleCallbacks]
class Event implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;

#[ORM\ManyToOne(targetEntity: Club::class, inversedBy: 'events')]
#[ORM\JoinColumn]
protected ?Club $club = null;
Expand Down Expand Up @@ -76,10 +81,6 @@ class Event implements \Stringable

#[ORM\Column]
protected ?\DateTimeImmutable $updatedAt = null;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;

public function __construct()
{
Expand Down
4 changes: 0 additions & 4 deletions src/Entity/FreeTrainingEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@
#[ORM\Entity(repositoryClass: EventRepository::class)]
class FreeTrainingEvent extends Event
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
}
4 changes: 0 additions & 4 deletions src/Entity/HobbyContestEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@
#[ORM\Entity(repositoryClass: ContestEventRepository::class)]
class HobbyContestEvent extends ContestEvent
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
}
4 changes: 0 additions & 4 deletions src/Entity/TrainingEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@
#[ORM\Entity(repositoryClass: EventRepository::class)]
class TrainingEvent extends Event
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
}
Loading

0 comments on commit 96bf243

Please sign in to comment.