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

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

merged 62 commits into from
Oct 9, 2024

Conversation

n0099
Copy link
Owner

@n0099 n0099 commented Oct 1, 2024

https://en.wikipedia.org/wiki/Enshittification
https://en.wikipedia.org/wiki/Accel_(company)
https://news.ycombinator.com/item?id=41455906
https://archive.is/lUWnK
https://news.ycombinator.com/item?id=41456312
https://i.imgur.com/W6tzgbd.jpeg

https://v2ex.com/t/1063401

tpetry/laravel-postgresql-enhanced#69
laravel/framework#10847
laravel/framework#10857
laravel/ideas#2169
e77ebd3
https://github.com/jBernavaPrah/eloquent-binary-cast
https://wiki.php.net/rfc/resource_to_object_conversion
https://wiki.php.net/rfc/resource_typehint
https://www.php.net/manual/en/resource.php

https://plugins.jetbrains.com/plugin/13441-laravel-idea
https://old.reddit.com/r/laravel/comments/slf4xh/why_laravel_9_isnt_typed/
https://old.reddit.com/r/PHPhelp/comments/17fzmc8/why_does_noone_use_declarestrict_types_1_in/
https://old.reddit.com/r/laravel/comments/14u5pc2/next_level_type_checking_in_laravel/

https://old.reddit.com/r/PHP/comments/1azghus/is_this_an_accurate_description_of_laravel/
laravel/ideas#1508
laravel-idea/plugin#984
https://forums.phpfreaks.com/topic/314703-how-to-disable-facades-in-laravel/
57363c5

https://old.reddit.com/r/PHP/comments/1dlt33b/symfony_or_laravel/
https://old.reddit.com/r/laravel/comments/17m2gxz/if_i_can_do_laravel_how_will_i_get_on_with_symfony/
https://old.reddit.com/r/PHP/comments/18vxryp/team_lead_telling_me_symfony_is_dying_and_i/

https://old.reddit.com/r/PHP/comments/mms6eg/use_iluminatecollections_outside_laravel/
https://dev.to/juyn/using-laravel-s-collection-into-symfony-4nf8
https://github.com/tighten/collect

https://github.com/atrauzzi/laravel-doctrine
https://github.com/laravel-doctrine/orm

…web-profiler-bundle

$ composer require illuminate/collections # also required by spatie/symfony-ignition-bundle
$ composer require --dev spatie/symfony-ignition-bundle # to fix symfony/symfony#46457 as `highlight_file()` can be dangerous: https://book.hacktricks.xyz/network-services-pentesting/pentesting-web/php-tricks-esp/php-useful-functions-disable_functions-open_basedir-bypass#filesystem-functions
@ symfony
…ery case-sensitive column name with `#[Column(name: '"name"')]`: https://stackoverflow.com/questions/10471234/auto-quote-reserved-words-with-doctrine-2 https://stackoverflow.com/questions/29871735/why-doctrine2-doesnt-automatically-quote-all-sql-identifiers doctrine/orm#7815

+ `App\Repository\Post\PostRepositoryFactory` like `App\Eloquent\Model\Post\PostFactory` in `be`
+ `App\Repository\Post\ThreadRepository` with interpolated table name: https://stackoverflow.com/questions/30871721/doctrine2-dynamic-table-name-for-entity/49796901#49796901
+ `App\Entity\Post\Thread` like `tbm.Crawler.Db.PostThreadPost` in `c#`
@ symfony
+ entity class `Reply` & `SubReply`
* move some common props from `Thread` to `Post`
@ `Post`

+ abstract class `TimestampedEntity` like `tbm.Crawler.Db.TimestampedEntity` in `c#`
@ `App\Entity`

+ `PostRepository` to share common `__construct()` for derived classes
+ `ReplyRepository` & `SubReplyRepository`
+ method `new(Sub)?Reply()` @ `PostRepositoryFactory`
@ `App\Repository\Post`
@ symfony
…and their repo `App\Repository\Post\Content\(Post|(Sub)?Reply)ContentRepository`

