Compare commits

..

115 Commits

Author SHA1 Message Date
Luís Cobucci 434820973c Bump up version 2018-11-21 00:46:46 +01:00
Luís Cobucci 41ff526921 Merge pull request #6830 from Tobion/fix-collation-foreign-key
fix applying column options on foreign key columns
2018-11-21 00:41:17 +01:00
Luís Cobucci 0be52b0087 Isolate entities used by the new test
To ensure we don't have any unintended side-effect.
2018-11-21 00:20:20 +01:00
Tobias Schultze ee8dc496d9 Fix applying collation on foreign key columns 2018-11-21 00:20:15 +01:00
Luís Cobucci f80656cddf Merge pull request #7317 from protecinnovations/fix/7316-xml-order-by-dir-many-to-many
[XML] Fix default value of many-to-many order-by to ASC
2018-11-20 13:11:22 +01:00
Alex Denvir 72121c01ec [XML] Fix default value of many-to-many order-by to ASC 2018-11-20 12:33:29 +01:00
Luís Cobucci ac505390dd Merge pull request #7472 from seferov/patch-2
fix incorrect phpdoc typehint
2018-11-20 09:41:01 +01:00
Luís Cobucci 728e6e15c5 Merge pull request #7441 from asgrim/fix-getResult-type
$hydrationMode throughout can be a string as well as int (for custom modes)
2018-11-20 09:40:04 +01:00
Luís Cobucci d21305378c Merge pull request #7471 from alcaeus/fix-unloaded-metadata-parameter-processing
Fix parameter value processing for objects with unloaded metadata
2018-11-15 11:34:31 +01:00
Andreas Braun 0552749059 Fix parameter value processing for objects with unloaded metadata 2018-11-15 11:21:05 +01:00
Farhad Safarov fbd3fe95e4 fix incorrect phpdoc typehint 2018-11-13 13:01:10 +03:00
James Titcumb c6d02daee0 $hydrationMode throughout can be a string as well as int (for custom modes) 2018-11-12 13:58:42 +00:00
Luís Cobucci 5208035003 Merge pull request #7444 from naitsirch/fix/issue6968
Fixed URLs of doctrine-mapping.xsd in docs
2018-11-12 11:40:01 +01:00
Luís Cobucci d93956eff0 Use HTTPS endpoint for XML schema location 2018-11-12 11:29:32 +01:00
naitsirch b3b06d3e7d Fixed URLs of doctrine-mapping.xsd in docs
Until now the references to the `doctrine-mapping.xsd` consisted of different URLs.

A grep of docs showed:
* /Users/robo/dev/php/Doctrine/doctrine-mapping.xsd
* http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd
* http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd
* https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd

Now it is used http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd everywhere.
2018-11-12 11:09:15 +01:00
Michael Moravec 427f815975 Merge pull request #7465 from unguul/patch-1
Fixes tiny typo in the 'Working with DateTime instances' documentation
2018-11-11 23:24:29 +01:00
Michael Moravec bf601ce268 Merge pull request #7421 from seferov/patch-1
JIRA to Github issues on Limitations and Known Issues
2018-11-11 23:24:00 +01:00
Michael Moravec 8bfb363fcc Merge pull request #7434 from naitsirch/fix/doc-faq-public-property
Removed FAQ paragraph stating public variables are disallowed
2018-11-11 23:22:58 +01:00
Michael Moravec ebf2630a66 Merge pull request #7435 from oguzdumanoglu/patch-2
Fix a typo on Documentation
2018-11-11 23:22:25 +01:00
Michael Moravec 9018955e1f Merge pull request #7412 from ThomasLandauer/patch-1
Some formatting improvements
2018-11-10 21:05:50 +01:00
Thomas Landauer 88d58ae0a3 Some formatting improvements 2018-11-10 20:45:03 +01:00
Michael Moravec 2fc99afd44 Merge pull request #7423 from ThomasLandauer/patch-2
Update association-mapping.rst
2018-11-10 20:40:44 +01:00
Michael Moravec fa0885e25d Merge pull request #7374 from SenseException/deprecate-yaml-docs
Deprecation message in documentation for YAML
2018-11-10 20:33:51 +01:00
Alexandru Ungureanu 0e4a0108d2 Fixes small typo 2018-11-08 13:59:21 +02:00
Oguz Dumanoglu 58370256c0 Fix a typo
There was a typo in Working with Associations page.
2018-10-19 16:32:27 +02:00
naitsirch d5364231c2 Removed FAQ paragraph stating public variables are disallowed
In #7427 @flaushi mentioned the outdated paragraph. This commit removes
this one.
2018-10-18 22:36:29 +02:00
Luís Cobucci 4df3a4d436 Merge pull request #7428 from Majkl578/php7.3
CI: Test against PHP 7.3
2018-10-14 09:39:26 +02:00
Michael Moravec 812989490c CI: Test against PHP 7.3 2018-10-13 20:33:26 +02:00
Thomas Landauer 892ef9edb7 Update association-mapping.rst
Added info about owning and inverse side.
2018-10-09 21:33:42 +02:00
Farhad Safarov 982782f8c9 JIRA to Github issues 2018-10-09 11:52:22 +03:00
Michael Moravec 7319f524a3 Merge pull request #7397 from eibt/patch-1
Update getting-started.rst
2018-09-23 07:04:34 +02:00
Michael Moravec 1d71fbf77b Merge pull request #7367 from timdev/fix/entitymanager-find-with-optimistic-lock-no-need-tx
Fix for BC break in 2.6.2 when calling EM::find() with LockMode::OPTIMISTIC outside of a TX
2018-09-23 06:43:26 +02:00
Ivan 7eacfec2c3 Fix typo in getting-started.rst 2018-09-23 06:39:11 +02:00
Michael Moravec 46f2a41cf7 Merge pull request #7377 from sserbin/fix-query-andx-doctype
Fix query andX doctype
2018-09-23 06:37:42 +02:00
Michael Moravec fd2baf6f65 Merge pull request #7260 from stof/regression_commit_order
Fix the handling of circular references in the commit order calculator
2018-09-23 05:44:14 +02:00
Michael Moravec c8bf06d549 Merge pull request #7401 from bobdenotter/patch-1
[docs] Fix docblock in `inheritance-mapping.rst`
2018-09-23 05:34:59 +02:00
Tim Lieberman 3acfa50214 Fix for BC break #7366 when calling EM::find() with LockMode::OPTIMISTIC outside of a TX 2018-09-23 05:33:05 +02:00
sserbin 3dbe205498 Query\Expr::andX(): added string as allowed parameter type 2018-09-23 05:23:49 +02:00
Michael Moravec 899cce8094 Merge pull request #7363 from philippe-unitiz/2.6
Fix compatibility with phan
2018-09-23 05:16:52 +02:00
Bob den Otter 7400d51444 Fix docblock in inheritance-mapping.rst 2018-09-23 05:12:55 +02:00
Michael Moravec 96c344d22b Merge pull request #7345 from guilliamxavier/improve-DOMDocument-construct
Correct DOMDocument constructor in test
2018-09-23 05:11:21 +02:00
Michael Moravec f48d71ecd0 Merge pull request #7378 from BenMorel/patch-2
Typo fix
2018-09-23 05:05:58 +02:00
philippe-unitiz d3acbbf79b Fix constructor argument type in Query\Base 2018-09-23 05:02:30 +02:00
philippe-unitiz cb9ec8234b Fix multiline parameter phpDoc in Query\Expr
See https://github.com/phan/phan/issues/1897 (parser won't accept `@param` spanning over several lines)
2018-09-23 05:02:01 +02:00
Guilliam Xavier 47c72e583e correct load-only DOMDocument constructor in test 2018-09-23 04:52:52 +02:00
Christophe Coevoet 568c2d308c Fix the computation of commit order for circular dependencies
When finding a circular dependencies, we must ensure that all dependencies
of a node have been visited before adding it to the sorted list.
2018-09-20 12:13:25 +02:00
Christophe Coevoet 11a7f359d1 Add a unit test reproducing the commit order regression 2018-09-20 12:11:44 +02:00
Christophe Coevoet 145f1f5198 Add a test reproducing GH7259 2018-09-20 11:53:08 +02:00
Claudio Zizza ff1df41485 Add deprecation note to getting-started chapter 2018-09-07 21:06:08 +02:00
Claudio Zizza d36aec8fb7 Add deprecation message for YAML into docs 2018-08-30 23:24:30 +02:00
Benjamin Morel 2779b5ee91 Typo fix 2018-08-28 14:56:01 +02:00
Pierre-Louis FORT 32efbd3edd Handle removed parameters by tree walker in Paginator 2018-08-27 11:23:21 +02:00
Luís Cobucci 68718eac1b Merge pull request #7360 from lcobucci/fix-partial-reference-docblock
Document getPartialReference() properly
2018-08-19 16:25:51 +02:00
Luís Cobucci 7b64b4a207 Document getPartialReference() properly
According to the current implementation that method also returns `null`,
however the interface's documentation was incorrect.

