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

Merge 2.18.x up into 3.0.x #11193

Merged
merged 21 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d98186e
Make Doctrine\Tests\ORM\Internal\Node autoloadable
greg0ire Jan 18, 2024
8503469
Merge pull request #11171 from greg0ire/extract-class
greg0ire Jan 18, 2024
0b3cd72
Remove references to JIRA
greg0ire Jan 20, 2024
dd478d8
Merge pull request #11178 from greg0ire/remove-ref-jira
greg0ire Jan 20, 2024
ac24c11
Modernize code in documentation (#11179)
greg0ire Jan 20, 2024
df730d6
Allow doctrine/lexer 3
greg0ire Jan 21, 2024
4bddab9
Look for lib remnants in hidden files
greg0ire Jan 21, 2024
c235242
Merge pull request #11181 from greg0ire/followup-rename
greg0ire Jan 21, 2024
7151db3
Throw exception when trying to use non-backed enum types
thePanz Jan 19, 2024
2d65bc2
Merge pull request #11180 from greg0ire/allow-lexer-3
greg0ire Jan 22, 2024
fbc8e67
Merge pull request #11176 from thePanz/fix-11173-get-name-on-null-non…
greg0ire Jan 23, 2024
020d31e
Remove remaining submodules (#11183)
greg0ire Jan 23, 2024
624c56b
Update branches in README
derrabus Jan 25, 2024
0970ce7
Merge pull request #11186 from derrabus/chore/readme-versions
greg0ire Jan 26, 2024
d386b43
Remove XML validation disabling deprecation.
jwage Jan 26, 2024
ccfc97c
Merge pull request #11187 from jwage/remove-xml-validation-disabling-…
greg0ire Jan 26, 2024
b988137
Ignore deprecations handled in next major
greg0ire Jan 28, 2024
82533af
Merge pull request #11191 from greg0ire/ignore-depr
greg0ire Jan 28, 2024
a9c45a3
Merge remote-tracking branch 'origin/2.17.x' into 2.17.x-merge-up-int…
greg0ire Jan 28, 2024
5b5b56d
Merge pull request #11190 from doctrine/2.17.x-merge-up-into-2.18.x_5…
greg0ire Jan 28, 2024
db4d00a
Merge remote-tracking branch 'origin/2.18.x' into 3.0.x
greg0ire Jan 28, 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
4 changes: 2 additions & 2 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- .github/workflows/coding-standards.yml
- bin/**
- composer.*
- lib/**
- src/**
- phpcs.xml.dist
- tests/**
push:
Expand All @@ -18,7 +18,7 @@ on:
- .github/workflows/coding-standards.yml
- bin/**
- composer.*
- lib/**
- src/**
- phpcs.xml.dist
- tests/**

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- .github/workflows/continuous-integration.yml
- ci/**
- composer.*
- lib/**
- src/**
- phpunit.xml.dist
- tests/**
push:
Expand All @@ -18,7 +18,7 @@ on:
- .github/workflows/continuous-integration.yml
- ci/**
- composer.*
- lib/**
- src/**
- phpunit.xml.dist
- tests/**

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/phpbench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
paths:
- .github/workflows/phpbench.yml
- composer.*
- lib/**
- src/**
- phpbench.json
- tests/**
push:
Expand All @@ -17,7 +17,7 @@ on:
paths:
- .github/workflows/phpbench.yml
- composer.*
- lib/**
- src/**
- phpbench.json
- tests/**

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
paths:
- .github/workflows/static-analysis.yml
- composer.*
- lib/**
- src/**
- phpstan*
- psalm*
- tests/Doctrine/StaticAnalysis/**
Expand All @@ -17,7 +17,7 @@ on:
paths:
- .github/workflows/static-analysis.yml
- composer.*
- lib/**
- src/**
- phpstan*
- psalm*
- tests/Doctrine/StaticAnalysis/**
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ logs/
reports/
dist/
download/
lib/api/
lib/Doctrine/Common
lib/Doctrine/DBAL
/.settings/
.buildpath
.project
Expand Down
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
| [3.0.x][3.0] | [2.16.x][2.16] | [2.15.x][2.15] |
| [3.0.x][3.0] | [2.18.x][2.18] | [2.17.x][2.17] |
|:----------------:|:----------------:|:----------:|
| [![Build status][3.0 image]][3.0] | [![Build status][2.16 image]][2.16] | [![Build status][2.15 image]][2.15] |
| [![Coverage Status][3.0 coverage image]][3.0 coverage]| [![Coverage Status][2.16 coverage image]][2.16 coverage] | [![Coverage Status][2.15 coverage image]][2.15 coverage] |
| [![Build status][3.0 image]][3.0] | [![Build status][2.18 image]][2.18] | [![Build status][2.17 image]][2.17] |
| [![Coverage Status][3.0 coverage image]][3.0 coverage]| [![Coverage Status][2.18 coverage image]][2.18 coverage] | [![Coverage Status][2.17 coverage image]][2.17 coverage] |

[<h1 align="center">🇺🇦 UKRAINE NEEDS YOUR HELP NOW!</h1>](https://www.doctrine-project.org/stop-war.html)

Expand All @@ -22,11 +22,11 @@ without requiring unnecessary code duplication.
[3.0]: https://github.com/doctrine/orm/tree/3.0.x
[3.0 coverage image]: https://codecov.io/gh/doctrine/orm/branch/3.0.x/graph/badge.svg
[3.0 coverage]: https://codecov.io/gh/doctrine/orm/branch/3.0.x
[2.16 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.16.x
[2.16]: https://github.com/doctrine/orm/tree/2.16.x
[2.16 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.16.x/graph/badge.svg
[2.16 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.16.x
[2.15 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.15.x
[2.15]: https://github.com/doctrine/orm/tree/2.15.x
[2.15 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.15.x/graph/badge.svg
[2.15 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.15.x
[2.18 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.18.x
[2.18]: https://github.com/doctrine/orm/tree/2.18.x
[2.18 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.18.x/graph/badge.svg
[2.18 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.18.x
[2.17 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.17.x
[2.17]: https://github.com/doctrine/orm/tree/2.17.x
[2.17 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.17.x/graph/badge.svg
[2.17 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.17.x
5 changes: 2 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ understand the assumptions we make.
- [DBAL Security Page](https://www.doctrine-project.org/projects/doctrine-dbal/en/stable/reference/security.html)
- [ORM Security Page](https://www.doctrine-project.org/projects/doctrine-orm/en/stable/reference/security.html)

If you find a Security bug in Doctrine, please report it on Jira and change the
Security Level to "Security Issues". It will be visible to Doctrine Core
developers and you only.
If you find a Security bug in Doctrine, please follow our
[Security reporting guidelines](https://www.doctrine-project.org/policies/security.html#reporting).
127 changes: 50 additions & 77 deletions docs/en/cookbook/aggregate-fields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,71 +36,50 @@ Our entities look like:
namespace Bank\Entities;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
*/
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

#[ORM\Entity]
class Account
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id;

/**
* @ORM\Column(type="string", unique=true)
*/
private string $no;

/**
* @ORM\OneToMany(targetEntity="Entry", mappedBy="account", cascade={"persist"})
*/
private array $entries;

/**
* @ORM\Column(type="integer")
*/
private int $maxCredit = 0;

public function __construct(string $no, int $maxCredit = 0)
{
$this->no = $no;
$this->maxCredit = $maxCredit;
$this->entries = new \Doctrine\Common\Collections\ArrayCollection();

#[ORM\OneToMany(targetEntity: Entry::class, mappedBy: 'account', cascade: ['persist'])]
private Collection $entries;


public function __construct(
#[ORM\Column(type: 'string', unique: true)]
private string $no,

#[ORM\Column(type: 'integer')]
private int $maxCredit = 0,
) {
$this->entries = new ArrayCollection();
}
}

/**
* @ORM\Entity
*/

#[ORM\Entity]
class Entry
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id;

/**
* @ORM\ManyToOne(targetEntity="Account", inversedBy="entries")
*/
private Account $account;

/**
* @ORM\Column(type="integer")
*/
private int $amount;

public function __construct(Account $account, int $amount)
{
$this->account = $account;
$this->amount = $amount;

public function __construct(
#[ORM\ManyToOne(targetEntity: Account::class, inversedBy: 'entries')]
private Account $account,

#[ORM\Column(type: 'integer')]
private int $amount,
) {
// more stuff here, from/to whom, stated reason, execution date and such
}

public function getAmount(): Amount
{
return $this->amount;
Expand Down Expand Up @@ -193,9 +172,8 @@ relation with this method:
public function addEntry(int $amount): void
{
$this->assertAcceptEntryAllowed($amount);

$e = new Entry($this, $amount);
$this->entries[] = $e;

$this->entries[] = new Entry($this, $amount);
}
}

Expand All @@ -213,18 +191,18 @@ Now look at the following test-code for our entities:
{
$account = new Account("123456", maxCredit: 200);
$this->assertEquals(0, $account->getBalance());

$account->addEntry(500);
$this->assertEquals(500, $account->getBalance());

$account->addEntry(-700);
$this->assertEquals(-200, $account->getBalance());
}

public function testExceedMaxLimit()
{
$account = new Account("123456", maxCredit: 200);

$this->expectException(Exception::class);
$account->addEntry(-1000);
}
Expand Down Expand Up @@ -285,22 +263,19 @@ entries collection) we want to add an aggregate field called
<?php
class Account
{
/**
* @ORM\Column(type="integer")
*/
#[ORM\Column(type: 'integer')]
private int $balance = 0;

public function getBalance(): int
{
return $this->balance;
}

public function addEntry(int $amount): void
{
$this->assertAcceptEntryAllowed($amount);

$e = new Entry($this, $amount);
$this->entries[] = $e;

$this->entries[] = new Entry($this, $amount);
$this->balance += $amount;
}
}
Expand Down Expand Up @@ -331,13 +306,13 @@ potentially lead to inconsistent state. See this example:
// The Account $accId has a balance of 0 and a max credit limit of 200:
// request 1 account
$account1 = $em->find(Account::class, $accId);

// request 2 account
$account2 = $em->find(Account::class, $accId);

$account1->addEntry(-200);
$account2->addEntry(-200);

// now request 1 and 2 both flush the changes.

The aggregate field ``Account::$balance`` is now -200, however the
Expand All @@ -357,10 +332,8 @@ Optimistic locking is as easy as adding a version column:

class Account
{
/**
* @ORM\Column(type="integer")
* @ORM\Version
*/
#[ORM\Column(type: 'integer')]
#[ORM\Version]
private int $version;
}

Expand Down
21 changes: 6 additions & 15 deletions docs/en/cookbook/resolve-target-entity-listener.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ A Customer entity
use Acme\CustomerModule\Entity\Customer as BaseCustomer;
use Acme\InvoiceModule\Model\InvoiceSubjectInterface;

/**
* @ORM\Entity
* @ORM\Table(name="customer")
*/
#[ORM\Entity]
#[ORM\Table(name: 'customer')]
class Customer extends BaseCustomer implements InvoiceSubjectInterface
{
// In our example, any methods defined in the InvoiceSubjectInterface
Expand All @@ -69,19 +67,12 @@ An Invoice entity
use Doctrine\ORM\Mapping AS ORM;
use Acme\InvoiceModule\Model\InvoiceSubjectInterface;

/**
* Represents an Invoice.
*
* @ORM\Entity
* @ORM\Table(name="invoice")
*/
#[ORM\Entity]
#[ORM\Table(name: 'invoice')]
class Invoice
{
/**
* @ORM\ManyToOne(targetEntity="Acme\InvoiceModule\Model\InvoiceSubjectInterface")
* @var InvoiceSubjectInterface
*/
protected $subject;
#[ORM\ManyToOne(targetEntity: InvoiceSubjectInterface::class)]
protected InvoiceSubjectInterface $subject;
}

An InvoiceSubjectInterface
Expand Down
5 changes: 2 additions & 3 deletions docs/en/reference/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ page only handles Security issues in the ORM.

- `DBAL Security Page <https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/security.html>`

If you find a Security bug in Doctrine, please report it on Jira and change the
Security Level to "Security Issues". It will be visible to Doctrine Core
developers and you only.
If you find a Security bug in Doctrine, please follow our
`Security reporting guidelines <https://www.doctrine-project.org/policies/security.html#reporting>`_.

User input and Doctrine ORM
---------------------------
Expand Down
3 changes: 0 additions & 3 deletions phpstan-dbal3.neon
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,3 @@ parameters:
message: '#Negated boolean expression is always false\.#'
paths:
- src/Mapping/Driver/AttributeDriver.php
- src/Mapping/Driver/SimplifiedXmlDriver.php
- src/Mapping/Driver/XmlDriver.php
- src/ORMSetup.php
3 changes: 0 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,3 @@ parameters:
message: '#Negated boolean expression is always false\.#'
paths:
- src/Mapping/Driver/AttributeDriver.php
- src/Mapping/Driver/SimplifiedXmlDriver.php
- src/Mapping/Driver/XmlDriver.php
- src/ORMSetup.php
Loading
Loading