+ method `new(Sub)?ReplyContent()` @ `App\Repository\Post\PostRepositoryFactory`
@ symfony
…an.com/core-alerting/incident-resolution/b60bf985-1310-4e10-ace9-c32ecc1cc65f/ despite symfony/symfony#38021 @ .env

- unused `template/base.html.twig` and empty `.gitignore` files that acts like `.gitkeep`
@ symfony
…Post`

* move common props `postedAt` & `(dis)?agreeCount` from derived classes of `Post` into it
@ `Post`

* mark abstract classes with attribute `MappedSuperclass`
@ `App\Entity`
@ symfony
$ composer require google/{protobuf,recaptcha} spatie/{laravel-collection-macros,regex} thecodingmachine/safe
$ composer require --dev friendsofphp/php-cs-fixer infection/infection laravel/pint phan/phan phpmd/phpmd phpstan/{extension-installer,phpstan-{deprecation,strict}-rules} phpunit/phpunit roave/security-advisories squizlabs/php_codesniffer thecodingmachine/phpstan-safe-rule vimeo/psalm
@ symfony
@n0099 n0099 marked this pull request as draft October 1, 2024 16:24
…e}', ...)` in `be/routes/web.php`

+ `PrettyJsonResponse` & `ShowReactJsonView` like `App\Http\Middleware\DumpJsonResponse` in `be`
+ `SerializeToJson` for allowing controller methods to return an array instead of instance of class `Response` directly like laravel
@ `App\EventListener`

+ var `ASSETS_BASE_URL` for config `framework.assets.base_urls` in `config/framework.yaml` @ .env
@ symfony
…stan/phpdoc-parser symfony/{browser-kit,console,css-selector,property-{access,info},stopwatch}

$ composer require --dev phpstan/phpstan-symfony psalm/plugin-symfony
@ symfony
…at requires `symfony/property-access` which has been removed in feccb70 with `GetSetMethodNormalizer` @ config/services.yaml

* now return the parsed protoBuf message directly without converting it to `stdClass` with `json_(de|en)code()` @ `BlobResourceGetter->protoBuf()`
* replace `resource|null` with `?resource` in phpdoc typing
@ `App\Entity`
@ symfony
$ composer bump
@ symfony
* fix referring `App\Entity\LatestReplier` @ `App\Repository\ForumRepository`
* replace `ParameterBagInterface->get()` with `AbstractController->getParameter()` @ `App\Controller\AssetController`
* lower priority to prevent dysfunction `#[Symfony\Bridge\Twig\Attribute\Template]` on controller routes that returning non `Response` @ `App\EventListener\SerializeToJson`

* rename var `ASSETS_BASE_URL` to `APP_BASE_URL_ASSETS`
+ `APP_BASE_URL_FE` for `parameters.app.base_url.fe` in `config/services.yaml`
@ .env
@ symfony
* rename phpunit test classes to match with current systems under test
* replace all references to `Tests\TestCase` in `be` with `Symfony\Bundle\FrameworkBundle\Test\KernelTestCase`
@ `App\Tests`
@ symfony
…erInterface $normalizer` for its only usages in `nestPostsWithParent()` @ `App\PostsQuery\BaseQuery->__construct()`, also affect all its derived classes

* convert param values to `DateTimeImmutable` to allow constraint `LessThanOrEqual` be able to compare them @ `App\Validator\DateTimeRangeValidator->validate()`
* wrap violations in root level key `errorInfo` and assign `errorCode=40000` to match with behavior in `be` @ `App\EventListener\ExceptionToJsonResponse->__invoke()`
* fix not accepting stringify int for param `userGender` and missing string typed constraint for text params @ `App\PostsQuery\ParamsValidator->validateParamValue()`
* mark param `$fid` as private prop and add getter for it @ `App\Repository\Post\PostRepository->__construct()`
@ symfony
…ernelTestCase` for dependency injection