Ref: https://github.com/doctrine/doctrine2/blob/v2.6.2/lib/Doctrine/ORM/EntityManager.php#L514-L516
2018-08-18 14:52:17 +02:00
Michael Moravec f1143f591f Merge pull request #7325 from paxal/php73_compatible
Make code php 7.3 lint-compatible
2018-08-02 14:23:28 +02:00
Cyril PASCAL 07fc401d25 Make code php 7.3 lint-compatible 2018-07-26 14:32:52 +02:00
Luís Cobucci 96f166a7e9 Merge pull request #7307 from Majkl578/remaining-deprecations
Fix remaining usages of deprecated ClassLoader and Inflector from doctrine/common
2018-07-13 07:27:10 +02:00
Michael Moravec f4b775323d Fix remaining usages of deprecated ClassLoader and Inflector from doctrine/common 2018-07-13 05:31:39 +02:00
Michael Moravec 43d308116d Bump version to 2.6.3-DEV 2018-07-12 23:24:26 +02:00
Michael Moravec d2b4dd71d2 Preparing v2.6.2 release 2018-07-12 22:47:13 +02:00
Luís Cobucci 36e6a73d5b Merge pull request #7296 from Majkl578/fix/2.6/#7286
Fix #7286: StringPrimary no longer accepts aggregate functions as argument
2018-07-10 00:05:51 +02:00
Michael Moravec e26158a45e Fix #7286: StringPrimary no longer accepts aggregate functions as argument 2018-07-09 19:12:39 +02:00
Marco Pivetta 3cfcd6a856 Merge pull request #7291 from Majkl578/fix/2.6/#7068
[2.6] Fix for #7068: EntityManager::find() with pessimistic lock should check for transaction
2018-07-03 09:40:48 +02:00
Michael Kühn ff68806bfa Fix for #7068: EntityManager::find() with pessimistic lock should check for transaction 2018-07-03 03:00:58 +02:00
Michael Moravec 4192c3abf4 Merge pull request #7290 from Majkl578/dbal-2.8-tests-compat
Fix compatibility with DBAL 2.8 (doctrine/dbal#3157)
2018-07-03 02:58:02 +02:00
Michael Moravec ac1e1c7d23 Fix compatibility with DBAL 2.8 where OFFSET 0 is no longer generated (doctrine/dbal#3157) 2018-07-03 02:14:23 +02:00
Luís Cobucci 9ab999618c Merge pull request #7276 from Majkl578/entityrepository-count-upgrade
Add UPGRADE note for EntityRepository::count()
2018-07-03 02:05:46 +02:00
Michael Moravec f2666a472f Add UPGRADE note for EntityRepository::count() 2018-06-27 20:41:59 +02:00
Luís Cobucci ceda5d3bc7 Merge pull request #7274 from Majkl578/non-deprecated-lexer-and-inflector
Use non-deprecated version of Lexer and Inflector
2018-06-25 23:56:32 +02:00
Michael Moravec 6d81d519b6 Use non-deprecated version of Lexer and Inflector 2018-06-25 14:20:52 +02:00
Marco Pivetta 88d1d79516 Merge pull request #7253 from JarJak/patch-2
Mention that Doctrine does not use Entities public API
2018-06-09 07:28:20 +02:00
Jarek Jakubowski cfc6cfd1a3 Unnecessary newline removed, small improvements in text 2018-06-09 00:29:59 +02:00
Jarek Jakubowski 6b7d67b427 Add info about Doctrine not using constructor 2018-06-08 20:29:37 +02:00
Jarek Jakubowski b6d08b15c0 Mention that Doctrine does not use Entities public API 2018-06-08 18:47:39 +02:00
Marco Pivetta 01f89a8cdc Merge pull request #7190 from Tobion/patch-1
Fix wrong type in phpdoc of AbstractIdGenerator
2018-04-13 16:29:25 +01:00
mikeSimonson efd7a5dca6 Merge pull request #7146 from Awkan/fix/7141-xml-order-by-default-asc
[XML] Fix default value of one-to-many order-by to ASC
2018-04-12 22:29:41 +02:00
Tobias Schultze 7ba0290643 entity should be nullable as in master 2018-04-10 19:15:48 +02:00
Tobias Schultze 8ceb47178b Fix wrong type in phpdoc of AbstractIdGenerator
\Doctrine\ORM\Mapping\Entity is the annotation class which is not correct. The entity object itself is meant here as tests also assume see https://github.com/doctrine/doctrine2/blob/2.6/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php#L28

Found this when running phpstan on our code that used a custom generator.
2018-04-10 18:31:36 +02:00
Donovan Bourlard 2560d4f419 Fix default value of one-to-many order-by to ASC, #7141 2018-03-22 14:51:02 +01:00
Marco Pivetta 87ee409783 Merge pull request #7082 from mariusklocke/issue-7062
Add failing test for issue #7062
2018-02-27 08:30:56 +01:00
Luís Cobucci d47c1f3e9b Fix basic entity persister type resolver
Which was using the wrong way to fetch the field type and using the
association type instead of the column type.
2018-02-26 14:39:06 +01:00
Marius Klocke b952dac339 Add a failing test for issue 7062 2018-02-26 14:39:05 +01:00
Luís Cobucci ffb7d4c79c Merge pull request #7093 from lcobucci/patch-association-identifier-not-quoted
Fix updating entities with quoted identifier association
2018-02-25 20:28:33 +01:00
Jan Langer e68717b725 Fix updating entities with quoted identifier association 2018-02-25 20:10:18 +01:00
Luís Cobucci 30a063ef9d Merge pull request #6701 from vhenzl/pr/issue-6531-test
Add failing tests for #6531 

Fixes https://github.com/doctrine/doctrine2/issues/6043
Fixes https://github.com/doctrine/doctrine2/issues/6531
Fixes https://github.com/doctrine/doctrine2/issues/7002
Fixes https://github.com/doctrine/doctrine2/pull/7003
2018-02-19 23:17:19 +01:00
Nicolas FRANÇOIS 35c3669ebc Fix handling entities with post generated IDs as FK
This prevents a throw in UnitOfWork#addToIdentityMap because some fields
are null.
2018-02-19 23:05:13 +01:00
Vašek Henzl 23f4f03575 Add failing tests for #6531
Tests are based on examples from "Composite and Foreign Keys as Primary Key" tutorial:
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/composite-primary-keys.html
2018-02-19 22:14:57 +01:00
Luís Cobucci a912fc09be Add @group to delete query test 2018-02-19 22:04:28 +01:00
Marco Pivetta a736a3713b Merge pull request #6988 from kbond/inheritance-issue
Inheritance middle-layer doesn't get hydrated
2018-02-19 12:13:08 +01:00
Luís Cobucci f2da5bc93e Extract private method to retrieve discriminator values 2018-02-19 12:07:44 +01:00
Luís Cobucci 2905b435db Remove loose comparison on discriminator values
According to mapping drivers the discriminator values can always be
converted to strings so it's safe to assume that we can actually do a
strict comparison during hydration.
2018-02-19 12:07:43 +01:00
Toni Cornelissen 48ca6dbcec Use partial discriminator map on multi-inheritance
Hydrator was ignoring data from subclasses when using multiple
inheritance levels. With this patch it will now use the discriminator
values from all subclasses of the class being hydrated.
2018-02-19 12:07:42 +01:00
Kevin Bond 15a4302902 Inheritance middle-layer doesn't get hydrated with HYDRATE_OBJECT 2018-02-19 12:07:41 +01:00
Marco Pivetta 1f82a20312 Merge pull request #7077 from lcobucci/fix-delete-bc-break
Fix BC-break on delete without alias DQL
2018-02-19 11:32:46 +01:00
Luís Cobucci fc943b70f6 Use early-returns to improve readability of the Parser 2018-02-19 00:53:42 +01:00
Luís Cobucci f36470941c Fix BC-break on delete queries with nasty workaround
The `v2.5.x` series of the ORM allowed to have DELETE DQLs without using
an alias, even though it didn't follow the grammar rules of the parser.
We fixed that issue on `v2.6.0` however that was a BC-breaking change
and lots of people were relying on this faulty behaviour.

This workaround fixes the BC-break, without even trying to be elegant.
In `v2.7.0.` we should raise a deprecation notice to notify people that
we'll drop that "feature" in `v3.0`.
2018-02-19 00:53:36 +01:00
Carnage ae6d80daab Adds sql generation test 2018-02-19 00:50:27 +01:00
Luís Cobucci 44e82e2720 Remove unused functions 2018-02-17 19:49:16 +01:00
Luís Cobucci e94467d6da Fix incorrect value in L2C+lock test
Which was causing the optimistic lock to fail in MySQL since it was
trying to update the data with exact same value.
2018-02-17 19:46:22 +01:00
Luís Cobucci 794c7708e8 Merge branch 'backport/fix/l2c-version' into 2.6
Backporting https://github.com/doctrine/doctrine2/pull/7069
2018-02-17 18:09:39 +01:00
‘Andrey Lukin’ 8e73926359 Add version fields into L2C data 2018-02-17 18:05:32 +01:00
‘Andrey Lukin’ 8fc1d74820 Add test for L2C using optimistic locks
As explained in #7067, fields with `@ORM\Version` annotation were not
being added to L2C cached data.
2018-02-17 18:05:27 +01:00
Luís Cobucci 496c6a9f03 Merge branch 'backport/fix-date-issues-once-and-for-all' into 2.6
Backporting https://github.com/doctrine/doctrine2/pull/7055
2018-02-09 17:21:29 +01:00
Luís Cobucci 7873f700b0 Add missing tests for day calculation
For the DATE_SUB() and DATE_ADD() functions.
2018-02-09 17:21:06 +01:00
Luís Cobucci 46c0861f45 Fix date calculation in tests (again)
Now using PHP to calculate the expected date manipulation, keeping a day
as delta since PHP resets the hour when performing operations with
days/weeks/months/years.

February is a wonderful month, isn't it?
2018-02-09 17:21:06 +01:00
Luís Cobucci 5149c0ff25 Merge branch 'backport/fix/7031-tests-february' into 2.6
Backporting: https://github.com/doctrine/doctrine2/pull/7032
2018-02-02 09:07:25 +01:00
Michael Moravec cf99d62472 QueryDqlFunctionTest: Increase delta for testDateAdd() to work in February 2018-02-02 08:59:35 +01:00
Luís Cobucci 5878797eae Merge pull request #6971 from rolando-caldas/master
Exception Call to undefined method Doctrine\Common\Cache\MemcachedCache::setMemcache()
2018-01-30 01:53:35 +01:00
Rolando Caldas 8c2d090dc8 Exception Call to undefined method Doctrine\Common\Cache\MemcachedCache::setMemcache()
When memcached extension is loaded Doctrine\ORM\Tools\Setup.php  calls to setMemcache method. The MemcachedCache class has the setMemcached method instead. Changed this call in Setup to setMemcached and $memcache to $memcached to keep the name like the extension
2018-01-30 01:38:56 +01:00
Luís Cobucci 3f772eac32 Merge pull request #7021 from lcobucci/fix-phpstan-check
Fix incorrect variable reference
2018-01-30 01:38:21 +01:00
Luís Cobucci 62c952d258 Fix wrong variable reference 2018-01-30 01:21:34 +01:00
Luís Cobucci c2f698e56e Merge pull request #6997 from NicolaF/fix/fix-6991-2.6
ManyToManyPersister fails to remove join table entry if there is multiple join columns
2018-01-30 01:19:12 +01:00
Nicolas FRANÇOIS 40f2a3efba Add test case for many-to-many collection deletion, when owning side has a composite PK 2018-01-30 01:04:28 +01:00
Nicolas FRANÇOIS 333b9c0b99 Fix #6991: correctly resolve identifer values in ManyToManyPersister 2018-01-19 12:19:02 +01:00
Luís Cobucci 90d19b4131 Bumping development version to v2.6.1-DEV 2017-12-20 02:01:05 +01:00
121 changed files with 2079 additions and 268 deletions
+2
View File
@@ -5,6 +5,7 @@ language: php
php:
- 7.1
- 7.2
- 7.3
- nightly
env:
@@ -57,6 +58,7 @@ jobs:
- stage: Test
if: type = cron
php: 7.3
env: DB=sqlite DEV_DEPENDENCIES
install:
- composer config minimum-stability dev
+7
View File
@@ -1,5 +1,12 @@
# Upgrade to 2.6
## Added `Doctrine\ORM\EntityRepository::count()` method
`Doctrine\ORM\EntityRepository::count()` has been added. This new method has different
signature than `Countable::count()` (required parameter) and therefore are not compatible.
If your repository implemented the `Countable` interface, you will have to use
`$repository->count([])` instead and not implement `Countable` interface anymore.
## Minor BC BREAK: `Doctrine\ORM\Tools\Console\ConsoleRunner` is now final
Since it's just an utilitarian class and should not be inherited.
+1 -1
View File
@@ -322,7 +322,7 @@ The aggregate field ``Account::$balance`` is now -200, however the
SUM over all entries amounts yields -400. A violation of our max
credit rule.
You can use both optimistic or pessimistic locking to save-guard
You can use both optimistic or pessimistic locking to safe-guard
your aggregate fields against this kind of race-conditions. Reading
Eric Evans DDD carefully he mentions that the "Aggregate Root"
(Account in our example) needs a locking mechanism.
+1 -1
View File
@@ -1,7 +1,7 @@
Working with DateTime Instances
===============================
There are many nitty gritty details when working with PHPs DateTime instances. You have know their inner
There are many nitty gritty details when working with PHPs DateTime instances. You have to know their inner
workings pretty well not to make mistakes with date handling. This cookbook entry holds several
interesting pieces of information on how to work with PHP DateTime instances in Doctrine 2.
+4 -4
View File
@@ -313,8 +313,8 @@ One-To-Many, Bidirectional
--------------------------
A one-to-many association has to be bidirectional, unless you are using a
join table. This is because the many side in a one-to-many association holds
the foreign key, making it the owning side. Doctrine needs the many side
join table. This is because the "many" side in a one-to-many association holds
the foreign key, making it the owning side. Doctrine needs the "many" side
defined in order to understand the association.
This bidirectional mapping requires the ``mappedBy`` attribute on the
@@ -335,7 +335,7 @@ bidirectional many-to-one.
{
// ...
/**
* One Product has Many Features.
* One product has many features. This is the inverse side.
* @OneToMany(targetEntity="Feature", mappedBy="product")
*/
private $features;
@@ -351,7 +351,7 @@ bidirectional many-to-one.
{
// ...
/**
* Many Features have One Product.
* Many features have one product. This is the owning side.
* @ManyToOne(targetEntity="Product", inversedBy="features")
* @JoinColumn(name="product_id", referencedColumnName="id")
*/
+1 -1
View File
@@ -323,7 +323,7 @@ XML would look something like this:
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
/Users/robo/dev/php/Doctrine/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="User">
-6
View File
@@ -21,12 +21,6 @@ created database tables and columns.
Entity Classes
--------------
I access a variable and its null, what is wrong?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If this variable is a public variable then you are violating one of the criteria for entities.
All properties have to be protected or private for the proxy object pattern to work.
How can I add default values to a column?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+2 -2
View File
@@ -493,7 +493,7 @@ Could be used by an entity that extends a mapped superclass to override a field
* column=@Column(
* name = "guest_id",
* type = "integer",
length = 140
* length = 140
* )
* ),
* @AttributeOverride(name="name",
@@ -501,7 +501,7 @@ Could be used by an entity that extends a mapped superclass to override a field
* name = "guest_name",
* nullable = false,
* unique = true,
length = 240
* length = 240
* )
* )
* })
@@ -63,7 +63,7 @@ Where the ``attribute_name`` column contains the key and
``$attributes``.
The feature request for persistence of primitive value arrays
`is described in the DDC-298 ticket <http://www.doctrine-project.org/jira/browse/DDC-298>`_.
`is described in the DDC-298 ticket <https://github.com/doctrine/doctrine2/issues/3743>`_.
Cascade Merge with Bi-directional Associations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -71,8 +71,8 @@ Cascade Merge with Bi-directional Associations
There are two bugs now that concern the use of cascade merge in combination with bi-directional associations.
Make sure to study the behavior of cascade merge if you are using it:
- `DDC-875 <http://www.doctrine-project.org/jira/browse/DDC-875>`_ Merge can sometimes add the same entity twice into a collection
- `DDC-763 <http://www.doctrine-project.org/jira/browse/DDC-763>`_ Cascade merge on associated entities can insert too many rows through "Persistence by Reachability"
- `DDC-875 <https://github.com/doctrine/doctrine2/issues/5398>`_ Merge can sometimes add the same entity twice into a collection
- `DDC-763 <https://github.com/doctrine/doctrine2/issues/5277>`_ Cascade merge on associated entities can insert too many rows through "Persistence by Reachability"
Custom Persisters
~~~~~~~~~~~~~~~~~
@@ -83,8 +83,8 @@ Currently there is no way to overwrite the persister implementation
for a given entity, however there are several use-cases that can
benefit from custom persister implementations:
- `Add Upsert Support <http://www.doctrine-project.org/jira/browse/DDC-668>`_
- `Evaluate possible ways in which stored-procedures can be used <http://www.doctrine-project.org/jira/browse/DDC-445>`_
- `Add Upsert Support <https://github.com/doctrine/doctrine2/issues/5178>`_
- `Evaluate possible ways in which stored-procedures can be used <https://github.com/doctrine/doctrine2/issues/4946>`_
Persist Keys of Collections
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -94,7 +94,7 @@ PHP Arrays are ordered hash-maps and so should be the
evaluate a feature that optionally persists and hydrates the keys
of a Collection instance.
`Ticket DDC-213 <http://www.doctrine-project.org/jira/browse/DDC-213>`_
`Ticket DDC-213 <https://github.com/doctrine/doctrine2/issues/2817>`_
Mapping many tables to one entity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -144,9 +144,8 @@ backwards compatibility issues or where no simple fix exists (yet).
We don't plan to add every bug in the tracker there, just those
issues that can potentially cause nightmares or pain of any sort.
See the Open Bugs on Jira for more details on `bugs, improvement and feature
requests
<http://www.doctrine-project.org/jira/secure/IssueNavigator.jspa?reset=true&mode=hide&pid=10032&resolution=-1&sorter/field=updated&sorter/order=DESC>`_.
See bugs, improvement and feature requests on `Github issues
<https://github.com/doctrine/doctrine2/issues>`_.
Identifier Quoting and Legacy Databases
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+2 -2
View File
@@ -310,7 +310,7 @@ Entity cache definition
.. code-block:: xml
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Country">
<cache usage="READ_ONLY" region="my_entity_region" />
<id name="id" type="integer" column="id">
@@ -386,7 +386,7 @@ It caches the primary keys of association and cache each element will be cached
.. code-block:: xml
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="State">
<cache usage="NONSTRICT_READ_WRITE" />
@@ -15,7 +15,7 @@ with associations in Doctrine:
removed, not the entity itself. A collection of entities always
only represents the association to the containing entities, not the
entity itself.
- When a bidirectional assocation is updated, Doctrine only checks
- When a bidirectional association is updated, Doctrine only checks
on one of both sides for these changes. This is called the :doc:`owning side <unitofwork-associations>`
of the association.
- A property with a reference to many entities has to be instances of the
@@ -25,6 +25,13 @@ Work that have not yet been persisted are lost.
Not calling ``EntityManager#flush()`` will lead to all changes
during that request being lost.
.. note::
Doctrine does NEVER touch the public API of methods in your entity
classes (like getters and setters) nor the constructor method.
Instead, it uses reflection to get/set data from/to your entity objects.
When Doctrine fetches data from DB and saves it back,
any code put in your get/set methods won't be implicitly taken into account.
Entities and the Identity Map
-----------------------------
+4 -4
View File
@@ -7,7 +7,7 @@ form of XML documents.
The XML driver is backed by an XML Schema document that describes
the structure of a mapping document. The most recent version of the
XML Schema document is available online at
`http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd <http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd>`_.
`https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd <https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd>`_.
In order to point to the latest version of the document of a
particular stable release branch, just append the release number,
i.e.: doctrine-mapping-2.0.xsd The most convenient way to work with
@@ -21,7 +21,7 @@ setup for the latest code in trunk.
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
...
@@ -107,7 +107,7 @@ of several common elements:
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\ORM\Mapping\User" table="cms_users">
@@ -768,7 +768,7 @@ entity relationship. You can define this in XML with the "association-key" attri
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Application\Model\ArticleAttribute">
<id name="article" association-key="true" />
+4
View File
@@ -1,6 +1,10 @@
YAML Mapping
============
.. note::
The YAML driver is deprecated and will be removed in version 3.0.
It is strongly recommended to switch to one of the other mappings.
The YAML mapping driver enables you to provide the ORM metadata in
form of YAML documents.
+2 -2
View File
@@ -63,7 +63,7 @@ and year of production as primary keys:
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="VehicleCatalogue\Model\Car">
<id field="name" type="string" />
@@ -203,7 +203,7 @@ We keep up the example of an Article with arbitrary attributes, the mapping look
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Application\Model\ArticleAttribute">
<id name="article" association-key="true" />
@@ -65,7 +65,7 @@ switch to extra lazy as shown in these examples:
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\CMS\CmsGroup">
<!-- ... -->
+50 -28
View File
@@ -25,7 +25,7 @@ The code of this tutorial is `available on Github <https://github.com/doctrine/d
.. note::
This tutorial assumes you work with **Doctrine 2.4** and above.
This tutorial assumes you work with **Doctrine 2.6** and above.
Some of the code will not work with lower versions.
What is Doctrine?
@@ -80,14 +80,14 @@ Project Setup
-------------
Create a new empty folder for this tutorial project, for example
``doctrine2-tutorial`` and create a new file ``composer.json`` with
the following contents:
``doctrine2-tutorial`` and create a new file ``composer.json`` inside
that directory with the following contents:
::
{
"require": {
"doctrine/orm": "2.4.*",
"doctrine/orm": "^2.6.2",
"symfony/yaml": "2.*"
},
"autoload": {
@@ -103,18 +103,21 @@ Install Doctrine using the Composer Dependency Management tool, by calling:
$ composer install
This will install the packages Doctrine Common, Doctrine DBAL, Doctrine ORM,
Symfony YAML and Symfony Console into the `vendor` directory. The Symfony
dependencies are not required by Doctrine but will be used in this tutorial.
into the ``vendor`` directory.
Add the following directories:
::
doctrine2-tutorial
|-- config
| |-- xml
| `-- xml
| `-- yaml
`-- src
.. note::
The YAML driver is deprecated and will be removed in version 3.0.
It is strongly recommended to switch to one of the other mappings.
Obtaining the EntityManager
---------------------------
@@ -150,7 +153,11 @@ step:
// obtaining the entity manager
$entityManager = EntityManager::create($conn, $config);
The require_once statement sets up the class autoloading for Doctrine and
.. note::
The YAML driver is deprecated and will be removed in version 3.0.
It is strongly recommended to switch to one of the other mappings.
The ``require_once`` statement sets up the class autoloading for Doctrine and
its dependencies using Composer's autoloader.
The second block consists of the instantiation of the ORM
@@ -173,7 +180,7 @@ Generating the Database Schema
Doctrine has a command-line interface that allows you to access the SchemaTool,
a component that can generate a relational database schema based entirely on the
defined entity classes and their metadata. For this tool to work, a
cli-config.php file must exist in the project root directory:
``cli-config.php`` file must exist in the project root directory:
.. code-block:: php
@@ -183,20 +190,19 @@ cli-config.php file must exist in the project root directory:
return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($entityManager);
Change into your project directory and call the Doctrine command-line tool:
Now call the Doctrine command-line tool:
::
$ cd project/
$ vendor/bin/doctrine orm:schema-tool:create
Since we haven't added any entity metadata in `src` yet, you'll see a message
Since we haven't added any entity metadata in ``src`` yet, you'll see a message
stating "No Metadata Classes to process." In the next section, we'll create a
Product entity along with the corresponding metadata, and run this command again.
Note that as you modify your entities' metadata during the development process,
you'll need to update your database schema to stay in sync with the metadata.
You can rasily recreate the database using the following commands:
You can easily recreate the database using the following commands:
::
@@ -209,8 +215,8 @@ Or you can use the update functionality:
$ vendor/bin/doctrine orm:schema-tool:update --force
The updating of databases uses a Diff Algorithm for a given
Database Schema. This is a cornerstone of the ``Doctrine\DBAL`` package,
The updating of databases uses a diff algorithm for a given
database schema. This is a cornerstone of the ``Doctrine\DBAL`` package,
which can even be used without the Doctrine ORM package.
Starting with the Product Entity
@@ -250,16 +256,16 @@ entity definition:
}
}
When creating entity classes, all of the fields should be protected or private
(not public), with getter and setter methods for each one (except $id).
When creating entity classes, all of the fields should be ``protected`` or ``private``
(not ``public``), with getter and setter methods for each one (except ``$id``).
The use of mutators allows Doctrine to hook into calls which
manipulate the entities in ways that it could not if you just
manipulate the entities in ways that it could not if you just
directly set the values with ``entity#field = foo;``
The id field has no setter since, generally speaking, your code
should not set this value since it represents a database id value.
(Note that Doctrine itself can still set the value using the
Reflection API instead of a defined setter function)
The id field has no setter since, generally speaking, your code
should not set this value since it represents a database id value.
(Note that Doctrine itself can still set the value using the
Reflection API instead of a defined setter function.)
The next step for persistence with Doctrine is to describe the
structure of the ``Product`` entity to Doctrine using a metadata
@@ -297,7 +303,7 @@ but you only need to choose one.
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Product" table="products">
<id name="id" type="integer">
@@ -308,6 +314,10 @@ but you only need to choose one.
</entity>
</doctrine-mapping>
.. note::
The YAML driver is deprecated and will be removed in version 3.0.
It is strongly recommended to switch to one of the other mappings.
.. code-block:: yaml
# config/yaml/Product.dcm.yml
@@ -323,8 +333,8 @@ but you only need to choose one.
name:
type: string
The top-level ``entity`` definition tag specifies information about
the class and table-name. The primitive type ``Product#name`` is
The top-level ``entity`` definition specifies information about
the class and table name. The primitive type ``Product#name`` is
defined as a ``field`` attribute. The ``id`` property is defined with
the ``id`` tag. It has a ``generator`` tag nested inside, which
specifies that the primary key generation mechanism should automatically
@@ -833,7 +843,7 @@ the ``Product`` before:
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Bug" table="bugs">
<id name="id" type="integer">
@@ -851,6 +861,10 @@ the ``Product`` before:
</entity>
</doctrine-mapping>
.. note::
The YAML driver is deprecated and will be removed in version 3.0.
It is strongly recommended to switch to one of the other mappings.
.. code-block:: yaml
# config/yaml/Bug.dcm.yml
@@ -949,7 +963,7 @@ Finally, we'll add metadata mappings for the ``User`` entity.
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="User" table="users">
<id name="id" type="integer">
@@ -963,6 +977,10 @@ Finally, we'll add metadata mappings for the ``User`` entity.
</entity>
</doctrine-mapping>
.. note::
The YAML driver is deprecated and will be removed in version 3.0.
It is strongly recommended to switch to one of the other mappings.
.. code-block:: yaml
# config/yaml/User.dcm.yml
@@ -1486,13 +1504,17 @@ we have to adjust the metadata slightly.
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Bug" table="bugs" repository-class="BugRepository">
</entity>
</doctrine-mapping>
.. note::
The YAML driver is deprecated and will be removed in version 3.0.
It is strongly recommended to switch to one of the other mappings.
.. code-block:: yaml
Bug:
@@ -107,7 +107,7 @@ The code and mappings for the Market entity looks like this:
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\StockExchange\Market">
<id name="id" type="integer">
@@ -193,7 +193,7 @@ here are the code and mappings for it:
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\StockExchange\Stock">
<id name="id" type="integer">
+26 -16
View File
@@ -19,10 +19,12 @@
namespace Doctrine\ORM;
use Doctrine\Common\Persistence\Mapping\MappingException;
use Doctrine\Common\Util\ClassUtils;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping\MappingException as ORMMappingException;
use Doctrine\ORM\Query\Parameter;
use Doctrine\ORM\Cache\QueryCacheKey;
use Doctrine\DBAL\Cache\QueryCacheProfile;
@@ -98,7 +100,7 @@ abstract class AbstractQuery
/**
* The hydration mode.
*
* @var integer
* @var string|int
*/
protected $_hydrationMode = self::HYDRATE_OBJECT;
@@ -410,16 +412,24 @@ abstract class AbstractQuery
return $value;
}
if (is_object($value) && $this->_em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($value))) {
if ($value instanceof Mapping\ClassMetadata) {
return $value->name;
}
if (! is_object($value)) {
return $value;
}
try {
$value = $this->_em->getUnitOfWork()->getSingleIdentifierValue($value);
if ($value === null) {
throw ORMInvalidArgumentException::invalidIdentifierBindingEntity();
}
}
if ($value instanceof Mapping\ClassMetadata) {
return $value->name;
} catch (MappingException | ORMMappingException $e) {
// Silence any mapping exceptions. These can occur if the object in
// question is not a mapped entity, in which case we just don't do
// any preparation on the value.
}
return $value;
@@ -680,8 +690,8 @@ abstract class AbstractQuery
/**
* Defines the processing mode to be used during hydration / result set transformation.
*
* @param integer $hydrationMode Doctrine processing mode to be used during hydration process.
* One of the Query::HYDRATE_* constants.
* @param string|int $hydrationMode Doctrine processing mode to be used during hydration process.
* One of the Query::HYDRATE_* constants.
*
* @return static This query instance.
*/
@@ -695,7 +705,7 @@ abstract class AbstractQuery
/**
* Gets the hydration mode currently used by the query.
*
* @return integer
* @return string|int
*/
public function getHydrationMode()
{
@@ -707,7 +717,7 @@ abstract class AbstractQuery
*
* Alias for execute(null, $hydrationMode = HYDRATE_OBJECT).
*
* @param int $hydrationMode
* @param string|int $hydrationMode
*
* @return mixed
*/
@@ -743,7 +753,7 @@ abstract class AbstractQuery
/**
* Get exactly one result or null.
*
* @param int $hydrationMode
* @param string|int $hydrationMode
*
* @return mixed
*
@@ -781,7 +791,7 @@ abstract class AbstractQuery
* If the result is not unique, a NonUniqueResultException is thrown.
* If there is no result, a NoResultException is thrown.
*
* @param integer $hydrationMode
* @param string|int $hydrationMode
*
* @return mixed
*
@@ -875,7 +885,7 @@ abstract class AbstractQuery
* iterate over the result.
*
* @param ArrayCollection|array|null $parameters The query parameters.
* @param integer|null $hydrationMode The hydration mode to use.
* @param string|int|null $hydrationMode The hydration mode to use.
*
* @return \Doctrine\ORM\Internal\Hydration\IterableResult
*/
@@ -899,7 +909,7 @@ abstract class AbstractQuery
* Executes the query.
*
* @param ArrayCollection|array|null $parameters Query parameters.
* @param integer|null $hydrationMode Processing mode to be used during the hydration process.
* @param string|int|null $hydrationMode Processing mode to be used during the hydration process.
*
* @return mixed
*/
@@ -916,7 +926,7 @@ abstract class AbstractQuery
* Execute query ignoring second level cache.
*
* @param ArrayCollection|array|null $parameters
* @param integer|null $hydrationMode
* @param string|int|null $hydrationMode
*
* @return mixed
*/
@@ -974,7 +984,7 @@ abstract class AbstractQuery
* Load from second level cache or executes the query and put into cache.
*
* @param ArrayCollection|array|null $parameters
* @param integer|null $hydrationMode
* @param string|int|null $hydrationMode
*
* @return mixed
*/
@@ -75,6 +75,10 @@ class DefaultEntityHydrator implements EntityHydrator
$data = $this->uow->getOriginalEntityData($entity);
$data = array_merge($data, $metadata->getIdentifierValues($entity)); // why update has no identifier values ?
if ($metadata->isVersioned) {
$data[$metadata->versionField] = $metadata->getFieldValue($entity, $metadata->versionField);
}
foreach ($metadata->associationMappings as $name => $assoc) {
if ( ! isset($data[$name])) {
continue;
+27 -8
View File
@@ -23,6 +23,7 @@ use Doctrine\Common\EventManager;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\ORM\Proxy\ProxyFactory;
use Doctrine\ORM\Query\FilterCollection;
@@ -380,6 +381,10 @@ use Throwable;
{
$class = $this->metadataFactory->getMetadataFor(ltrim($entityName, '\\'));
if ($lockMode !== null) {
$this->checkLockRequirements($lockMode, $class);
}
if ( ! is_array($id)) {
if ($class->isIdentifierComposite) {
throw ORMInvalidArgumentException::invalidCompositeIdentifier();
@@ -441,10 +446,6 @@ use Throwable;
switch (true) {
case LockMode::OPTIMISTIC === $lockMode:
if ( ! $class->isVersioned) {
throw OptimisticLockException::notVersioned($class->name);
}
$entity = $persister->load($sortedId);
$unitOfWork->lock($entity, $lockMode, $lockVersion);
@@ -453,10 +454,6 @@ use Throwable;
case LockMode::PESSIMISTIC_READ === $lockMode:
case LockMode::PESSIMISTIC_WRITE === $lockMode:
if ( ! $this->getConnection()->isTransactionActive()) {
throw TransactionRequiredException::transactionRequired();
}
return $persister->load($sortedId, null, null, [], $lockMode);
default:
@@ -915,4 +912,26 @@ use Throwable;
{
return null !== $this->filterCollection;
}
/**
* @param int $lockMode
* @param ClassMetadata $class
* @throws OptimisticLockException
* @throws TransactionRequiredException
*/
private function checkLockRequirements(int $lockMode, ClassMetadata $class): void
{
switch ($lockMode) {
case LockMode::OPTIMISTIC:
if (!$class->isVersioned) {
throw OptimisticLockException::notVersioned($class->name);
}
break;
case LockMode::PESSIMISTIC_READ:
case LockMode::PESSIMISTIC_WRITE:
if (!$this->getConnection()->isTransactionActive()) {
throw TransactionRequiredException::transactionRequired();
}
}
}
}
+3 -3
View File
@@ -174,7 +174,7 @@ interface EntityManagerInterface extends ObjectManager
* @param string $entityName The name of the entity type.
* @param mixed $identifier The entity identifier.
*
* @return object The (partial) entity reference.
* @return object|null The (partial) entity reference.
*/
public function getPartialReference($entityName, $identifier);
@@ -249,7 +249,7 @@ interface EntityManagerInterface extends ObjectManager
*
* @deprecated
*
* @param int $hydrationMode
* @param string|int $hydrationMode
*
* @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator
*/
@@ -258,7 +258,7 @@ interface EntityManagerInterface extends ObjectManager
/**
* Create a new instance for the given hydration mode.
*
* @param int $hydrationMode
* @param string|int $hydrationMode
*
* @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator
*
+1 -1
View File
@@ -19,7 +19,7 @@
namespace Doctrine\ORM;
use Doctrine\Common\Util\Inflector;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\Common\Collections\Selectable;
+1 -1
View File
@@ -27,7 +27,7 @@ abstract class AbstractIdGenerator
* Generates an identifier for an entity.
*
* @param EntityManager $em
* @param \Doctrine\ORM\Mapping\Entity $entity
* @param object|null $entity
* @return mixed
*/
abstract public function generate(EntityManager $em, $entity);
@@ -164,6 +164,17 @@ class CommitOrderCalculator
case self::IN_PROGRESS:
if (isset($adjacentVertex->dependencyList[$vertex->hash]) &&
$adjacentVertex->dependencyList[$vertex->hash]->weight < $edge->weight) {
// If we have some non-visited dependencies in the in-progress dependency, we
// need to visit them before adding the node.
foreach ($adjacentVertex->dependencyList as $adjacentEdge) {
$adjacentEdgeVertex = $this->nodeList[$adjacentEdge->to];
if ($adjacentEdgeVertex->state === self::NOT_VISITED) {
$this->visit($adjacentEdgeVertex);
}
}
$adjacentVertex->state = self::VISITED;
$this->sortedNodeList[] = $adjacentVertex->value;
@@ -24,6 +24,8 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping\ClassMetadata;
use PDO;
use function array_map;
use function in_array;
/**
* Base class for all hydrators. A hydrator is a class that provides some form
@@ -296,11 +298,8 @@ abstract class AbstractHydrator
// If there are field name collisions in the child class, then we need
// to only hydrate if we are looking at the correct discriminator value
if(
isset($cacheKeyInfo['discriminatorColumn']) &&
isset($data[$cacheKeyInfo['discriminatorColumn']]) &&
// Note: loose comparison required. See https://github.com/doctrine/doctrine2/pull/6304#issuecomment-323294442
$data[$cacheKeyInfo['discriminatorColumn']] != $cacheKeyInfo['discriminatorValue']
if (isset($cacheKeyInfo['discriminatorColumn'], $data[$cacheKeyInfo['discriminatorColumn']])
&& ! in_array((string) $data[$cacheKeyInfo['discriminatorColumn']], $cacheKeyInfo['discriminatorValues'], true)
) {
break;
}
@@ -401,7 +400,8 @@ abstract class AbstractHydrator
$columnInfo,
[
'discriminatorColumn' => $this->_rsm->discriminatorColumns[$ownerMap],
'discriminatorValue' => $classMetadata->discriminatorValue
'discriminatorValue' => $classMetadata->discriminatorValue,
'discriminatorValues' => $this->getDiscriminatorValues($classMetadata),
]
);
}
@@ -454,6 +454,23 @@ abstract class AbstractHydrator
return null;
}
/**
* @return string[]
*/
private function getDiscriminatorValues(ClassMetadata $classMetadata) : array
{
$values = array_map(
function (string $subClass) : string {
return (string) $this->getClassMetadata($subClass)->discriminatorValue;
},
$classMetadata->subClasses
);
$values[] = (string) $classMetadata->discriminatorValue;
return $values;
}
/**
* Retrieve ClassMetadata associated to entity class name.
*
@@ -27,7 +27,6 @@ use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use ReflectionClass;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\ClassLoader;
use Doctrine\ORM\Cache\CacheException;
/**
@@ -1025,7 +1024,11 @@ class ClassMetadataInfo implements ClassMetadata
public function validateAssociations()
{
foreach ($this->associationMappings as $mapping) {
if ( ! ClassLoader::classExists($mapping['targetEntity']) ) {
if (
! class_exists($mapping['targetEntity'])
&& ! interface_exists($mapping['targetEntity'])
&& ! trait_exists($mapping['targetEntity'])
) {
throw MappingException::invalidTargetEntityClass($mapping['targetEntity'], $this->name, $mapping['fieldName']);
}
}
@@ -19,9 +19,9 @@
namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Util\Inflector;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Schema\Table;
@@ -19,6 +19,7 @@
namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Common\Collections\Criteria;
use SimpleXMLElement;
use Doctrine\Common\Persistence\Mapping\Driver\FileDriver;
use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder;
@@ -429,7 +430,10 @@ class XmlDriver extends FileDriver
if (isset($oneToManyElement->{'order-by'})) {
$orderBy = [];
foreach ($oneToManyElement->{'order-by'}->{'order-by-field'} as $orderByField) {
$orderBy[(string) $orderByField['name']] = (string) $orderByField['direction'];
$orderBy[(string) $orderByField['name']] = isset($orderByField['direction'])
? (string) $orderByField['direction']
: Criteria::ASC
;
}
$mapping['orderBy'] = $orderBy;
}
@@ -545,7 +549,9 @@ class XmlDriver extends FileDriver
if (isset($manyToManyElement->{'order-by'})) {
$orderBy = [];
foreach ($manyToManyElement->{'order-by'}->{'order-by-field'} as $orderByField) {
$orderBy[(string) $orderByField['name']] = (string) $orderByField['direction'];
$orderBy[(string) $orderByField['name']] = isset($orderByField['direction'])
? (string) $orderByField['direction']
: Criteria::ASC;
}
$mapping['orderBy'] = $orderBy;
}
@@ -419,7 +419,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
foreach ($mapping['relationToSourceKeyColumns'] as $columnName => $refColumnName) {
$params[] = isset($sourceClass->fieldNames[$refColumnName])
? $identifier[$sourceClass->fieldNames[$refColumnName]]
: $identifier[$sourceClass->getFieldForColumn($columnName)];
: $identifier[$sourceClass->getFieldForColumn($refColumnName)];
}
return $params;
@@ -37,6 +37,8 @@ use Doctrine\ORM\Query;
use Doctrine\ORM\UnitOfWork;
use Doctrine\ORM\Utility\IdentifierFlattener;
use Doctrine\ORM\Utility\PersisterHelper;
use function array_merge;
use function reset;
/**
* A BasicEntityPersister maps an entity to a single table in a relational database.
@@ -451,23 +453,21 @@ class BasicEntityPersister implements EntityPersister
continue;
}
$params[] = $identifier[$idField];
$where[] = $this->class->associationMappings[$idField]['joinColumns'][0]['name'];
$targetMapping = $this->em->getClassMetadata($this->class->associationMappings[$idField]['targetEntity']);
$params[] = $identifier[$idField];
$where[] = $this->quoteStrategy->getJoinColumnName(
$this->class->associationMappings[$idField]['joinColumns'][0],
$this->class,
$this->platform
);
switch (true) {
case (isset($targetMapping->fieldMappings[$targetMapping->identifier[0]])):
$types[] = $targetMapping->fieldMappings[$targetMapping->identifier[0]]['type'];
break;
$targetMapping = $this->em->getClassMetadata($this->class->associationMappings[$idField]['targetEntity']);
$targetType = PersisterHelper::getTypeOfField($targetMapping->identifier[0], $targetMapping, $this->em);
case (isset($targetMapping->associationMappings[$targetMapping->identifier[0]])):
$types[] = $targetMapping->associationMappings[$targetMapping->identifier[0]]['type'];
break;
default:
throw ORMException::unrecognizedField($targetMapping->identifier[0]);
if ($targetType === []) {
throw ORMException::unrecognizedField($targetMapping->identifier[0]);
}
$types[] = reset($targetType);
}
if ($versioned) {
+1 -1
View File
@@ -656,7 +656,7 @@ final class Query extends AbstractQuery
* iterated over the result.
*
* @param ArrayCollection|array|null $parameters The query parameters.
* @param integer $hydrationMode The hydration mode to use.
* @param string|int $hydrationMode The hydration mode to use.
*
* @return \Doctrine\ORM\Internal\Hydration\IterableResult
*/
+2 -4
View File
@@ -41,10 +41,8 @@ class Expr
* // (u.type = ?1) AND (u.role = ?2)
* $expr->andX($expr->eq('u.type', ':1'), $expr->eq('u.role', ':2'));
*
* @param \Doctrine\ORM\Query\Expr\Comparison |
* \Doctrine\ORM\Query\Expr\Func |
* \Doctrine\ORM\Query\Expr\Orx
* $x Optional clause. Defaults to null, but requires at least one defined when converting to string.
* @param Expr\Comparison|Expr\Func|Expr\Orx|string $x Optional clause. Defaults to null, but requires at least one
* defined when converting to string.
*
* @return Expr\Andx
*/
+1 -1
View File
@@ -56,7 +56,7 @@ abstract class Base
protected $parts = [];
/**
* @param array $args
* @param mixed $args
*/
public function __construct($args = [])
{
+3 -1
View File
@@ -19,6 +19,8 @@
namespace Doctrine\ORM\Query;
use Doctrine\Common\Lexer\AbstractLexer;
/**
* Scans a DQL query for tokens.
*
@@ -27,7 +29,7 @@ namespace Doctrine\ORM\Query;
* @author Roman Borschel <roman@code-factory.org>
* @since 2.0
*/
class Lexer extends \Doctrine\Common\Lexer
class Lexer extends AbstractLexer
{
// All tokens that are not valid identifiers must be < 100
const T_NONE = 1;
+36 -26
View File
@@ -22,6 +22,7 @@ namespace Doctrine\ORM\Query;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query;
use Doctrine\ORM\Query\AST\Functions;
use function strpos;
/**
* An LL(*) recursive-descent parser for the context-free grammar of the Doctrine Query Language.
@@ -303,21 +304,24 @@ class Parser
$lookaheadType = $this->lexer->lookahead['type'];
// Short-circuit on first condition, usually types match
if ($lookaheadType !== $token) {
// If parameter is not identifier (1-99) must be exact match
if ($token < Lexer::T_IDENTIFIER) {
$this->syntaxError($this->lexer->getLiteral($token));
}
if ($lookaheadType === $token) {
$this->lexer->moveNext();
return;
}
// If parameter is keyword (200+) must be exact match
if ($token > Lexer::T_IDENTIFIER) {
$this->syntaxError($this->lexer->getLiteral($token));
}
// If parameter is not identifier (1-99) must be exact match
if ($token < Lexer::T_IDENTIFIER) {
$this->syntaxError($this->lexer->getLiteral($token));
}
// If parameter is T_IDENTIFIER, then matches T_IDENTIFIER (100) and keywords (200+)
if ($token === Lexer::T_IDENTIFIER && $lookaheadType < Lexer::T_IDENTIFIER) {
$this->syntaxError($this->lexer->getLiteral($token));
}
// If parameter is keyword (200+) must be exact match
if ($token > Lexer::T_IDENTIFIER) {
$this->syntaxError($this->lexer->getLiteral($token));
}
// If parameter is T_IDENTIFIER, then matches T_IDENTIFIER (100) and keywords (200+)
if ($token === Lexer::T_IDENTIFIER && $lookaheadType < Lexer::T_IDENTIFIER) {
$this->syntaxError($this->lexer->getLiteral($token));
}
$this->lexer->moveNext();
@@ -958,20 +962,20 @@ class Parser
if ($this->lexer->isNextToken(Lexer::T_FULLY_QUALIFIED_NAME)) {
$this->match(Lexer::T_FULLY_QUALIFIED_NAME);
$schemaName = $this->lexer->token['value'];
} else if ($this->lexer->isNextToken(Lexer::T_IDENTIFIER)) {
$this->match(Lexer::T_IDENTIFIER);
$schemaName = $this->lexer->token['value'];
} else {
$this->match(Lexer::T_ALIASED_NAME);
list($namespaceAlias, $simpleClassName) = explode(':', $this->lexer->token['value']);
$schemaName = $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName;
return $this->lexer->token['value'];
}
return $schemaName;
if ($this->lexer->isNextToken(Lexer::T_IDENTIFIER)) {
$this->match(Lexer::T_IDENTIFIER);
return $this->lexer->token['value'];
}
$this->match(Lexer::T_ALIASED_NAME);
[$namespaceAlias, $simpleClassName] = explode(':', $this->lexer->token['value']);
return $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName;
}
/**
@@ -1280,7 +1284,9 @@ class Parser
$this->match(Lexer::T_AS);
}
$aliasIdentificationVariable = $this->AliasIdentificationVariable();
$aliasIdentificationVariable = $this->lexer->isNextToken(Lexer::T_IDENTIFIER)
? $this->AliasIdentificationVariable()
: 'alias_should_have_been_set';
$deleteClause->aliasIdentificationVariable = $aliasIdentificationVariable;
$class = $this->em->getClassMetadata($deleteClause->abstractSchemaName);
@@ -2918,6 +2924,10 @@ class Parser
case Lexer::T_COALESCE:
case Lexer::T_NULLIF:
return $this->CaseExpression();
default:
if ($this->isAggregateFunction($lookaheadType)) {
return $this->AggregateExpression();
}
}
$this->syntaxError(
+1 -1
View File
@@ -1027,7 +1027,7 @@ class QueryBuilder
* </code>
*
* @param string $key The key/field to set.
* @param string $value The value, expression, placeholder, etc.
* @param mixed $value The value, expression, placeholder, etc.
*
* @return self
*/
@@ -20,7 +20,7 @@
namespace Doctrine\ORM\Tools;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\Common\Util\Inflector;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\DBAL\Types\Type;
use Symfony\Component\Yaml\Yaml;
+1 -1
View File
@@ -20,7 +20,7 @@
namespace Doctrine\ORM\Tools;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Util\Inflector;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
@@ -44,7 +44,7 @@ class XmlExporter extends AbstractExporter
$xml = new SimpleXmlElement('<?xml version="1.0" encoding="utf-8"?><doctrine-mapping ' .
'xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" ' .
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' .
'xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd" />');
'xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd" />');
if ($metadata->isMappedSuperclass) {
$root = $xml->addChild('mapped-superclass');
@@ -145,6 +145,7 @@ class Paginator implements \Countable, \IteratorAggregate
$subQuery->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, LimitSubqueryOutputWalker::class);
} else {
$this->appendTreeWalker($subQuery, LimitSubqueryWalker::class);
$this->unbindUnusedQueryParams($subQuery);
}
$subQuery->setFirstResult($offset)->setMaxResults($length);
@@ -256,14 +257,20 @@ class Paginator implements \Countable, \IteratorAggregate
$countQuery->setResultSetMapping($rsm);
} else {
$this->appendTreeWalker($countQuery, CountWalker::class);
$this->unbindUnusedQueryParams($countQuery);
}
$countQuery->setFirstResult(null)->setMaxResults(null);
$parser = new Parser($countQuery);
return $countQuery;
}
private function unbindUnusedQueryParams(Query $query): void
{
$parser = new Parser($query);
$parameterMappings = $parser->parse()->getParameterMappings();
/* @var $parameters \Doctrine\Common\Collections\Collection|\Doctrine\ORM\Query\Parameter[] */
$parameters = $countQuery->getParameters();
$parameters = $query->getParameters();
foreach ($parameters as $key => $parameter) {
$parameterName = $parameter->getName();
@@ -273,8 +280,6 @@ class Paginator implements \Countable, \IteratorAggregate
}
}
$countQuery->setParameters($parameters);
return $countQuery;
$query->setParameters($parameters);
}
}
+22 -16
View File
@@ -45,6 +45,8 @@ use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
*/
class SchemaTool
{
private const KNOWN_COLUMN_OPTIONS = ['comment', 'unsigned', 'fixed', 'default'];
/**
* @var \Doctrine\ORM\EntityManagerInterface
*/
@@ -467,19 +469,8 @@ class SchemaTool
$options['columnDefinition'] = $mapping['columnDefinition'];
}
if (isset($mapping['options'])) {
$knownOptions = ['comment', 'unsigned', 'fixed', 'default'];
foreach ($knownOptions as $knownOption) {
if (array_key_exists($knownOption, $mapping['options'])) {
$options[$knownOption] = $mapping['options'][$knownOption];
unset($mapping['options'][$knownOption]);
}
}
$options['customSchemaOptions'] = $mapping['options'];
}
// the 'default' option can be overwritten here
$options = $this->gatherColumnOptions($mapping) + $options;
if ($class->isIdGeneratorIdentity() && $class->getIdentifierFieldNames() == [$mapping['fieldName']]) {
$options['autoincrement'] = true;
@@ -690,9 +681,7 @@ class SchemaTool
$columnOptions['notnull'] = ! $joinColumn['nullable'];
}
if (isset($fieldMapping['options'])) {
$columnOptions['options'] = $fieldMapping['options'];
}
$columnOptions = $columnOptions + $this->gatherColumnOptions($fieldMapping);
if ($fieldMapping['type'] == "string" && isset($fieldMapping['length'])) {
$columnOptions['length'] = $fieldMapping['length'];
@@ -745,6 +734,23 @@ class SchemaTool
}
}
/**
* @param mixed[] $mapping
*
* @return mixed[]
*/
private function gatherColumnOptions(array $mapping) : array
{
if (! isset($mapping['options'])) {
return [];
}
$options = array_intersect_key($mapping['options'], array_flip(self::KNOWN_COLUMN_OPTIONS));
$options['customSchemaOptions'] = array_diff_key($mapping['options'], $options);
return $options;
}
/**
* Drops the database schema for the given classes.
*
+3 -3
View File
@@ -181,9 +181,9 @@ class SchemaValidator
$identifierColumns = $targetMetadata->getIdentifierColumnNames();
foreach ($assoc['joinTable']['inverseJoinColumns'] as $inverseJoinColumn) {
if (!in_array($inverseJoinColumn['referencedColumnName'], $identifierColumns)) {
$ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " .
"has to be a primary key column on the target entity class '".$targetMetadata->name."'.";
if (! in_array($inverseJoinColumn['referencedColumnName'], $identifierColumns)) {
$ce[] = "The referenced column name '" . $inverseJoinColumn['referencedColumnName'] . "' " .
"has to be a primary key column on the target entity class '" .$targetMetadata->name . "'.";
break;
}
}
+3 -3
View File
@@ -171,11 +171,11 @@ class Setup
if (extension_loaded('memcached')) {
$memcache = new \Memcached();
$memcache->addServer('127.0.0.1', 11211);
$memcached = new \Memcached();
$memcached->addServer('127.0.0.1', 11211);
$cache = new \Doctrine\Common\Cache\MemcachedCache();
$cache->setMemcache($memcache);
$cache->setMemcached($memcached);
return $cache;
}
+57 -3
View File
@@ -940,7 +940,11 @@ class UnitOfWork implements PropertyChangedListener
$class->setIdentifierValues($entity, $idValue);
}
$this->entityIdentifiers[$oid] = $idValue;
// Some identifiers may be foreign keys to new entities.
// In this case, we don't have the value yet and should treat it as if we have a post-insert generator
if (! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) {
$this->entityIdentifiers[$oid] = $idValue;
}
}
$this->entityStates[$oid] = self::STATE_MANAGED;
@@ -948,6 +952,20 @@ class UnitOfWork implements PropertyChangedListener
$this->scheduleForInsert($entity);
}
/**
* @param mixed[] $idValue
*/
private function hasMissingIdsWhichAreForeignKeys(ClassMetadata $class, array $idValue) : bool
{
foreach ($idValue as $idField => $idFieldValue) {
if ($idFieldValue === null && isset($class->associationMappings[$idField])) {
return true;
}
}
return false;
}
/**
* INTERNAL:
* Computes the changeset of an individual entity, independently of the
@@ -1033,12 +1051,16 @@ class UnitOfWork implements PropertyChangedListener
$persister = $this->getEntityPersister($className);
$invoke = $this->listenersInvoker->getSubscribedSystems($class, Events::postPersist);
$insertionsForClass = [];
foreach ($this->entityInsertions as $oid => $entity) {
if ($this->em->getClassMetadata(get_class($entity))->name !== $className) {
continue;
}
$insertionsForClass[$oid] = $entity;
$persister->addInsert($entity);
unset($this->entityInsertions[$oid]);
@@ -1067,6 +1089,14 @@ class UnitOfWork implements PropertyChangedListener
$this->addToIdentityMap($entity);
}
} else {
foreach ($insertionsForClass as $oid => $entity) {
if (! isset($this->entityIdentifiers[$oid])) {
//entity was not added to identity map because some identifiers are foreign keys to new entities.
//add it now
$this->addToEntityIdentifiersAndEntityMap($class, $oid, $entity);
}
}
}
foreach ($entities as $entity) {
@@ -1074,6 +1104,30 @@ class UnitOfWork implements PropertyChangedListener
}
}
/**
* @param object $entity
*/
private function addToEntityIdentifiersAndEntityMap(ClassMetadata $class, string $oid, $entity): void
{
$identifier = [];
foreach ($class->getIdentifierFieldNames() as $idField) {
$value = $class->getFieldValue($entity, $idField);
if (isset($class->associationMappings[$idField])) {
// NOTE: Single Columns as associated identifiers only allowed - this constraint it is enforced.
$value = $this->getSingleIdentifierValue($value);
}
$identifier[$idField] = $this->originalEntityData[$oid][$idField] = $value;
}
$this->entityStates[$oid] = self::STATE_MANAGED;
$this->entityIdentifiers[$oid] = $identifier;
$this->addToIdentityMap($entity);
}
/**
* Executes all entity updates for entities of the specified type.
*
@@ -2661,7 +2715,7 @@ class UnitOfWork implements PropertyChangedListener
$class->reflFields[$field]->setValue($entity, $data[$field]);
$this->originalEntityData[$oid][$field] = $data[$field];
continue;
break;
}
$associatedId = [];
@@ -2690,7 +2744,7 @@ class UnitOfWork implements PropertyChangedListener
$class->reflFields[$field]->setValue($entity, null);
$this->originalEntityData[$oid][$field] = null;
continue;
break;
}
if ( ! isset($hints['fetchMode'][$class->name][$field])) {
+1 -1
View File
@@ -35,7 +35,7 @@ class Version
/**
* Current Doctrine Version
*/
const VERSION = '2.6.0';
const VERSION = '2.6.3';
/**
* Compares a Doctrine version with the current one.
@@ -0,0 +1,15 @@
<?php
namespace Doctrine\Tests\Models\GH7141;
use Doctrine\Common\Collections\ArrayCollection;
class GH7141Article
{
private $tags;
public function __construct()
{
$this->tags = new ArrayCollection();
}
}
@@ -0,0 +1,15 @@
<?php
namespace Doctrine\Tests\Models\GH7316;
use Doctrine\Common\Collections\ArrayCollection;
class GH7316Article
{
private $tags;
public function __construct()
{
$this->tags = new ArrayCollection();
}
}
@@ -0,0 +1,52 @@
<?php
namespace Doctrine\Tests\Models\ManyToManyPersister;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* @Entity
* @Table(name="manytomanypersister_child")
*/
class ChildClass
{
/**
* @Id
* @Column(name="id1", type="integer")
*
* @var integer
*/
public $id1;
/**
* @Id
* @ManyToOne(targetEntity=OtherParentClass::class, cascade={"persist"})
* @JoinColumn(name="other_parent_id", referencedColumnName="id")
*
* @var OtherParentClass
*/
public $otherParent;
/**
* @ManyToMany(targetEntity=ParentClass::class, inversedBy="children")
* @JoinTable(
* name="parent_child",
* joinColumns={
* @JoinColumn(name="child_id1", referencedColumnName="id1"),
* @JoinColumn(name="child_id2", referencedColumnName="other_parent_id")
* },
* inverseJoinColumns={@JoinColumn(name="parent_id", referencedColumnName="id")}
* )
*
* @var Collection|ParentClass[]
*/
public $parents;
public function __construct(int $id1, OtherParentClass $otherParent)
{
$this->id1 = $id1;
$this->otherParent = $otherParent;
$this->parents = new ArrayCollection();
}
}
@@ -0,0 +1,23 @@
<?php
namespace Doctrine\Tests\Models\ManyToManyPersister;
/**
* @Entity
* @Table(name="manytomanypersister_other_parent")
*/
class OtherParentClass
{
/**
* @Id
* @Column(name="id", type="integer")
*
* @var integer
*/
public $id;
public function __construct(int $id)
{
$this->id = $id;
}
}
@@ -0,0 +1,39 @@
<?php
namespace Doctrine\Tests\Models\ManyToManyPersister;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\ManyToMany;
/**
* @Entity
* @Table(name="manytomanypersister_parent")
*/
class ParentClass
{
/**
* @Id
* @Column(name="id", type="integer")
*
* @var integer
*/
public $id;
/**
* @ManyToMany(targetEntity=ChildClass::class, mappedBy="parents", orphanRemoval=true, cascade={"persist"})
*
* @var Collection|ChildClass[]
*/
public $children;
public function __construct(int $id)
{
$this->id = $id;
$this->children = new ArrayCollection();
}
}
@@ -67,6 +67,39 @@ class CommitOrderCalculatorTest extends OrmTestCase
$this->assertSame($correctOrder, $sorted);
}
public function testCommitOrdering3()
{
// this test corresponds to the GH7259Test::testPersistFileBeforeVersion functional test
$class1 = new ClassMetadata(NodeClass1::class);
$class2 = new ClassMetadata(NodeClass2::class);
$class3 = new ClassMetadata(NodeClass3::class);
$class4 = new ClassMetadata(NodeClass4::class);
$this->_calc->addNode($class1->name, $class1);
$this->_calc->addNode($class2->name, $class2);
$this->_calc->addNode($class3->name, $class3);
$this->_calc->addNode($class4->name, $class4);
$this->_calc->addDependency($class4->name, $class1->name, 1);
$this->_calc->addDependency($class1->name, $class2->name, 1);
$this->_calc->addDependency($class4->name, $class3->name, 1);
$this->_calc->addDependency($class1->name, $class4->name, 0);
$sorted = $this->_calc->sort();
// There is only multiple valid ordering for this constellation, but
// the class4, class1, class2 ordering is important to break the cycle
// on the nullable link.
$correctOrders = [
[$class4, $class1, $class2, $class3],
[$class4, $class1, $class3, $class2],
[$class4, $class3, $class1, $class2],
];
// We want to perform a strict comparison of the array
$this->assertContains($sorted, $correctOrders, '', false, true, true);
}
}
class NodeClass1 {}
@@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional;
use Doctrine\ORM\AbstractQuery;
use Doctrine\Tests\Models\Company\CompanyManager;
use Doctrine\Tests\OrmFunctionalTestCase;
use function sprintf;
/**
* Functional Query tests.
@@ -292,7 +293,7 @@ class QueryDqlFunctionTest extends OrmFunctionalTestCase
*
* @dataProvider dateAddSubProvider
*/
public function testDateAdd(string $unit, int $amount, int $expectedValue, int $delta = 0) : void
public function testDateAdd(string $unit, int $amount, int $delta = 0) : void
{
$query = sprintf(
'SELECT CURRENT_TIMESTAMP() as now, DATE_ADD(CURRENT_TIMESTAMP(), %d, \'%s\') AS add FROM %s m',
@@ -308,9 +309,12 @@ class QueryDqlFunctionTest extends OrmFunctionalTestCase
self::assertArrayHasKey('now', $result);
self::assertArrayHasKey('add', $result);
$diff = strtotime($result['add']) - strtotime($result['now']);
self::assertEquals($expectedValue, $diff, '', $delta);
self::assertEquals(
(new \DateTimeImmutable($result['now']))->modify(sprintf('+%d %s', $amount, $unit)),
new \DateTimeImmutable($result['add']),
'',
$delta
);
}
/**
@@ -319,7 +323,7 @@ class QueryDqlFunctionTest extends OrmFunctionalTestCase
*
* @dataProvider dateAddSubProvider
*/
public function testDateSub(string $unit, int $amount, int $expectedValue, int $delta = 0) : void
public function testDateSub(string $unit, int $amount, int $delta = 0) : void
{
$query = sprintf(
'SELECT CURRENT_TIMESTAMP() as now, DATE_SUB(CURRENT_TIMESTAMP(), %d, \'%s\') AS sub FROM %s m',
@@ -335,9 +339,12 @@ class QueryDqlFunctionTest extends OrmFunctionalTestCase
self::assertArrayHasKey('now', $result);
self::assertArrayHasKey('sub', $result);
$diff = strtotime($result['now']) - strtotime($result['sub']);
self::assertEquals($expectedValue, $diff, '', $delta);
self::assertEquals(
(new \DateTimeImmutable($result['now']))->modify(sprintf('-%d %s', $amount, $unit)),
new \DateTimeImmutable($result['sub']),
'',
$delta
);
}
public function dateAddSubProvider() : array
@@ -345,9 +352,10 @@ class QueryDqlFunctionTest extends OrmFunctionalTestCase
$secondsInDay = 86400;
return [
'year' => ['year', 1, 365 * $secondsInDay, 3 * $secondsInDay],
'month' => ['month', 1, 30 * $secondsInDay, 2 * $secondsInDay],
'week' => ['week', 1, 7 * $secondsInDay, $secondsInDay],
'year' => ['year', 1, $secondsInDay],
'month' => ['month', 1, $secondsInDay],
'week' => ['week', 1, $secondsInDay],
'day' => ['day', 2, $secondsInDay],
'hour' => ['hour', 1, 3600],
'minute' => ['minute', 1, 60],
'second' => ['second', 10, 10],
@@ -0,0 +1,190 @@
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Common\Collections\ArrayCollection;
final class GH6531Test extends \Doctrine\Tests\OrmFunctionalTestCase
{
protected function setUp() : void
{
parent::setup();
$this->setUpEntitySchema(
[
GH6531User::class,
GH6531Address::class,
GH6531Article::class,
GH6531ArticleAttribute::class,
GH6531Order::class,
GH6531OrderItem::class,
GH6531Product::class,
]
);
}
/**
* @group 6531
*/
public function testSimpleDerivedIdentity() : void
{
$user = new GH6531User();
$address = new GH6531Address();
$address->user = $user;
$this->_em->persist($user);
$this->_em->persist($address);
$this->_em->flush();
self::assertSame($user, $this->_em->find(GH6531User::class, $user->id));
self::assertSame($address, $this->_em->find(GH6531Address::class, $user));
}
/**
* @group 6531
*/
public function testDynamicAttributes() : void
{
$article = new GH6531Article();
$article->addAttribute('name', 'value');
$this->_em->persist($article);
$this->_em->flush();
self::assertSame(
$article->attributes['name'],
$this->_em->find(GH6531ArticleAttribute::class, ['article' => $article, 'attribute' => 'name'])
);
}
/**
* @group 6531
*/
public function testJoinTableWithMetadata() : void
{
$product = new GH6531Product();
$this->_em->persist($product);
$this->_em->flush();
$order = new GH6531Order();
$order->addItem($product, 2);
$this->_em->persist($order);
$this->_em->flush();
self::assertSame(
$order->items->first(),
$this->_em->find(GH6531OrderItem::class, ['product' => $product, 'order' => $order])
);
}
}
/**
* @Entity
*/
class GH6531User
{
/** @Id @Column(type="integer") @GeneratedValue */
public $id;
}
/**
* @Entity
*/
class GH6531Address
{
/** @Id @OneToOne(targetEntity=GH6531User::class) */
public $user;
}
/**
* @Entity
*/
class GH6531Article
{
/** @Id @Column(type="integer") @GeneratedValue */
public $id;
/** @OneToMany(targetEntity=GH6531ArticleAttribute::class, mappedBy="article", cascade={"ALL"}, indexBy="attribute") */
public $attributes;
public function addAttribute(string $name, string $value)
{
$this->attributes[$name] = new GH6531ArticleAttribute($name, $value, $this);
}
}
/**
* @Entity
*/
class GH6531ArticleAttribute
{
/** @Id @ManyToOne(targetEntity=GH6531Article::class, inversedBy="attributes") */
public $article;
/** @Id @Column(type="string") */
public $attribute;
/** @Column(type="string") */
public $value;
public function __construct(string $name, string $value, GH6531Article $article)
{
$this->attribute = $name;
$this->value = $value;
$this->article = $article;
}
}
/**
* @Entity
*/
class GH6531Order
{
/** @Id @Column(type="integer") @GeneratedValue */
public $id;
/** @OneToMany(targetEntity=GH6531OrderItem::class, mappedBy="order", cascade={"ALL"}) */
public $items;
public function __construct()
{
$this->items = new ArrayCollection();
}
public function addItem(GH6531Product $product, int $amount) : void
{
$this->items->add(new GH6531OrderItem($this, $product, $amount));
}
}
/**
* @Entity
*/
class GH6531Product
{
/** @Id @Column(type="integer") @GeneratedValue */
public $id;
}
/**
* @Entity
*/
class GH6531OrderItem
{
/** @Id @ManyToOne(targetEntity=GH6531Order::class) */
public $order;
/** @Id @ManyToOne(targetEntity=GH6531Product::class) */
public $product;
/** @Column(type="integer") */
public $amount = 1;
public function __construct(GH6531Order $order, GH6531Product $product, int $amount = 1)
{
$this->order = $order;
$this->product = $product;
$this->amount = $amount;
}
}
@@ -0,0 +1,119 @@
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\ORM\AbstractQuery;
use Doctrine\Tests\OrmFunctionalTestCase;
/**
* @group 6937
*/
final class GH6937Test extends OrmFunctionalTestCase
{
/**
* {@inheritDoc}
*/
protected function setUp() : void
{
parent::setUp();
$this->setUpEntitySchema([GH6937Person::class, GH6937Employee::class, GH6937Manager::class]);
}
public function testPhoneNumberIsPopulatedWithFind() : void
{
$manager = new GH6937Manager();
$manager->name = 'Kevin';
$manager->phoneNumber = '555-5555';
$manager->department = 'Accounting';
$this->_em->persist($manager);
$this->_em->flush();
$this->_em->clear();
$persistedManager = $this->_em->find(GH6937Person::class, $manager->id);
self::assertSame('Kevin', $persistedManager->name);
self::assertSame('555-5555', $persistedManager->phoneNumber);
self::assertSame('Accounting', $persistedManager->department);
}
public function testPhoneNumberIsPopulatedWithQueryBuilderUsingSimpleObjectHydrator() : void
{
$manager = new GH6937Manager();
$manager->name = 'Kevin';
$manager->phoneNumber = '555-5555';
$manager->department = 'Accounting';
$this->_em->persist($manager);
$this->_em->flush();
$this->_em->clear();
$persistedManager = $this->_em->getRepository(GH6937Person::class)
->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', $manager->id)
->getQuery()
->getOneOrNullResult(AbstractQuery::HYDRATE_SIMPLEOBJECT);
self::assertSame('Kevin', $persistedManager->name);
self::assertSame('555-5555', $persistedManager->phoneNumber);
self::assertSame('Accounting', $persistedManager->department);
}
public function testPhoneNumberIsPopulatedWithQueryBuilder() : void
{
$manager = new GH6937Manager();
$manager->name = 'Kevin';
$manager->phoneNumber = '555-5555';
$manager->department = 'Accounting';
$this->_em->persist($manager);
$this->_em->flush();
$this->_em->clear();
$persistedManager = $this->_em->getRepository(GH6937Person::class)
->createQueryBuilder('e')
->where('e.id = :id')
->setParameter('id', $manager->id)
->getQuery()
->getOneOrNullResult();
self::assertSame('Kevin', $persistedManager->name);
self::assertSame('555-5555', $persistedManager->phoneNumber);
self::assertSame('Accounting', $persistedManager->department);
}
}
/**
* @Entity
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorMap({"employee"=GH6937Employee::class, "manager"=GH6937Manager::class})
*/
abstract class GH6937Person
{
/** @Id @Column(type="integer") @GeneratedValue */
public $id;
/** @Column(type="string") */
public $name;
}
/**
* @Entity
*/
abstract class GH6937Employee extends GH6937Person
{
/** @Column(type="string") */
public $phoneNumber;
}
/**
* @Entity
*/
class GH6937Manager extends GH6937Employee
{
/** @Column(type="string") */
public $department;
}
@@ -0,0 +1,82 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Tests\Models\Quote\User as QuotedUser;
use Doctrine\Tests\OrmFunctionalTestCase;
final class GH7012Test extends OrmFunctionalTestCase
{
protected function setUp() : void
{
$this->useModelSet('quote');
parent::setUp();
$this->setUpEntitySchema([GH7012UserData::class]);
}
/**
* @group 7012
*/
public function testUpdateEntityWithIdentifierAssociationWithQuotedJoinColumn() : void
{
$user = new QuotedUser();
$user->name = 'John Doe';
$this->_em->persist($user);
$this->_em->flush();
$userData = new GH7012UserData($user, '123456789');
$this->_em->persist($userData);
$this->_em->flush();
$userData->name = '4321';
$this->_em->flush();
$platform = $this->_em->getConnection()->getDatabasePlatform();
$quotedTableName = $platform->quoteIdentifier('quote-user-data');
$quotedColumn = $platform->quoteIdentifier('name');
$quotedIdentifier = $platform->quoteIdentifier('user-id');
self::assertNotEquals('quote-user-data', $quotedTableName);
self::assertNotEquals('name', $quotedColumn);
self::assertNotEquals('user-id', $quotedIdentifier);
$queries = $this->_sqlLoggerStack->queries;
$this->assertSQLEquals(
sprintf('UPDATE %s SET %s = ? WHERE %s = ?', $quotedTableName, $quotedColumn, $quotedIdentifier),
$queries[$this->_sqlLoggerStack->currentQuery - 1]['sql']
);
}
}
/**
* @Entity
* @Table(name="`quote-user-data`")
*/
class GH7012UserData
{
/**
* @Id
* @OneToOne(targetEntity=Doctrine\Tests\Models\Quote\User::class)
* @JoinColumn(name="`user-id`", referencedColumnName="`user-id`", onDelete="CASCADE")
*/
public $user;
/**
* @Column(type="string", name="`name`")
*/
public $name;
public function __construct(QuotedUser $user, string $name)
{
$this->user = $user;
$this->name = $name;
}
}
@@ -0,0 +1,212 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Tests\OrmFunctionalTestCase;
class GH7062Test extends OrmFunctionalTestCase
{
private const SEASON_ID = 'season_18';
private const TEAM_ID = 'team_A';
protected function setUp() : void
{
parent::setUp();
$this->setUpEntitySchema(
[
GH7062Team::class,
GH7062Season::class,
GH7062Ranking::class,
GH7062RankingPosition::class
]
);
}
/**
* @group 7062
*/
public function testEntityWithAssociationKeyIdentityCanBeUpdated() : void
{
$this->createInitialRankingWithRelatedEntities();
$this->modifyRanking();
$this->verifyRanking();
}
private function createInitialRankingWithRelatedEntities() : void
{
$team = new GH7062Team(self::TEAM_ID);
$season = new GH7062Season(self::SEASON_ID);
$season->ranking = new GH7062Ranking($season, [$team]);
$this->_em->persist($team);
$this->_em->persist($season);
$this->_em->flush();
$this->_em->clear();
foreach ($season->ranking->positions as $position) {
self::assertSame(0, $position->points);
}
}
private function modifyRanking() : void
{
/** @var GH7062Ranking $ranking */
$ranking = $this->_em->find(GH7062Ranking::class, self::SEASON_ID);
foreach ($ranking->positions as $position) {
$position->points += 3;
}
$this->_em->flush();
$this->_em->clear();
}
private function verifyRanking() : void
{
/** @var GH7062Season $season */
$season = $this->_em->find(GH7062Season::class, self::SEASON_ID);
self::assertInstanceOf(GH7062Season::class, $season);
$ranking = $season->ranking;
self::assertInstanceOf(GH7062Ranking::class, $ranking);
foreach ($ranking->positions as $position) {
self::assertSame(3, $position->points);
}
}
}
/**
* Simple Entity whose identity is defined through another Entity (Season)
*
* @Entity
* @Table(name="soccer_rankings")
*/
class GH7062Ranking
{
/**
* @Id
* @OneToOne(targetEntity=GH7062Season::class, inversedBy="ranking")
* @JoinColumn(name="season", referencedColumnName="id")
*
* @var GH7062Season
*/
public $season;
/**
* @OneToMany(targetEntity=GH7062RankingPosition::class, mappedBy="ranking", cascade={"all"})
*
* @var Collection|GH7062RankingPosition[]
*/
public $positions;
/**
* @param GH7062Team[] $teams
*/
public function __construct(GH7062Season $season, array $teams)
{
$this->season = $season;
$this->positions = new ArrayCollection();
foreach ($teams as $team) {
$this->positions[] = new GH7062RankingPosition($this, $team);
}
}
}
/**
* Entity which serves as a identity provider for other entities
*
* @Entity
* @Table(name="soccer_seasons")
*/
class GH7062Season
{
/**
* @Id
* @Column(type="string")
*
* @var string
*/
public $id;
/**
* @OneToOne(targetEntity=GH7062Ranking::class, mappedBy="season", cascade={"all"})
*
* @var GH7062Ranking|null
*/
public $ranking;
public function __construct(string $id)
{
$this->id = $id;
}
}
/**
* Entity which serves as a identity provider for other entities
*
* @Entity
* @Table(name="soccer_teams")
*/
class GH7062Team
{
/**
* @Id
* @Column(type="string")
*
* @var string
*/
public $id;
public function __construct(string $id)
{
$this->id = $id;
}
}
/**
* Entity whose identity is defined through two other entities
*
* @Entity
* @Table(name="soccer_ranking_positions")
*/
class GH7062RankingPosition
{
/**
* @Id
* @ManyToOne(targetEntity=GH7062Ranking::class, inversedBy="positions")
* @JoinColumn(name="season", referencedColumnName="season")
*
* @var GH7062Ranking
*/
public $ranking;
/**
* @Id
* @ManyToOne(targetEntity=GH7062Team::class)
* @JoinColumn(name="team_id", referencedColumnName="id")
*
* @var GH7062Team
*/
public $team;
/**
* @Column(type="integer")
*
* @var int
*/
public $points;
public function __construct(GH7062Ranking $ranking, GH7062Team $team)
{
$this->ranking = $ranking;
$this->team = $team;
$this->points = 0;
}
}
@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\Ticket;
final class GH7067Test extends \Doctrine\Tests\OrmFunctionalTestCase
{
public function setUp() : void
{
$this->enableSecondLevelCache();
parent::setUp();
$this->setUpEntitySchema([GH7067Entity::class]);
}
/**
* @group 7067
*/
public function testSLCWithVersion() : void
{
$entity = new GH7067Entity();
$entity->lastUpdate = new \DateTime();
$this->_em->persist($entity);
$this->_em->flush();
$this->_em->clear();
/** @var GH7067Entity $notCached */
$notCached = $this->_em->find(GH7067Entity::class, $entity->id);
self::assertNotNull($notCached->version, 'Version already cached by persister above, it must be not null');
$notCached->lastUpdate = new \DateTime('+1 seconds');
$this->_em->flush();
$this->_em->clear();
}
}
/**
* @Entity()
* @Cache(usage="NONSTRICT_READ_WRITE")
*/
class GH7067Entity
{
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*
* @var int
*/
public $id;
/**
* @Column(type="datetime")
*
* @var \DateTime
*/
public $lastUpdate;
/**
* @Column(type="datetime")
* @Version
*
* @var \DateTime
*/
public $version;
}
@@ -0,0 +1,43 @@
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\TransactionRequiredException;
use Doctrine\Tests\OrmFunctionalTestCase;
final class GH7068Test extends OrmFunctionalTestCase
{
/**
* {@inheritDoc}
*/
protected function setUp()
{
parent::setUp();
$this->setUpEntitySchema(
[
SomeEntity::class,
]
);
}
public function testLockModeIsRespected()
{
$entity = new SomeEntity();
$this->_em->persist($entity);
$this->_em->flush();
$this->_em->clear();
$this->_em->find(SomeEntity::class, 1);
$this->expectException(TransactionRequiredException::class);
$this->_em->find(SomeEntity::class, 1, LockMode::PESSIMISTIC_WRITE);
}
}
/** @Entity */
final class SomeEntity {
/** @Id @Column(type="integer") @GeneratedValue */
public $id;
}
@@ -0,0 +1,165 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Tests\OrmFunctionalTestCase;
final class GH7259Test extends OrmFunctionalTestCase
{
protected function setUp() : void
{
parent::setUp();
$this->setUpEntitySchema([GH7259Space::class, GH7259File::class, GH7259FileVersion::class, GH7259Feed::class]);
}
/**
* @group 7259
*/
public function testPersistFileBeforeVersion() : void
{
$space = new GH7259Space();
$this->_em->persist($space);
$this->_em->flush();
$feed = new GH7259Feed();
$feed->space = $space;
$file = new GH7259File();
$file->space = $space;
$fileVersion = new GH7259FileVersion();
$fileVersion->file = $file;
$this->_em->persist($file);
$this->_em->persist($fileVersion);
$this->_em->persist($feed);
$this->_em->flush();
self::assertNotNull($fileVersion->id);
}
/**
* @group 7259
*/
public function testPersistFileAfterVersion() : void
{
$space = new GH7259Space();
$this->_em->persist($space);
$this->_em->flush();
$this->_em->clear();
$space = $this->_em->find(GH7259Space::class, $space->id);
$feed = new GH7259Feed();
$feed->space = $space;
$file = new GH7259File();
$file->space = $space;
$fileVersion = new GH7259FileVersion();
$fileVersion->file = $file;
$this->_em->persist($fileVersion);
$this->_em->persist($file);
$this->_em->persist($feed);
$this->_em->flush();
self::assertNotNull($fileVersion->id);
}
}
/**
* @Entity()
*/
class GH7259File
{
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*
* @var int
*/
public $id;
/**
* @ManyToOne(targetEntity=GH7259Space::class)
* @JoinColumn(nullable=false)
*
* @var GH7259Space|null
*/
public $space;
}
/**
* @Entity()
*/
class GH7259FileVersion
{
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*
* @var int
*/
public $id;
/**
* @ManyToOne(targetEntity=GH7259File::class)
* @JoinColumn(nullable=false)
*
* @var GH7259File|null
*/
public $file;
}
/**
* @Entity()
*/
class GH7259Space
{
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*
* @var int
*/
public $id;
/**
* @ManyToOne(targetEntity=GH7259File::class)
* @JoinColumn(nullable=true)
*
* @var GH7259File|null
*/
public $ruleFile;
}
/**
* @Entity()
*/
class GH7259Feed
{
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*
* @var int
*/
public $id;
/**
* @ManyToOne(targetEntity=GH7259Space::class)
* @JoinColumn(nullable=false)
*
* @var GH7259Space|null
*/
public $space;
}
@@ -0,0 +1,135 @@
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\AST\Node;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\Tests\OrmFunctionalTestCase;
final class GH7286Test extends OrmFunctionalTestCase
{
/**
* {@inheritDoc}
*/
protected function setUp() : void
{
parent::setUp();
$this->setUpEntitySchema(
[
GH7286Entity::class,
]
);
$this->_em->persist(new GH7286Entity('foo', 1));
$this->_em->persist(new GH7286Entity('foo', 2));
$this->_em->persist(new GH7286Entity('bar', 3));
$this->_em->persist(new GH7286Entity(null, 4));
$this->_em->flush();
$this->_em->clear();
}
public function testAggregateExpressionInFunction() : void
{
$query = $this->_em->createQuery(
'SELECT CONCAT(e.type, MIN(e.version)) pair'
. ' FROM ' . GH7286Entity::class . ' e'
. ' WHERE e.type IS NOT NULL'
. ' GROUP BY e.type'
. ' ORDER BY e.type'
);
self::assertSame(
[
['pair' => 'bar3'],
['pair' => 'foo1'],
],
$query->getArrayResult()
);
}
/**
* @group DDC-1091
*/
public function testAggregateFunctionInCustomFunction() : void
{
$this->_em->getConfiguration()->addCustomStringFunction('CC', GH7286CustomConcat::class);
$query = $this->_em->createQuery(
'SELECT CC(e.type, MIN(e.version)) pair'
. ' FROM ' . GH7286Entity::class . ' e'
. ' WHERE e.type IS NOT NULL AND e.type != :type'
. ' GROUP BY e.type'
);
$query->setParameter('type', 'bar');
self::assertSame(
['pair' => 'foo1'],
$query->getSingleResult()
);
}
}
/**
* @Entity
*/
class GH7286Entity
{
/**
* @Id
* @Column(type="integer")
* @GeneratedValue
* @var int
*/
public $id;
/**
* @Column(nullable=true)
* @var string|null
*/
public $type;
/**
* @Column(type="integer")
* @var int
*/
public $version;
public function __construct(?string $type, int $version)
{
$this->type = $type;
$this->version = $version;
}
}
class GH7286CustomConcat extends FunctionNode
{
/** @var Node */
private $first;
/** @var Node */
private $second;
public function parse(Parser $parser) : void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->first = $parser->StringPrimary();
$parser->match(Lexer::T_COMMA);
$this->second = $parser->StringPrimary();
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
public function getSql(SqlWalker $walker) : string
{
return $walker->getConnection()->getDatabasePlatform()->getConcatExpression(
$this->first->dispatch($walker),
$this->second->dispatch($walker)
);
}
}
@@ -0,0 +1,75 @@
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\TransactionRequiredException;
use Doctrine\Tests\OrmFunctionalTestCase;
final class GH7366Test extends OrmFunctionalTestCase
{
/**
* {@inheritDoc}
*/
protected function setUp() : void
{
parent::setUp();
$this->setUpEntitySchema(
[
GH7366Entity::class,
]
);
$this->_em->persist(new GH7366Entity('baz'));
$this->_em->flush();
$this->_em->clear();
}
public function testOptimisticLockNoExceptionOnFind() : void
{
try {
$entity = $this->_em->find(GH7366Entity::class, 1, LockMode::OPTIMISTIC);
} catch (TransactionRequiredException $e) {
self::fail('EntityManager::find() threw TransactionRequiredException with LockMode::OPTIMISTIC');
}
self::assertEquals('baz', $entity->getName());
}
}
/**
* @Entity
*/
class GH7366Entity
{
/**
* @Id
* @Column(type="integer")
* @GeneratedValue
* @var int
*/
public $id;
/**
* @Column(type="integer")
* @Version
*/
protected $lockVersion = 1;
/**
* @Column(length=32)
* @var string
*/
protected $name;
public function __construct(string $name)
{
$this->name = $name;
}
public function getName(): string
{
return $this->name;
}
}
@@ -3,7 +3,7 @@
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\OrnementalOrphanRemoval\Person" table="ornemental_orphan_removal_person">
<id name="id" column="id">
<generator strategy="NONE" />
@@ -3,7 +3,7 @@
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\OrnementalOrphanRemoval\PhoneNumber" table="ornemental_orphan_removal_phone_number">
<id name="id" column="id">
<generator strategy="NONE" />
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\ORM\Mapping;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataFactory;
@@ -11,6 +12,8 @@ use Doctrine\Tests\Models\DDC3293\DDC3293User;
use Doctrine\Tests\Models\DDC3293\DDC3293UserPrefixed;
use Doctrine\Tests\Models\DDC889\DDC889Class;
use Doctrine\Tests\Models\Generic\SerializationModel;
use Doctrine\Tests\Models\GH7141\GH7141Article;
use Doctrine\Tests\Models\GH7316\GH7316Article;
use Doctrine\Tests\Models\ValueObjects\Name;
use Doctrine\Tests\Models\ValueObjects\Person;
@@ -150,8 +153,8 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
*/
public function testValidateXmlSchema($xmlMappingFile)
{
$xsdSchemaFile = __DIR__ . '/../../../../../doctrine-mapping.xsd';
$dom = new \DOMDocument('UTF-8');
$xsdSchemaFile = __DIR__ . '/../../../../../doctrine-mapping.xsd';
$dom = new \DOMDocument();
$dom->load($xmlMappingFile);
@@ -174,6 +177,38 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
}, $list);
}
/**
* @group GH-7141
*/
public function testOneToManyDefaultOrderByAsc()
{
$driver = $this->_loadDriver();
$class = new ClassMetadata(GH7141Article::class);
$class->initializeReflection(new RuntimeReflectionService());
$driver->loadMetadataForClass(GH7141Article::class, $class);
$this->assertEquals(
Criteria::ASC,
$class->getMetadataValue('associationMappings')['tags']['orderBy']['position']
);
}
public function testManyToManyDefaultOrderByAsc() : void
{
$class = new ClassMetadata(GH7316Article::class);
$class->initializeReflection(new RuntimeReflectionService());
$driver = $this->_loadDriver();
$driver->loadMetadataForClass(GH7316Article::class, $class);
self::assertEquals(
Criteria::ASC,
$class->getMetadataValue('associationMappings')['tags']['orderBy']['position']
);
}
/**
* @group DDC-889
* @expectedException \Doctrine\Common\Persistence\Mapping\MappingException
@@ -1,7 +1,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="CatNoId">
<field name="can_has_cheezburgers" type="boolean" />
</entity>
@@ -2,7 +2,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="SocialLibrary\ReadBundle\Entity\Book">
<id name="id" type="integer">
@@ -1,7 +1,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="SocialLibrary\ReadBundle\Entity\Novel" table="novel__novel" repository-class="SocialLibrary\ReadBundle\Repository\NovelRepository">
<association-overrides>
@@ -1,7 +1,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\CMS\CmsAddress" table="cms_users">
@@ -3,8 +3,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\CMS\CmsUser" table="cms_users">
<named-queries>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\Cache\City" table="cache_city">
<cache usage="READ_ONLY" />
<id name="id" type="integer" column="id">
@@ -3,8 +3,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\Company\CompanyContract" table="company_contracts" inheritance-type="SINGLE_TABLE">
<discriminator-map>
@@ -3,8 +3,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\Company\CompanyFixContract">
@@ -3,8 +3,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\Company\CompanyFlexContract">
<field name="hoursWorked" column="hoursWorked" type="integer"/>
@@ -3,8 +3,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\Company\CompanyFlexUltraContract">
<entity-listeners>
@@ -3,8 +3,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\Company\CompanyPerson" table="company_persons" inheritance-type="JOINED">
<discriminator-map >
@@ -2,7 +2,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\DDC117\DDC117Translation">
@@ -2,8 +2,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\DDC1476\DDC1476EntityWithDefaultFieldType">
<id name="id">
<generator strategy="NONE"/>
@@ -3,7 +3,7 @@
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd"
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"
>
<entity name="Doctrine\Tests\Models\DDC2825\ExplicitSchemaAndTable" table="explicit_table" schema="explicit_schema">
<id name="id" column="id">
@@ -3,7 +3,7 @@
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd"
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"
>
<entity name="Doctrine\Tests\Models\DDC2825\SchemaAndTableInTableName" table="implicit_schema.implicit_table">
<id name="id" column="id">
@@ -3,7 +3,7 @@
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Doctrine\Tests\Models\DDC3293\DDC3293Address">
<field name="street" type="string" />
<field name="city" type="string" />
@@ -3,7 +3,7 @@
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\DDC3293\DDC3293User" table="user">
<id name="id" column="id">
<generator strategy="UUID" />
@@ -3,7 +3,7 @@
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\DDC3293\DDC3293UserPrefixed" table="user">
<id name="id" column="id">
<generator strategy="UUID" />
@@ -2,7 +2,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\DDC3579\DDC3579Admin">
<association-overrides>
@@ -2,7 +2,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="Doctrine\Tests\Models\DDC3579\DDC3579User">
<id name="id" type="integer" column="user_id" length="150">
@@ -2,7 +2,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\DDC5934\DDC5934BaseContract">
<id name="id" type="integer">
@@ -2,7 +2,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\DDC5934\DDC5934Contract">
<association-overrides>
@@ -2,7 +2,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\DDC869\DDC869ChequePayment">
<field name="serialNumber" column="serialNumber" type="string"/>
@@ -2,8 +2,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\DDC869\DDC869CreditCardPayment">
<field name="creditCardNumber" column="creditCardNumber" type="string"/>
</entity>
@@ -2,7 +2,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="Doctrine\Tests\Models\DDC869\DDC869Payment" repository-class="Doctrine\Tests\Models\DDC869\DDC869PaymentRepository">
<id name="id" type="integer" column="id">
@@ -2,8 +2,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<class name="Doctrine\Tests\Models\DDC889\DDC889Class">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
@@ -2,8 +2,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\DDC889\DDC889Entity">
</entity>
@@ -2,8 +2,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="Doctrine\Tests\Models\DDC889\DDC889SuperClass">
<field name="name" column="name" type="string"/>
</mapped-superclass>
@@ -2,8 +2,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\DDC964\DDC964Admin">
<association-overrides>
<association-override name="groups">
@@ -2,8 +2,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\DDC964\DDC964Guest">
<attribute-overrides>
<attribute-override name="id">
@@ -2,8 +2,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="Doctrine\Tests\Models\DDC964\DDC964User">
<id name="id" type="integer" column="user_id" length="150">
<generator strategy="AUTO"/>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\GH7141\GH7141Article">
<one-to-many field="tags" target-entity="NoTargetEntity" mapped-by="noMappedByField">
<order-by>
<order-by-field name="position"/>
</order-by>
</one-to-many>
</entity>
</doctrine-mapping>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\Models\GH7316\GH7316Article">
<many-to-many field="tags" target-entity="NoTargetEntity" mapped-by="noMappedByField">
<order-by>
<order-by-field name="position"/>
</order-by>
</many-to-many>
</entity>
</doctrine-mapping>
@@ -2,7 +2,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="\stdClass">
<id name="id" type="integer" column="id">
@@ -2,7 +2,7 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Doctrine\Tests\Models\ValueObjects\Name">
<field name="firstName"/>
<field name="lastName"/>

Some files were not shown because too many files have changed in this diff Show More