Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(be!): migrate Laravel to Symfony #70

Merged
merged 62 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
2253f5f
$ composer create-project symfony/skeleton:"7.1.*" symfony
n0099 Sep 27, 2024
295fb07
$ composer require symfony/orm-pack @ symfony
n0099 Sep 27, 2024
362cbf1
$ composer require --dev symfony/test-pack @ symfony
n0099 Sep 27, 2024
31b568a
$ composer require symfony/asset @ symfony
n0099 Sep 27, 2024
02d6902
$ composer require --dev symfony/profiler-pack @ symfony
n0099 Sep 27, 2024
46c2288
$ composer require --dev symfony/debug-bundle @ symfony
n0099 Sep 27, 2024
dae03d1
$ composer require --dev symfony/maker-bundle @ symfony
n0099 Sep 27, 2024
97d8491
$ composer require symfony/twig-bundle # already required by symfony/…
n0099 Sep 28, 2024
1587bf7
$ composer remove doctrine/doctrine-migrations-bundle @ symfony
n0099 Sep 29, 2024
233752c
+ `App\Doctrine\AlwaysQuoteStrategy` to prevent explicitly quoting ev…
n0099 Oct 1, 2024
eedc563
+ abstract class `Post` like `tbm.Crawler.Db.Post.IPost` in `c#`
n0099 Oct 1, 2024
993a77a
+ entity classes `App\Entity\Post\Content\(Post|(Sub)?Reply)Content` …
n0099 Oct 1, 2024
84fd4c5
* remove the value of `APP_SECRET` to fix https://dashboard.gitguardi…
n0099 Oct 1, 2024
787d700
* inline prop `tid` into derived classes to fix https://github.com/do…
n0099 Oct 1, 2024
400757b
$ composer require symfony/serializer-pack @ symfony
n0099 Oct 1, 2024
b0a6b25
* mark concrete classes in `App\Repository\Post` except `PostReposito…
n0099 Oct 1, 2024
7513509
* sync composer packages between `symfony` & `be`
n0099 Oct 1, 2024
f4c1b07
* update php version and requiring extensions for removing `symfony/p…
n0099 Oct 1, 2024
9b9b4b9
+ `App\Entity\BlobResourceGetter` like `App\Eloquent\ModelAttributeMa…
n0099 Oct 1, 2024
4a304f5
* add `?? 0` for some props like `App\Eloquent\NullableNumericAttribu…
n0099 Oct 4, 2024
fdd7145
+ entity classes `BilibiliVote`, `Forum`, `LatestReplier` & `User` an…
n0099 Oct 4, 2024
5c4ea01
+ entity classes AuthorExpGrade` & `ForumModerator` and their reposit…
n0099 Oct 4, 2024
75ae379
$ mv {be,symfony}/public/react-json-view
n0099 Oct 5, 2024
5a0416d
+ `App\Controller\AssetController` like `Route::get('/assets/{filenam…
n0099 Oct 5, 2024
feccb70
$ composer remove doctrine/dbal phpdocumentor/reflection-docblock php…
n0099 Oct 5, 2024
3be6b04
* replace the default normalizer for serializer `ObjectNormalizer` th…
n0099 Oct 5, 2024
49cfae0
$ composer require symfony/validator
n0099 Oct 6, 2024
7b94b65
+ `App\Helper` like its nameshake in `be`
n0099 Oct 6, 2024
7c51c86
+ `App\Controller\SitemapController`
n0099 Oct 6, 2024
e880e9c
* tweak whitespace control for twig templates following https://symfo…
n0099 Oct 6, 2024
e6148a9
+ `App\EventListener\ExceptionToJsonResponse` to serialize `HttpExcep…
n0099 Oct 6, 2024
a612428
$ rm Entity/BilibiliVote.php Repository/BilibiliVoteRepository.php
n0099 Oct 6, 2024
7c2de88
+ class `ParamsValidator` and replace laravel validator rules in `val…
n0099 Oct 6, 2024
3efff82
+ `App\PostsQuery\CursorCodec` like its namesake class in `be`
n0099 Oct 7, 2024
95e4c72
$ composer require symfony/stopwatch # partial revert feccb70b30136af…
n0099 Oct 7, 2024
872e0e6
$ cp {be/app/Http/Controllers,symfony/src/Controller}/PostsQuery.php
n0099 Oct 7, 2024
a9c16f0
+ `selectCurrentAndParentPostID()` & abstract `getTableNameSuffix()` …
n0099 Oct 7, 2024
9a3b1fa
* migrate files that copied from `be` in 872e0e6d2ed116220fd3fc6b3fba…
n0099 Oct 7, 2024
39d0f00
+ `ForumsController` like route `/forums` in `be`
n0099 Oct 7, 2024
c79a749
+ `hasQueryResultMorePages()` to reuse between `setResult()` & `Users…
n0099 Oct 7, 2024
8483414
* fix not accepting int typed value for numeric params: https://www.p…
n0099 Oct 8, 2024
32fbf13
* fix `QueryBuilder->orderBy()` will override previous orders @ `$ord…
n0099 Oct 8, 2024
338d4a2
+ props `$current(ForumModerator|AuthorExpGrade)` and their g/setter …
n0099 Oct 8, 2024
8de7b4d
* manually query `PostContent` entities for reply and sub replies and…
n0099 Oct 8, 2024
7521aa4
* manually query partial projected DTO of entities `AuthorExpGrade` &…
n0099 Oct 8, 2024
cc7ec13
* partial revert 3be6b04cfdda4565d340acc8019211e73f67e3af to remove f…
n0099 Oct 8, 2024
eb0f3e8
* partial revert 32fbf136dece796a8501064c4a7bf26d637a1a72 @ `reOrderN…
n0099 Oct 8, 2024
52e4e48
* fix appending AND predicate for each cursor without parenthesis
n0099 Oct 8, 2024
6b40d87
* fix overwriting existing SQL param with the same name by distinguis…
n0099 Oct 9, 2024
0302713
* migrate config files of php-cs-fixer, pint, phpmd, phpstan, psalm, …
n0099 Oct 9, 2024
b726482
* move phpunit tests from `be` to `symfony`
n0099 Oct 9, 2024
97bf3ed
* move phpunit test files to match with current namespace hierarchy
n0099 Oct 9, 2024
6404930
* replace dependency `SerializerInterface $serializer` with `Normaliz…
n0099 Oct 9, 2024
af67ff2
* migrate phpunit tests to use `Symfony\Bundle\FrameworkBundle\Test\K…
n0099 Oct 9, 2024
b531590
$ rm -r be && mv symfony be
n0099 Oct 9, 2024
6aa5b87
$ ./vendor/bin/pint @ be
n0099 Oct 9, 2024
4156bf6
* fix all violations of phpcs rule
n0099 Oct 9, 2024
4b9914a
* install php extension `intl` when running on Windows @ .github/acti…
n0099 Oct 9, 2024
44a63fe
+ setter method of each prop for all entities
n0099 Oct 9, 2024
ac19173
$ composer require symfony/property-access # partial revert feccb70b3…
n0099 Oct 9, 2024
950be34
* fix passing empty entities by denormalize the array with props valu…
n0099 Oct 9, 2024
722c039
$ git merge v2 -X ours
n0099 Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/actions/be/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ runs:
opcache.enable_cli=1, opcache.memory_consumption=256,
opcache.jit=tracing, opcache.jit_buffer_size=64M
# https://github.com/shivammathur/setup-php/wiki/Php-extensions-loaded-on-windows-2022/aee619eb6d77e86b17a76d458316b41e58a3b677
extensions: fileinfo # league/flysystem-local@3.28.0 requires ext-fileinfo but it's not enabled by default on windows
# league/flysystem-local@3.28.0 requires ext-fileinfo but it's not enabled by default on windows
extensions: ${{ runner.os == 'Windows' && 'intl, fileinfo' || '' }}
env:
update: 'true' # https://github.com/shivammathur/setup-php/blob/2.31.1/README.md#force-update-setup
# https://github.com/shivammathur/setup-php/blob/2.31.1/README.md#problem-matchers
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/be_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/be
- run: >
./vendor/bin/phpstan analyse --error-format=checkstyle
./vendor/bin/phpstan analyze --error-format=checkstyle
| tee >(cs2pr --notices-as-warnings --graceful-warnings --prepend-filename --prepend-source)
shell: bash

Expand Down
18 changes: 0 additions & 18 deletions be/.editorconfig

This file was deleted.

33 changes: 33 additions & 0 deletions be/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

APP_BASE_URL_ASSETS=
APP_BASE_URL_FE=

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# 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:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ###
25 changes: 0 additions & 25 deletions be/.env.example

This file was deleted.

6 changes: 6 additions & 0 deletions be/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
11 changes: 0 additions & 11 deletions be/.gitattributes

This file was deleted.

54 changes: 32 additions & 22 deletions be/.gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
.phpstorm.meta.php
_ide_helper*.php

# https://github.com/laravel/laravel/blob/master/.gitignore
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpactor.json
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
###< phpunit/phpunit ###

###> phpstan/phpstan ###
phpstan.neon
###< phpstan/phpstan ###

###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###

###> squizlabs/php_codesniffer ###
/.phpcs-cache
/phpcs.xml
###< squizlabs/php_codesniffer ###
File renamed without changes.
5 changes: 2 additions & 3 deletions be/.phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
<!-- https://github.com/squizlabs/PHP_CodeSniffer/issues/3291 -->
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/>
<exclude name="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore"/>
<exclude name="PSR12.ControlStructures.ControlStructureSpacing" />
</rule>
<arg name="extensions" value="php" />
<exclude-pattern>*.blade.php</exclude-pattern>
<exclude-pattern>_ide_helper*.php</exclude-pattern>
<!-- https://github.com/squizlabs/PHP_CodeSniffer/issues/2242 -->
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>bootstrap/cache/*</exclude-pattern>
<exclude-pattern>var/*</exclude-pattern>
</ruleset>
53 changes: 0 additions & 53 deletions be/app/Console/Commands/BatchTableSQLGenerator.php

This file was deleted.

74 changes: 0 additions & 74 deletions be/app/Console/Commands/GenerateBilibiliVote.php

This file was deleted.

27 changes: 0 additions & 27 deletions be/app/Console/Kernel.php

This file was deleted.

10 changes: 0 additions & 10 deletions be/app/Eloquent/Model/BilibiliVote.php

This file was deleted.

41 changes: 0 additions & 41 deletions be/app/Eloquent/Model/Forum.php

This file was deleted.

Loading
Loading