+ `EventListener\PrettyJsonResponse` for testing `App\EventListener\PrettyJsonResponse` that splited from `EventListener\ShowReactJsonViewTest\testHandle()`
* rename methods to match with current methods of the system under test @ `Entity\BlobResourceGetterTest` & `EventListener\ExceptionToJsonResponseTest`
* update expected data to match with behavior changed in 52e4e48 @ `PostsQuery\CursorCodecTest->provideDecodeCursor()`
- `testXmlResponse()` and its data provider as `Helper::xmlResponse()` is not migrated in 7b94b65 @ `HelperTest`
@ `App\Tests`
@ symfony
@n0099 n0099 marked this pull request as ready for review October 9, 2024 18:20
@n0099 n0099 force-pushed the symfony branch 2 times, most recently from 053deac to 7f2b5ad Compare October 9, 2024 18:36
* excluding rule `PSR12.ControlStructures.ControlStructureSpacing` @ .phpcs.xml
$ rm phpcs.xml.dist # should be deleted in 0302713
* fix phpunit error `Class App\Entity\Post\Post does not have a property named unguarded` @ `App\Tests\PostsQuery\BaseQueryTest->provideNestPostsWithParent()`
@ be
@n0099 n0099 force-pushed the symfony branch 4 times, most recently from b4da414 to 435dd5c Compare October 9, 2024 19:48
- remove all phpdoc annotation `@noinspection PhpPropertyOnlyWrittenInspection`
@ be
…e into entity objects via their prop setter and filter out default values @ `(test|provide)NestPostsWithParent()`

+ dependency `DenormalizerInterface` for `testNestPostsWithParent()`
@ `App\Tests\PostsQuery\BaseQueryTest`
@ be
@n0099 n0099 force-pushed the symfony branch 7 times, most recently from 4504af1 to 950be34 Compare October 9, 2024 22:59
@n0099 n0099 merged commit 81f6c7b into v2 Oct 9, 2024
54 of 73 checks passed
@n0099 n0099 deleted the symfony branch October 9, 2024 23:05
@n0099
Copy link
Owner Author

n0099 commented Oct 9, 2024

@n0099
Copy link
Owner Author

n0099 commented Oct 9, 2024

https://en.wikipedia.org/wiki/Enshittification
https://en.wikipedia.org/wiki/Accel_(company)

https://www.v2ex.com/t/1078290
https://news.ycombinator.com/item?id=41707856

I'm excited to announce that we've raised $4.6 million in seed funding to pursue this vision. Our seed round was led by Accel, with participation from Amplify Partners, Preston-Werner Ventures, BGZ, Eric Simons (StackBlitz), Paul Copplestone (Supabase), David Cramer (Sentry), Matt Biilmann & Christian Bach (Netlify), Dafeng Guo (Strikingly), Sebastien Chopin (NuxtLabs), Johannes Schickling (Prisma), and Zeno Rocha (Resend).

https://twitter.com/yuxiyou/status/1842885186251640970
https://www.zhihu.com/question/745436269/answer/4227222766

这些所有人都知道了,其实骂affine和骂yyx的,是同一拨人
不管是协同画布,还是前端工具链,都是在已经非常过剩的产能上,继续跳舞,本来就僧多肉少,他们制造不出来肉,只好让僧更卷
当然,之所以要骂这俩货,最最最主要的原因是,完全,没有,任何,盈利,逻辑!
资本都是大傻逼,在这件事上,体现的淋漓尽致
这个时候肯定有人跳出来说,你觉得只是你觉得,我不要你觉的,我要傻逼觉得
你这么说,也没什么错,反正傻逼尤其多,特别是老外

p.s. 几年前yyx在群里就表达过他有个梦想就是搞个技术咨询公司,给大公司提供收费咨询,其实也就是thoughtworks那种技术皮包外包公司,这下他也算是变相梦想成真了?
yyx自始至终就是个资本家,我祝他成功,吧

https://www.v2ex.com/t/1078525

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant