-
Notifications
You must be signed in to change notification settings - Fork 177
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
[FEATURE] Doctrine ORM 3.0 & DBAL 4.0 & Doctrine Coding Standard #582
Merged
TomHAnderson
merged 38 commits into
laravel-doctrine:3.0.x
from
TomHAnderson:feature/doctrine-coding-standard
Oct 10, 2024
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
c40e73c
Upgrade to orm 3
TomHAnderson 0ae7f7d
Correct getSQLDeclaration function declarations
TomHAnderson 62e1826
Fixed function declarations for LaravelNamingStrategy
TomHAnderson 4ef108e
tablesExist takes an array
TomHAnderson 8f662cf
Send className to joinColumnName
TomHAnderson f40f0ec
Replaced all instances of annotations
TomHAnderson eb63332
Removed annotations from tests
TomHAnderson 6b77cb5
Removed simplifiedyaml
TomHAnderson 085c395
Removed YAML driver
TomHAnderson 46326f3
Fixed no SQLFilter returned
TomHAnderson ea07093
Don't use XML driver class as a mockery
TomHAnderson 9ad4551
Run of phpunit fixes
TomHAnderson 372d133
Refactored FactoryBuilderTest
TomHAnderson 6eed205
QueryBuilder tests skipped
TomHAnderson 6627326
Revisited DoctrinePersistenceVerifierTest
TomHAnderson 6195d6a
Fixed test_get_alias_namespace_from_unknown_namespace
TomHAnderson 8ef8ced
Removed TablePrefixListener
TomHAnderson 3cdf7f8
test_second_level_caching_can_be_enabled adjusted for mocked methods
TomHAnderson 6fb5e3a
Fixed naming strategy
TomHAnderson 9ed4d44
deleteExisting always returns int
TomHAnderson 1e72961
Fixed paginator adapter test; field mappings are now objects
TomHAnderson 0e48df0
Fixed faker data for DoctrinePresenceVerifier
TomHAnderson 0d54abe
Update package versions; remove yaml
TomHAnderson b0a552b
Default to attributes metadata
TomHAnderson c23a8bd
Moved tests to Feature directory to make room for non-tests in tests dir
TomHAnderson 7f34b09
Use dir in tests for custom path test
TomHAnderson 8efc717
Use test path for doctrine-cache and cleanup afterwords
TomHAnderson 899ea96
Added Doctrine Coding Standard to src
TomHAnderson 16409cc
phpunit passing
TomHAnderson a321c39
Added test script to composer
TomHAnderson 873e6be
Added self to project
TomHAnderson 256e9b5
Added php-parallel-lint
TomHAnderson 4dd88ca
Removed doctrine/cache
TomHAnderson 50f6bd1
Added coverage script to composer.json
TomHAnderson 12699ec
Added coding standards workflow
TomHAnderson a3fe0eb
Copied continuous integration from doctrine-orm-graphql
TomHAnderson 4e65814
Removed old CI workflow
TomHAnderson d5b54bb
Dropped support for Laravel 9
TomHAnderson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: "Coding Standards" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "*.x" | ||
- "main" | ||
push: | ||
branches: | ||
- "*.x" | ||
- "main" | ||
|
||
jobs: | ||
coding-standards: | ||
name: "Coding Standards" | ||
uses: "doctrine/.github/.github/workflows/[email protected]" | ||
with: | ||
php-version: '8.1' | ||
composer-options: '--prefer-dist --ignore-platform-req=php' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: "Continuous Integration" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "*.x" | ||
- "main" | ||
push: | ||
branches: | ||
- "*.x" | ||
- "main" | ||
|
||
jobs: | ||
phpunit: | ||
name: "PHPUnit" | ||
runs-on: "ubuntu-20.04" | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: | ||
- "8.1" | ||
- "8.2" | ||
- "8.3" | ||
dependencies: | ||
- "highest" | ||
- "lowest" | ||
optional-dependencies: | ||
- true | ||
- false | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: "Install PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
coverage: "pcov" | ||
ini-values: "zend.assertions=1" | ||
extensions: "pdo_mysql" | ||
|
||
- name: "Install dependencies with Composer" | ||
uses: "ramsey/composer-install@v1" | ||
with: | ||
dependency-versions: "${{ matrix.dependencies }}" | ||
composer-options: "--prefer-dist" | ||
|
||
- name: "Show Composer packages" | ||
run: "composer show" | ||
|
||
- name: "Run PHPUnit" | ||
run: "vendor/bin/phpunit --coverage-clover=coverage.xml" | ||
|
||
- name: "Upload coverage file" | ||
uses: "codecov/codecov-action@v4" | ||
with: | ||
name: "phpunit-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ matrix.dbal-version }}.coverage" | ||
files: "./coverage.xml" | ||
|
||
upload_coverage: | ||
name: "Upload coverage to Codecov" | ||
runs-on: "ubuntu-20.04" | ||
needs: | ||
- "phpunit" | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: "Download coverage files" | ||
uses: "actions/download-artifact@v4" | ||
with: | ||
path: "reports" | ||
|
||
- name: "Upload to Codecov" | ||
uses: "codecov/codecov-action@v2" | ||
with: | ||
directory: "reports" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Patrick Brouwers | ||
Copyright (c) 2024 Tom H Anderson <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,38 +13,43 @@ | |
{ | ||
"name": "Patrick Brouwers", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Tom H Anderson", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.0", | ||
"doctrine/annotations": "^2", | ||
"doctrine/dbal": "^3.2", | ||
"doctrine/orm": "^2.14", | ||
"doctrine/persistence": "^3", | ||
"illuminate/auth": "^9.0|^10.0|^11.0", | ||
"illuminate/console": "^9.0|^10.0|^11.0", | ||
"illuminate/container": "^9.0|^10.0|^11.0", | ||
"illuminate/contracts": "^9.0|^10.0|^11.0", | ||
"illuminate/pagination": "^9.0|^10.0|^11.0", | ||
"illuminate/routing": "^9.0|^10.0|^11.0", | ||
"illuminate/support": "^9.0|^10.0|^11.0", | ||
"illuminate/validation": "^9.0|^10.0|^11.0", | ||
"illuminate/view": "^9.0|^10.0|^11.0", | ||
"php": "^8.1", | ||
"doctrine/dbal": "^4.1", | ||
"doctrine/orm": "^3.1", | ||
"doctrine/persistence": "^3.3", | ||
"illuminate/auth": "^10.0|^11.0", | ||
"illuminate/console": "^10.0|^11.0", | ||
"illuminate/container": "^10.0|^11.0", | ||
"illuminate/contracts": "^10.0|^11.0", | ||
"illuminate/pagination": "^10.0|^11.0", | ||
"illuminate/routing": "^10.0|^11.0", | ||
"illuminate/support": "^10.0|^11.0", | ||
"illuminate/validation": "^10.0|^11.0", | ||
"illuminate/view": "^10.0|^11.0", | ||
"symfony/cache": "^6.0|^7.0", | ||
"symfony/serializer": "^5.0|^6.0|^7.0", | ||
"symfony/yaml": "^5.0|^6.0|^7.0" | ||
"symfony/serializer": "^5.0|^6.0|^7.0" | ||
}, | ||
"conflict": { | ||
"laravel/lumen": "*" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.3", | ||
"mockery/mockery": "^1.3.1", | ||
"mockery/mockery": "^1.6.12", | ||
"illuminate/log": "^9.0|^10.0|^11.0", | ||
"illuminate/notifications": "^9.0|^10.0|^11.0", | ||
"illuminate/queue": "^9.0|^10.0|^11.0", | ||
"phpstan/phpstan": "^1.9", | ||
"phpstan/phpstan-deprecation-rules": "^1.1" | ||
"phpstan/phpstan-deprecation-rules": "^1.1", | ||
"doctrine/coding-standard": "^12.0", | ||
"php-parallel-lint/php-parallel-lint": "^1.4", | ||
"vimeo/psalm": "^0.3.14" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
|
@@ -78,5 +83,18 @@ | |
"EntityManager": "LaravelDoctrine\\ORM\\Facades\\EntityManager" | ||
} | ||
} | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"dealerdirect/phpcodesniffer-composer-installer": true | ||
} | ||
}, | ||
"scripts": { | ||
"test": [ | ||
"vendor/bin/parallel-lint src tests", | ||
"vendor/bin/phpcs", | ||
"vendor/bin/phpunit" | ||
], | ||
"coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html=coverage" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<ruleset> | ||
<arg name="basepath" value="."/> | ||
<arg name="extensions" value="php"/> | ||
<arg name="parallel" value="80"/> | ||
<arg name="cache" value=".phpcs-cache"/> | ||
<arg name="colors"/> | ||
|
||
<!-- Ignore warnings, show progress of the run and show sniff names --> | ||
<arg value="nps"/> | ||
|
||
<!-- Directories to be checked --> | ||
<file>src</file> | ||
|
||
<!-- Include full Doctrine Coding Standard --> | ||
<rule ref="Doctrine"/> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LaravelDoctrine\ORM; | ||
|
||
use Doctrine\DBAL\Schema\Column; | ||
use Doctrine\DBAL\Schema\Index; | ||
use Doctrine\DBAL\Schema\Table; | ||
use Doctrine\DBAL\Types\Type; | ||
|
||
/** @interal */ | ||
// phpcs:disable SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix | ||
abstract class AbstractTable | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected string $table; | ||
|
||
/** | ||
* @param string $table | ||
*/ | ||
public function __construct(string $table) | ||
public function __construct(protected string $table) | ||
{ | ||
$this->table = $table; | ||
} | ||
|
||
/** | ||
* @return Table | ||
*/ | ||
public function build(): Table | ||
{ | ||
return new Table( | ||
$this->table, | ||
$this->columns(), | ||
$this->indices() | ||
$this->indices(), | ||
); | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* @param string $type | ||
* @param bool $autoincrement | ||
* @return Column | ||
*/ | ||
protected function column($name, string $type, bool $autoincrement = false): Column | ||
protected function column(string $name, string $type, bool $autoincrement = false): Column | ||
{ | ||
$column = new Column($name, Type::getType($type)); | ||
$column->setAutoincrement($autoincrement); | ||
|
||
return $column; | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* @param string[] $columns | ||
* @param bool $unique | ||
* @param bool $primary | ||
* @return Index | ||
*/ | ||
/** @param string[] $columns */ | ||
protected function index(string $name, array $columns, bool $unique = false, bool $primary = false): Index | ||
{ | ||
return new Index($name, $columns, $unique, $primary); | ||
} | ||
|
||
/** | ||
* @return Column[] | ||
*/ | ||
abstract protected function columns(); | ||
/** @return Column[] */ | ||
abstract protected function columns(): array; | ||
|
||
/** | ||
* @return Index[] | ||
*/ | ||
abstract protected function indices(); | ||
/** @return Index[] */ | ||
abstract protected function indices(): array; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this is handled on this repository usually, but it might be smart to create releases that support ORM 2 and 3 first, so people can migrate one package at a time. Same for DBAL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ORM 3 requires DBAL 4. What my PR proposes is a major version release without a path to migrate "gracefully".
This library is sorely lacking support for the latest Doctrine libraries. If version 2 of this library still works for folks, that's fine. But constant progress on this library is non-existent. It's like the whole team (10 of you?) has dropped their assumed goal of maintaining a world-class library.
It's not uncommon for older packages to lose traction after some time, but this library is the best solution to Doctrine ORM in Laravel and both those projects continue to mature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the Doctrine team is not related to this library. I have been the sole "maintainer" of this library for several years. But I almost never contribute myself, it's up to the community to provide pull requests, unless none have provided a pull request before laravel goes out of security updates.
Yes, laravel-doctrine needs a proper maintainer which can lift this package up to latest standard and keep constant progress.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this isn't you:
https://github.com/laravel-doctrine/orm/blob/2.0/LICENSE#L3
And this isn't you:
https://github.com/laravel-doctrine/orm/blob/2.0/composer.json#L14-L15
I would like to be that proper maintainer for this organization. I have many Doctrine ORM and Laravel libraries at https://github.com/api-skeletons I am also a member of the Doctrine open source team. My latest project, the LDOG Stack, https://github.com/api-skeletons/ldog, relies on this library as well as my other projects. Reviving this resource is in my best interest.
To see my latest work please review https://github.com/api-skeletons/doctrine-orm-graphql (and be sure to see the documentation).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont feel that I have contributed enough to this repo that I feel I should be on those lists.. :)
I will take a look at your profile. I don't think it will be any problem of giving you access 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see in this composer.json, libraries can be compatible with both ORM 2 and 3 and DBAL 3 and 4.
https://github.com/API-Skeletons/doctrine-orm-graphql/blob/12.2.x/composer.json#L14-L22
I don't foresee version 3 of this library trying to do the same. So I think to catch this library up, ORM 3 should be supported at the highest versions.