Compare commits

..

7674 Commits
2.3.1 ... 3.0.2

Author SHA1 Message Date
Alexander M. Turek
b8d0a85017 Merge branch '2.18.x' into 3.0.x
* 2.18.x:
  Psalm 5.22.2 (#11326)
2024-03-01 10:51:50 +01:00
Alexander M. Turek
52a6a21387 Psalm 5.22.2 (#11326) 2024-03-01 10:47:18 +01:00
Alexander M. Turek
bf49055a1f Use enum_exists() for enums 2024-03-01 08:56:07 +01:00
Alexander M. Turek
694413a888 Remove PHP 7 workarounds (#11324) 2024-03-01 08:51:21 +01:00
Alexander M. Turek
20a6efdff6 Merge branch '2.18.x' into 3.0.x
* 2.18.x:
  PHPStan 1.10.59 (#11320)
2024-02-29 16:52:42 +01:00
Alexander M. Turek
4fc8629414 PHPStan 1.10.59 (#11320) 2024-02-29 16:47:35 +01:00
Grégoire Paris
95da667862 Merge remote-tracking branch 'origin/2.18.x' into 3.0.x 2024-02-28 22:57:35 +01:00
Alexander M. Turek
feb27f00c1 Address deprecations from Collection 2.2 (#11315) 2024-02-27 17:37:52 +01:00
Grégoire Paris
b187bc8588 Merge pull request #11308 from greg0ire/throw-instead-of-assert
Throw a full-fledged exception on invalid call
2024-02-26 20:38:49 +01:00
Grégoire Paris
719d007a81 Merge pull request #11298 from VincentLanglet/sqlWalkerPhpdoc
Fix sqlWalker::walkSimpleArithmeticExpression phpdoc
2024-02-26 08:21:47 +01:00
Grégoire Paris
3f7a3333ad Throw a full-fledged exception on invalid call
In 2.x, getAssociationMappedByTargetField() used to return null when
called with the owning side of an association.
That was undocumented and wrong because the phpdoc advertises a string
as a return type.

In 6ce0cf4a3d, I wrongly assumed that
nobody would be calling this method with the owning side of an
association.

Let us throw a full fledged exception and advertise the proper way of
avoiding this situation.

Closes #11250
2024-02-25 21:49:03 +01:00
Grégoire Paris
2a8802af12 Merge pull request #11305 from doctrine/typo
Remove extra word
2024-02-25 13:20:55 +01:00
Grégoire Paris
9cc11d2541 Remove extra word 2024-02-25 11:20:44 +01:00
Grégoire Paris
3907872046 Merge pull request #11302 from greg0ire/3.0.x
Merge 2.18.x up into 3.0.x
2024-02-24 21:03:34 +01:00
Grégoire Paris
54cd70002c Merge remote-tracking branch 'origin/2.18.x' into 3.0.x 2024-02-24 20:47:36 +01:00
Grégoire Paris
76c4539ffa Merge pull request #11293 from greg0ire/wrong-type
Remove wrong annotation about return type
2024-02-24 13:05:08 +01:00
Vincent Langlet
0f8d193512 Fix sql walker phpdoc 2024-02-23 15:11:15 +01:00
Grégoire Paris
cc314d0fb7 Remove wrong annotation about return type
Although this method is guaranteed to return either null or something
that can be used as a fully qualified class name, it never actually
checks that the class actually exists. Adding such a check breaks
several tests, including some that expect a exceptions at some later
points in the execution.
2024-02-22 23:14:52 +01:00
Alexander M. Turek
2a250b5814 Merge branch '2.18.x' into 3.0.x
* 2.18.x:
  Backport QueryParameterTest (#11288)
2024-02-22 13:23:53 +01:00
Alexander M. Turek
e6eef1a97d Backport QueryParameterTest (#11288) 2024-02-22 13:22:44 +01:00
Alexander M. Turek
44fa5d340a Merge pull request #11287 from derrabus/bugfix/parameter-types
Allow (Array)ParameterType in QueryBuilder
2024-02-22 09:31:34 +01:00
Alexander M. Turek
708146bbbc Test different ways of settings query parameters 2024-02-22 09:19:39 +01:00
Vincent Langlet
a5bf9bb96a Be less restrictive in DiscriminatorColumnMapping phpdoc (#11226)
* Be less restrictive in params

* Allow null options

* Simplify expression

* Fix ci

* Add support for null
2024-02-22 09:12:39 +01:00
Hanish Singla
3eace16e85 Allow (Array)ParameterType in QueryBuilder 2024-02-22 00:01:05 +01:00
Alexander M. Turek
bc5efd4bfe Merge branch '2.18.x' into 3.0.x
* 2.18.x:
  Fix Static Analysis folder reference (#11281)
  docs: recommend safer way to disable logging (#11269)
  Remove unused baseline entries
  Treat '0' as a legitimate trim char
2024-02-21 18:54:21 +01:00
Karoly Gossler
0efac09141 Fix Static Analysis folder reference (#11281) 2024-02-21 18:51:21 +01:00
Ondřej Mirtes
b6b4cbcb93 Remove broken assertion from DateAddFunction and DateSubFunction (#11243)
* Remove wrong asserts in DATE_ADD and DATE_SUB query AST function handlers

* Require DBAL 3.8.2
2024-02-20 20:29:56 +01:00
Grégoire Paris
efb6cebd41 Merge pull request #11270 from greg0ire/fix-trim-bug
Treat '0' as a legitimate trim char
2024-02-18 23:53:25 +01:00
Grégoire Paris
e4769d3191 docs: recommend safer way to disable logging (#11269)
* Remove trailing newlines

* Recommend safer way to disable logging

Resetting the middlewares on the configuration object will only work if
the connection object hasn't been built from that configuration object
yet. Instead, people should find the logger bound to the logging
middleware and disable it.
2024-02-18 15:51:05 +01:00
Grégoire Paris
cf408ad9ae Remove unused baseline entries 2024-02-18 12:26:18 +01:00
Grégoire Paris
7c29078051 Treat '0' as a legitimate trim char
Because of a loose comparison, it was not.
2024-02-18 11:34:10 +01:00
Grégoire Paris
d5ba106803 Merge pull request #11268 from greg0ire/3.0.x
Merge 2.18.x up into 3.0.x
2024-02-17 21:37:33 +01:00
Grégoire Paris
f9a4adc8ab Merge remote-tracking branch 'origin/2.18.x' into 3.0.x 2024-02-17 19:59:26 +01:00
Grégoire Paris
401a0c4fe9 Merge pull request #11266 from greg0ire/more-valid-docs
More valid docs
2024-02-17 19:57:34 +01:00
Grégoire Paris
dba9d72b2d Add type field mapper documentation to the sidebar 2024-02-17 15:10:28 +01:00
Grégoire Paris
fe0647053a Mark document as orphan
It is here for backward compatibilty reasons.
2024-02-17 15:06:46 +01:00
Grégoire Paris
7b3db4a037 Use correction sectionauthor syntax 2024-02-17 14:59:24 +01:00
Grégoire Paris
6672aaf165 Merge pull request #11265 from greg0ire/remove-unneeded-verify-depr
Remove unused trait
2024-02-17 14:55:10 +01:00
Grégoire Paris
aa3b331cae Remove unused trait 2024-02-17 11:14:47 +01:00
Thomas Landauer
3918dcfb42 [Documentation] Adding link to Postgres upgrade article (#11257)
* [Documentation] Adding link to Postgres upgrade article

* Update UPGRADE.md

* Update UPGRADE.md
2024-02-15 22:12:57 +01:00
Grégoire Paris
bfb033fe3c Merge pull request #11256 from greg0ire/3.0.x
Merge 2.18.x up into 3.0.x
2024-02-13 12:07:29 +01:00
Grégoire Paris
bf86155dc2 Merge remote-tracking branch 'origin/2.18.x' into 3.0.x 2024-02-13 11:29:26 +01:00
Grégoire Paris
1d218bae30 Make docs valid according to guides 0.3.3 (#11252) 2024-02-12 23:46:09 +01:00
Simon Podlipsky
9acc70d5b8 fix: support array-type arg in QB variadic calls (#11242) 2024-02-09 15:23:22 +01:00
Alexander M. Turek
5a40b99e11 Merge branch '2.18.x' into 3.0.x
* 2.18.x:
  Point link to correct upgrade guide (#11220)
  Ignore subclasses without discriminatorValue when generating discriminator column condition SQL (#11200)
  Update branches in README
2024-02-07 13:44:56 +01:00
Alexander M. Turek
94144e1227 Revert "Merge pull request #11229 from greg0ire/add-columns"
This reverts commit 599dd58fe1, reversing
changes made to 1854ce2d32.
2024-02-07 09:36:32 +01:00
Grégoire Paris
599dd58fe1 Merge pull request #11229 from greg0ire/add-columns
Add columns for 3.1.x and 4.0x
2024-02-07 07:56:20 +01:00
Grégoire Paris
aff543a4ff Add columns for 3.1.x and 4.0x 2024-02-06 23:12:13 +01:00
Andrey Bolonin
1854ce2d32 Update version ORM from 2 to 3 in docs (#11221) 2024-02-06 07:09:30 +01:00
Benjamin Morel
b00f0c258e Clean up outdated sentence (#11224)
The static create() method is gone in version 3
2024-02-05 22:58:19 +01:00
Grégoire Paris
13a79b068c Merge pull request #11222 from andreybolonin/patch-3
Update README.md
2024-02-05 08:36:56 +01:00
Andrey Bolonin
27c9e9cab3 Update README.md 2024-02-05 09:31:22 +03:00
Grégoire Paris
40fbbf4429 Point link to correct upgrade guide (#11220) 2024-02-04 17:41:45 +01:00
Alexander M. Turek
00ed2ca991 Bump dependencies in the "getting started" docs page (#11219) 2024-02-04 17:40:24 +01:00
Alexander M. Turek
54b7ad2073 DoctrineSetup was renamed to ORMSetup (#11218) 2024-02-04 17:40:04 +01:00
Michael Skvortsov
6f98147d09 Ignore subclasses without discriminatorValue when generating discriminator column condition SQL (#11200)
After commit 4e8e3ef30b when `\Doctrine\ORM\Query\SqlWalker` generates dicsriminator column condition SQL (method `\Doctrine\ORM\Query\SqlWalker::generateDiscriminatorColumnConditionSQL`) it adds an empty string to the list of possible values if the inheritance hierarchy contains a non-root abstract class. 

When the discriminator column is implemented with a custom type in PostgreSQL (equivalent of Enum) the query fails because the type cannot have a value of an empty string. It boils down to the fact that `\Doctrine\ORM\Mapping\ClassMetadataInfo::$subClasses` contains an abstract class and in its Metadata the value of `\Doctrine\ORM\Mapping\ClassMetadataInfo::$discriminatorValue` is `null`.

#### Previous behavior

In version 2.14.1 `\Doctrine\ORM\Mapping\ClassMetadataInfo::$subClasses` does not contain an abstract class.

Fixes #11199, fixes #11177, fixes #10846.
---------

Co-authored-by: Michael Skvortsov <michael.skvortsov@eleving.com>
Co-authored-by: Matthias Pigulla <mp@webfactory.de>
2024-02-04 00:11:40 +01:00
Alexander M. Turek
7527b788de Switch back to stable dependencies (#11210) 2024-02-03 21:24:40 +01:00
Grégoire Paris
cfadb5499d Merge pull request #11207 from derrabus/chore/readme
Update branches in README
2024-02-03 20:06:12 +01:00
Grégoire Paris
e52bc846f0 Merge pull request #11209 from greg0ire/update-branch-metdata
Update branch metadata
2024-02-03 20:00:29 +01:00
Alexander M. Turek
9ce9ae2818 Update branches in README 2024-02-03 19:43:49 +01:00
Grégoire Paris
f259754b7c Update branch metadata 2024-02-03 19:40:21 +01:00
Alexander M. Turek
3bc2cb6b15 Merge branch '2.19.x' into 3.0.x
* 2.19.x:
  Update branch metadata
2024-02-03 18:45:55 +01:00
Grégoire Paris
fdb9d44538 Merge pull request #11206 from greg0ire/update-branch-metdata
Update branch metadata
2024-02-03 18:37:27 +01:00
Grégoire Paris
a9fcaf1d18 Update branch metadata 2024-02-03 18:35:43 +01:00
Grégoire Paris
5b8b5f28f5 Run Rector on the source code (#11205) 2024-02-03 17:50:09 +01:00
Grégoire Paris
2e155e98a7 Merge pull request #11202 from mpdude/mergeup-2.18.x-3.0.x
Merge 2.18.x up into 3.0.x
2024-02-01 17:18:17 +01:00
Matthias Pigulla
c7a91a459c Fix Psalm complaints after merge-up 2024-02-01 09:50:15 +01:00
Matthias Pigulla
1df03f21e6 Write LimitSubqueryOutputWalkerTest in a way that is portable between DBAL 3 and 4 2024-02-01 09:40:04 +01:00
Matthias Pigulla
09f0966ad6 Fix CS after merge-up 2024-01-31 22:34:35 +01:00
Matthias Pigulla
da6c6f7045 Merge remote-tracking branch 'origin/2.18.x' into 3.0.x
Conflicts:
	phpstan-dbal2.neon
	phpstan-persistence2.neon
	phpstan.neon
	psalm-baseline.xml
	psalm.xml
	src/Persisters/Entity/BasicEntityPersister.php
	src/Query/Exec/MultiTableUpdateExecutor.php
	src/Utility/LockSqlHelper.php
	tests/Tests/ORM/Functional/Locking/LockTest.php
	tests/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php
2024-01-31 22:28:40 +01:00
Grégoire Paris
f2176a9ce5 Merge pull request #11201 from mpdude/merge-up-217-218
Merge 2.17.x up into 2.18.x
2024-01-31 16:53:12 +01:00
Matthias Pigulla
9a6ff66c5e Merge remote-tracking branch 'origin/2.17.x' into 2.18.x 2024-01-31 15:41:59 +01:00
Grégoire Paris
f58984c43f Merge pull request #11198 from jwage/port-lock-sql-changes
Fix calls to removed lock methods (#11061)
2024-01-31 08:50:41 +01:00
Alexander M. Turek
79c7c5087e Fix calls to removed lock methods (#11061) 2024-01-30 15:39:35 -06:00
Grégoire Paris
12c4560f1d Merge pull request #11197 from mpdude/update-limit-subquery-output-walker-test
Cover limit/offset values in `LimitSubqueryOutputWalkerTest`
2024-01-30 11:26:54 +01:00
Matthias Pigulla
152ebd756c Cover limit/offset values in LimitSubqueryOutputWalkerTest
This will help to make sure we don't lose those parts of the SQL when working on #11188.
2024-01-30 09:02:43 +01:00
Grégoire Paris
8845b6de0f Merge pull request #11195 from greg0ire/more-specific-type
Use a more specific type for getSqlStatements()
2024-01-30 08:58:52 +01:00
Grégoire Paris
e110941f9d Use a more specific type for getSqlStatements()
It is strictly beneficial for the Psalm baseline.
2024-01-29 21:07:12 +01:00
Grégoire Paris
fd8d981f30 Merge pull request #11193 from greg0ire/3.0.x
Merge 2.18.x up into 3.0.x
2024-01-28 17:34:45 +01:00
Grégoire Paris
db4d00a58f Merge remote-tracking branch 'origin/2.18.x' into 3.0.x 2024-01-28 16:59:59 +01:00
Grégoire Paris
5b5b56d83a Merge pull request #11190 from doctrine/2.17.x-merge-up-into-2.18.x_5AQ0zJbx
Merge release 2.17.4 into 2.18.x
2024-01-28 16:54:18 +01:00
Grégoire Paris
a9c45a37ff Merge remote-tracking branch 'origin/2.17.x' into 2.17.x-merge-up-into-2.18.x_5AQ0zJbx 2024-01-28 16:41:34 +01:00
Grégoire Paris
82533af893 Merge pull request #11191 from greg0ire/ignore-depr
Ignore deprecations handled in next major
2024-01-28 16:40:46 +01:00
Grégoire Paris
b988137378 Ignore deprecations handled in next major
These deprecations have been handled on 4.0.x in
https://github.com/doctrine/orm/pull/11061, it is safe to ignore them.
2024-01-28 16:30:02 +01:00
Grégoire Paris
ccfc97c32f Merge pull request #11187 from jwage/remove-xml-validation-disabling-deprecation
Remove XML validation disabling deprecation.
2024-01-26 20:41:16 +01:00
Grégoire Paris
1a5942a4d9 Merge pull request #11165 from jwage/allow-xml-validation-disable
Allow XML validation to be disabled but keep it enabled by default.
2024-01-26 20:39:27 +01:00
Jonathan H. Wage
282b8fbfe8 Move expectException call before line that triggers exception (best practice) 2024-01-26 10:00:16 -06:00
Jonathan H. Wage
d386b43be3 Remove XML validation disabling deprecation. 2024-01-26 09:59:03 -06:00
Jonathan H. Wage
537a27d277 Add test verifying that xml validation disabling/enabling works as expected. 2024-01-26 09:48:08 -06:00
Jonathan H. Wage
cf7757e090 Add back check that was reverted. 2024-01-26 09:33:17 -06:00
Grégoire Paris
0970ce7072 Merge pull request #11186 from derrabus/chore/readme-versions
Update branches in README
2024-01-26 08:34:24 +01:00
Alexander M. Turek
624c56be72 Update branches in README 2024-01-26 00:52:35 +01:00
Grégoire Paris
020d31efba Remove remaining submodules (#11183)
We are no longer relying on either piece of software.
2024-01-23 19:51:48 +01:00
Grégoire Paris
fbc8e6741e Merge pull request #11176 from thePanz/fix-11173-get-name-on-null-non-backed-enum
Throw exception when trying to use non-backed enum types
2024-01-23 07:50:20 +01:00
Grégoire Paris
2d65bc265b Merge pull request #11180 from greg0ire/allow-lexer-3
Allow doctrine/lexer 3
2024-01-22 19:51:10 +01:00
thePanz
7151db3cb8 Throw exception when trying to use non-backed enum types 2024-01-22 13:04:58 +01:00
Grégoire Paris
c23524259c Merge pull request #11181 from greg0ire/followup-rename
Look for lib remnants in hidden files
2024-01-21 23:52:34 +01:00
Grégoire Paris
4bddab9e09 Look for lib remnants in hidden files 2024-01-21 23:40:35 +01:00
Grégoire Paris
df730d69b8 Allow doctrine/lexer 3 2024-01-21 19:25:40 +01:00
Grégoire Paris
ac24c11808 Modernize code in documentation (#11179)
Somehow, there still were code samples relying on annotations.
2024-01-20 21:53:48 +01:00
Grégoire Paris
dd478d8662 Merge pull request #11178 from greg0ire/remove-ref-jira
Remove references to JIRA
2024-01-20 14:06:15 +01:00
Grégoire Paris
0b3cd72609 Remove references to JIRA 2024-01-20 13:45:04 +01:00
Grégoire Paris
85034699cb Merge pull request #11171 from greg0ire/extract-class
Make Doctrine\Tests\ORM\Internal\Node autoloadable
2024-01-18 21:33:06 +01:00
Grégoire Paris
d98186e2c4 Make Doctrine\Tests\ORM\Internal\Node autoloadable
It is used in several tests.
2024-01-18 21:19:28 +01:00
Grégoire Paris
69cc78c259 Merge remote-tracking branch 'fork/2.18.x' into 3.0.x 2024-01-18 21:07:35 +01:00
Grégoire Paris
2b8d6f87b2 Merge remote-tracking branch 'origin/2.17.x' into 2.18.x 2024-01-18 16:49:56 +01:00
Grégoire Paris
a0ed37954b Merge pull request #11167 from bobvandevijver/fix-eager-iterable-loading-test
Use foreach on iterable to prevent table locks during tests
2024-01-18 16:47:11 +01:00
Bob van de Vijver
4875f4c878 Use foreach on iterable to prevent table locks during tests 2024-01-18 10:24:40 +01:00
Grégoire Paris
b648bea2af Merge pull request #11164 from doctrine/2.17.x-merge-up-into-2.18.x_slYTN7ur
Merge release 2.17.3 into 2.18.x
2024-01-17 20:44:06 +01:00
Jonathan H. Wage
2893394673 Allow XML validation to be disabled but keep it enabled by default. 2024-01-17 13:13:39 -06:00
Grégoire Paris
f16594e89c Merge remote-tracking branch 'origin/2.17.x' into 2.17.x-merge-up-into-2.18.x_slYTN7ur 2024-01-17 20:10:52 +01:00
Grégoire Paris
398ab0547a Merge pull request #11162 from greg0ire/fix-libxml-compat
Remove redundant tags
2024-01-16 22:32:04 +01:00
Grégoire Paris
8f15337b03 Remove redundant tags
The "any" tags inside the definition for mapped superclasses and
embeddables duplicate what is already done for entities.

The other removed "any" tags are also redundant, as they duplicate
what's already done inside the grandparent "choice" tag.

Starting with version libxml 2.12, such redundant tags cause errors
about the content model not being "determinist".

Fixes #11117
2024-01-16 22:01:16 +01:00
Matthias Pigulla
a8632aca8f Keep the declared mapping information when using attribute overrides (#11135)
When using `AttributeOverride` to override mapping information inherited from a parent class (a mapped superclass), make sure to keep information about where the field was originally declared.

This is important for `private` fields: Without the correct `declared` information, it will lead to errors when cached mapping information is loaded, reflection wakes up and looks for the private field in the wrong class.
2024-01-13 00:06:34 +01:00
Matthias Pigulla
3dd3d38857 Fix @SequenceGeneratorDefinition inheritance, take 1 (#11050)
#10927 reported that #10455 broke the way how the default `@SequenceGeneratorDefinition` is created and inherited by subclasses for ID columns using `@GeneratedValue(strategy="SEQUENCE")`.

First, I had to understand how `@SequenceGeneratorDefinition` has been handled before #10455 when entity inheritance comes into play:

* Entity and mapped superclasses inherit the ID generator type (as given by `@GeneratedValue`) from their parent classes
* `@SequenceGeneratorDefinition`, however, is not generally inherited
* ... instead, a default sequence generator definition is created for every class when no explicit configuration is given. In this case, sequence names are based on the current class' table name.
* Once a root entity has been identified, all subclasses inherit its sequence generator definition unchanged.

#### Why did #10455 break this?

When I implemented #10455, I was mislead by two tests `BasicInheritanceMappingTest::testGeneratedValueFromMappedSuperclass` and `BasicInheritanceMappingTest::testMultipleMappedSuperclasses`.

These tests check the sequence generator definition that is inherited by an entity class from a mapped superclass, either directly or through an additional (intermediate) mapped superclass.

The tests expect the sequence generator definition on the entity _to be the same_ as on the base mapped superclass.

The reason why the tests worked before was the quirky behaviour of the annotation and attribute drivers that #10455 was aiming at: The drivers did not report the `@SequenceGeneratorDefinition` on the base mapped superclass where it was actually defined. Instead, they reported this `@SequenceGeneratorDefinition` for the entity class only.

This means the inheritance rules stated above did not take effect, since the ID field with the sequence generator was virtually pushed down to the entity class.

In #10455, I did not realize that these failing tests had to do with the quirky and changed mapping driver behaviour. Instead, I tried to "fix" the inheritance rules by passing along the sequence generator definition unchanged once the ID column had been defined.

#### Consequences of the change suggested here

This PR reverts the changes made to `@SequenceGeneratorDefinition` inheritance behaviour that were done in #10455.

This means that with the new "report fields where declared" driver mode (which is active in our functional tests) we can not expect the sequence generator definition to be inherited from mapped superclasses. The two test cases from `BasicInheritanceMappingTest` are removed.

I will leave a notice in #10455 to indicate that the new driver mode also affects sequence generator definitions.

The `GH10927Test` test case validates the sequence names generated in a few cases. In fact, I wrote this test against the `2.15.x` branch to make sure we get results that are consistent with the previous behaviour.

This also means `@SequenceGeneratorDefinition` on mapped superclasses is pointless: The mapped superclass does not make use of the definition itself (it has no table), and the setting is never inherited to child classes.
 
Fixes #10927. There is another implementation with slightly different inheritance semantics in #11052, in case the fix is not good enough and we'd need to review the topic later on.
2024-01-12 22:59:14 +01:00
Matthias Pigulla
c6b3509aa9 Include ON DELETE CASCADE associations in the delete order computation (#10913)
In order to resolve #10348, some changes were included in #10547 to improve the computed _delete_ order for entities. 

One assumption was that foreign key references with `ON DELETE SET NULL` or `... CASCADE` need not need to be taken into consideration when planning the deletion order, since the RDBMS would unset or cascade-delete such associations by itself when necessary. Only associations that do _not_ use RDBMS-level cascade handling would be sequenced, to make sure the referring entity is deleted before the referred-to one.

This assumption is wrong for `ON DELETE CASCADE`. The following examples give reasons why we need to also consider such associations, and in addition, we need to be able to deal with cycles formed by them.

In the following diagrams, `odc` means `ON DELETE CASCADE`, and `ref` is a regular foreign key with no extra `ON DELETE` semantics.

```mermaid
graph LR;
C-->|ref| B;
B-->|odc| A;
```

In this example, C must be removed before B and A. If we ignore the B->A dependency in the delete order computation, the result may not to be correct. ACB is not a working solution.

```mermaid
graph LR;
A-->|odc| B;
B-->|odc| A;
C-->|ref| B;
```

This is the situation in #10912. We have to deal with a cycle in the graph. C must be removed before A as well as B. If we ignore the B->A dependency (e.g. because we set it to "optional" to get away with the cycle), we might end up with an incorrect order ACB.

```mermaid
graph LR;
A-->|odc| B;
B-->|odc| A;
A-->|ref| C;
C-->|ref| B;
```

This example has no possible remove order. But, if we treat `odc` edges as optional, A -> C -> B would wrongly be deemed suitable.

```mermaid
graph LR;
A-->|ref| B;
B-->|odc| C;
C-->|odc| B;
D-->|ref| C;
```

Here, we must first remove A and D in any order; then, B and C in any order. If we treat one of the `odc` edges as optional, we might find the invalid solutions ABDC or DCAB.

#### Solution implemented in this PR

First, build a graph with a node for every to-be-removed entity, and edges for `ON DELETE CASCADE` associations between those entities. Then, use [Tarjan's algorithm](https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm) to find strongly connected components (SCCs) in this graph. The significance of SCCs is that whenever we remove one of the entities in a SCC from the database (no matter which one), the DBMS will immediately remove _all_ the other entities of that group as well.

For every SCC, pick one (arbitrary) entity from the group to represent all entities of that group. 

Then, build a second graph. Again we have nodes for all entities that are to be removed. This time, we insert edges for all regular (foreign key) associations and those with `ON DELETE CASCADE`. `ON DELETE SET NULL` can be left out. The edges are not added between the entities themselves, but between the entities representing the respective SCCs.

Also, for all non-trivial SCCs (those containing more than a single entity), add dependency edges to indicate that all entities of the SCC shall be processed _after_ the entity representing the group. This is to make sure we do not remove a SCC inadvertedly by removing one of its entities too early.

Run a topological sort on the second graph to get the actual delete order. Cycles in this second graph are a problem, there is no delete order.

Fixes #10912.
2024-01-12 22:44:07 +01:00
Grégoire Paris
a32578b7ea Merge pull request #11082 from bobvandevijver/eager-collection-iterable
Do not defer eager collection loading when in iteration context
2024-01-10 10:03:40 +01:00
Grégoire Paris
8aa6a5f401 Merge remote-tracking branch 'origin/2.18.x' into 3.0.x 2024-01-02 21:55:11 +01:00
Grégoire Paris
588d29d789 Merge pull request #11140 from greg0ire/psr-4
Flatten directory tree on 3.0
2024-01-02 21:54:38 +01:00
Grégoire Paris
d6989297c5 Merge pull request #11148 from greg0ire/flatten
Flatten directory tree on 2.18
2024-01-02 21:54:30 +01:00
Matthias Pigulla
e585a92763 Mention that `postRemove` may still see removed entities in in-memory collections (#11146)
... plus minor tweaks.
2024-01-02 21:31:28 +01:00
Grégoire Paris
0a3fbac8af Flatten directory tree
It will make fuzzy matchers more efficient, and configuration files more
readable.
2024-01-02 20:28:37 +01:00
Grégoire Paris
1556a1ff7a Merge pull request #11147 from greg0ire/remove-php-version-id
Remove irrelevant PHP version checks
2024-01-02 20:28:24 +01:00
Grégoire Paris
073f2aa891 Flatten directory tree
It will make fuzzy matchers more efficient, and configuration files more readable.

- lib/Doctrine/ORM becomes just src
- tests/Doctrine/ becomes just tests
2024-01-02 19:52:06 +01:00
Grégoire Paris
64e4a2129c Remove irrelevant PHP version checks 2024-01-02 09:00:22 +01:00
Grégoire Paris
7361d3e57d Merge remote-tracking branch 'origin/2.18.x' into 3.0.x 2024-01-02 08:57:41 +01:00
Grégoire Paris
a98e306335 Merge pull request #11144 from doctrine/2.17.x
Merge 2.17.x up into 2.18.x
2024-01-02 08:31:34 +01:00
Grégoire Paris
26f47cb8d3 Merge pull request #11142 from greg0ire/remove-inheritance
Remove inheritance
2024-01-02 08:24:50 +01:00
Grégoire Paris
ebb101009c Remove inheritance
Spotted while trying to merge https://github.com/doctrine/orm/pull/11076
(among other things) up into 3.0.x. On that branch, it is no longer
possible for an entity to extend another entity without specifying an
inheritance mapping type.

I think the goal of that inheritance was just to reuse the identifier
anyway, so let's just duplicate the identifier declaration instead.
2023-12-28 19:59:02 +01:00
Grégoire Paris
091e43eb9d Merge pull request #11141 from doctrine/2.17.x
Merge 2.17.x up into 2.18.x
2023-12-28 19:38:08 +01:00
Grégoire Paris
f80ef66ffb Merge pull request #11134 from doctrine/no-private-fields-duplicate
Mention in the limitations that private field names cannot be reused
2023-12-22 17:35:27 +01:00
Matthias Pigulla
85d78f8b0d Mention in the limitations that private field names cannot be reused 2023-12-22 17:13:11 +01:00
Grégoire Paris
c2886478e8 Merge pull request #11086 from mpdude/11058-revisited
Avoid an inconsistency in topological sort result order
2023-12-21 22:51:39 +01:00
Matthias Pigulla
108fa30db2 Improve topological sort result order
This PR changes a detail in the commit order computation for depended-upon entities.

We have a parent-child relationship between two entity classes. The association is parent one-to-many children, with the child entities containing the (owning side) back-reference.

Cascade-persist is not used, so all entities have to be passed to `EntityManager::persist()`.

Before v2.16.0, two child entities C1 and C2 will be inserted in the same order in which they are passed to `persist()`, and that is regardless of whether the parent entity was passed to `persist()` before or after the child entities.

As of v2.16.0, passing the parent entity to `persist()` _after_ the child entities will lead to an insert order that is _reversed_ compared to the order of `persist()` calls.

This PR makes the order consistent in both cases, as it was before v2.16.0.

 #### Cause

When the parent is passed to `persist()` after the children, commit order computation has to re-arrange the entities. The parent must be inserted first since it is referred to by the children.

The implementation of the topological sort from #10547 processed entities in reverse `persist()` order and unshifted finished nodes to an array to obtain the final result. That leads to dependencies (parent → before c1, parent → before c2) showing up in the result in the reverse order of which they were added.

This PR changes the topological sort to produce a result in the opposite order ("all edges pointing left"), which helps to avoid the duplicate array order reversal.

 #### Discussion

* This PR _does not_ change semantics of the `persist()` so that entities would (under all ciscumstances) be inserted in the order of `persist()` calls.
* It fixes an unnecessary inconsistency between versions before 2.16.0 and after. In particular, it may be surprising that the insert order for the child entities depends on whether another referred-to entity (the parent) was added before or after them.
* _Both_ orders (c1 before or after c2) are technically and logically correct with regard to the agreement that `commit()` is free to arrange entities in a way that allows for efficient insertion into the database.

Fixes #11058.
2023-12-21 16:26:20 +01:00
Alexander M. Turek
9785cb84c6 Merge release 2.17.2 into 2.18.x (#11131) 2023-12-20 23:16:21 +01:00
Alexander M. Turek
393679a479 Allow to skip property type validation (#11130) 2023-12-20 22:47:52 +01:00
Grégoire Paris
e50ae06fe7 Merge pull request #11122 from yceruto/enum_with_interface
Fix enum mapping validation
2023-12-15 08:12:07 +01:00
Yonel Ceruto
05ef1f4f96 Fixed enum mapping validation 2023-12-14 16:53:12 -05:00
Grégoire Paris
2b91edc525 Merge pull request #11115 from localheinz/fix/typo
Fix: Typo
2023-12-12 16:42:52 +01:00
Andreas Möller
6af7f9f7bf Fix: Typo 2023-12-12 16:33:54 +01:00
flaushi
46cb9a980b Added a note parameter type for the INSTANCE OF DQL expression (#7963)
Co-authored-by: flaushi <flaushi@users.noreply.github.com>
2023-12-12 14:51:31 +01:00
Grégoire Paris
c2d29d55ab Merge pull request #11114 from doctrine/2.17.x
Merge 2.17.x up into 2.18.x
2023-12-11 21:10:05 +01:00
flack
ed1df148c2 Fix method name in code example (#11104) 2023-12-04 21:07:27 +01:00
Tomas Norkūnas
44e943e100 Fix JSON mapping linting against subset of builtin types (#11076) 2023-12-02 11:32:08 +01:00
Alexander M. Turek
28d03e41f7 Merge branch '2.18.x' into 3.0.x
* 2.18.x:
  Add compatibility with the Symfony 4.4 VarExporter (#10948)
  PHPStan 5.16.0, Symfony 7.0 (#11095)
2023-12-01 21:58:59 +01:00
Cliff Odijk
23d36c0d52 Add compatibility with the Symfony 4.4 VarExporter (#10948) 2023-12-01 19:23:51 +01:00
Alexander M. Turek
212edaa80b PHPStan 5.16.0, Symfony 7.0 (#11095) 2023-11-29 14:35:05 +01:00
Markus Staab
f8ced51687 XmlDriver: remove dead code (#11085) 2023-11-25 09:16:23 +01:00
Bob van de Vijver
e5ab18ff80 Do not defer eager loading when iterable hint is set 2023-11-23 13:04:13 +01:00
Bob van de Vijver
665ccf1376 Add failing test
This test show that eager collections are broken when used in conjuction
with iterating over a result.
2023-11-23 12:42:38 +01:00
Grégoire Paris
2c06ffa4a7 Merge pull request #11071 from greg0ire/remove-wrong-assertion
Remove wrong assertion
2023-11-20 08:13:06 +01:00
Grégoire Paris
9a281f54de Remove wrong assertion
It is useless in that particular method, and wrong.
2023-11-19 21:29:56 +01:00
Grégoire Paris
b73d44b46b Merge pull request #11066 from doctrine/2.17.x-merge-up-into-3.0.x_45pl9AIy
Merge release 2.17.1 into 3.0.x
2023-11-17 08:19:27 +01:00
Grégoire Paris
b971cbeebb Merge remote-tracking branch 'origin/2.18.x' into 2.17.x-merge-up-into-3.0.x_45pl9AIy 2023-11-17 07:38:22 +01:00
Grégoire Paris
1a4fe6e0bb Merge pull request #11065 from kerbert101/fix-sleep-buhh
AbstractSqlExecutor::__sleep should return property names
2023-11-17 07:25:40 +01:00
Grégoire Paris
0a7b939623 Merge pull request #11039 from yceruto/enum_validation
Adds metadata field type and enumType validation against Entity property type
2023-11-16 23:45:38 +01:00
Albert Bakker
6be65ebc70 fix: return property names in AbstractSqlExecutor::__sleep
Property names as returned by a cast to array are mangled, and that
mangling is not documented. Returning unprefixed produces the same
result, and is more likely to be supported by external tools relying on
the documented possible return values of __sleep.

For instance symfony/var-exporter does not support mangled names, which
leads to issues when caching query parsing results in Symfony
applications.
2023-11-16 19:18:25 +01:00
Alexander M. Turek
fcba06f64c Merge release 2.17.0 into 3.0.x (#11062) 2023-11-16 00:11:38 +01:00
Alexander M. Turek
e8afa9f80c Prepare 2.17.0 (#11059) 2023-11-16 00:04:41 +01:00
Alexander M. Turek
7974a92bf9 Merge remote-tracking branch 'derrabus/3.0.x' into 3.0.x
* derrabus/3.0.x:
  Deprecate annotation classes for named queries
  Fix typos
  Housekeeping: Revert change to AbstractExporter, not needed without subselect fetch.
  Address review comments.
  Explain internals of eager loading in a bit more detail and how its configured.
  1:1 and M:1 associations also use fetch batch size configuration now.
  Add another testcase for DQL based fetch eager of collection.
  last violation hopefully
  Static analysis
  Housekeeping: phpcs
  Directly load many to many collections, batching not supported yet. fix tests.
  Avoid new fetch mode, use this strategy with fetch=EAGER for collections.
  Make sure to many assocatinos are also respecting AbstractQuery::setFetchMode
  Disallow use of fetch=SUBSELECT on to-one associations.
  Go through Persister API instead of indirectly through repository.
  Introduce configuration option for subselect batch size.
  Houskeeping: phpcs
  Disallow WITH keyword on fetch joined associatiosn via subselect.
  [GH-1569] Add new SUBSELECT fetch mode for OneToMany associations.
2023-11-15 23:49:44 +01:00
Alexander M. Turek
124593383b Fix calls to removed lock methods (#11061) 2023-11-15 23:48:59 +01:00
Alexander M. Turek
56df970d8b Merge branch '2.17.x' into 3.0.x
* 2.17.x:
  Deprecate annotation classes for named queries
  Fix typos
  Housekeeping: Revert change to AbstractExporter, not needed without subselect fetch.
  Address review comments.
  Explain internals of eager loading in a bit more detail and how its configured.
  1:1 and M:1 associations also use fetch batch size configuration now.
  Add another testcase for DQL based fetch eager of collection.
  last violation hopefully
  Static analysis
  Housekeeping: phpcs
  Directly load many to many collections, batching not supported yet. fix tests.
  Avoid new fetch mode, use this strategy with fetch=EAGER for collections.
  Make sure to many assocatinos are also respecting AbstractQuery::setFetchMode
  Disallow use of fetch=SUBSELECT on to-one associations.
  Go through Persister API instead of indirectly through repository.
  Introduce configuration option for subselect batch size.
  Houskeeping: phpcs
  Disallow WITH keyword on fetch joined associatiosn via subselect.
  [GH-1569] Add new SUBSELECT fetch mode for OneToMany associations.
2023-11-15 21:37:34 +01:00
Grégoire Paris
1267f482ef Merge pull request #8391 from beberlei/GH-1569-SubselectFetchMode
[GH-1569] Optimize eager fetch for collections to batch query
2023-11-14 08:16:00 +01:00
Grégoire Paris
21466a0524 Merge pull request #10986 from greg0ire/drop-support-for-unserializing-old-format
Drop support for unserializing old serialization formats
2023-11-14 08:15:19 +01:00
Grégoire Paris
010cd948c9 Drop support for unserializing old serialization formats 2023-11-11 18:44:26 +01:00
Grégoire Paris
b41de2a39d Merge pull request #11056 from derrabus/deprecate/named-queries
Deprecate annotation classes for named queries
2023-11-11 12:30:09 +01:00
Alexander M. Turek
6a48b0741b Deprecate annotation classes for named queries 2023-11-09 16:01:17 +01:00
Grégoire Paris
30626ac6bb Merge remote-tracking branch 'origin/2.17.x' into 3.0.x 2023-11-08 09:30:31 +01:00
Grégoire Paris
1f62233bf6 Merge pull request #11045 from greg0ire/dynamic-recommendation
Dynamically resolve AUTO to SEQUENCE or IDENTITY
2023-11-08 08:27:04 +01:00
Grégoire Paris
ffbe56779d Remove unneeded test
There no longer is such a thing as recommended strategies.
2023-11-07 21:10:01 +01:00
Grégoire Paris
bdc039fe31 Dynamically resolve AUTO to SEQUENCE or IDENTITY
With DBAL 3.x, IDENTITY results in SERIAL.
With DBAL 4.x, it results in the standard GENERATED BY DEFAULT AS IDENTITY.
2023-11-07 20:59:44 +01:00
Grégoire Paris
0e95838787 Merge pull request #11044 from greg0ire/identity-on-dbal4
Recommend SEQUENCE until doctrine/dbal 4 is released
2023-11-07 08:14:32 +01:00
Grégoire Paris
be62f72b38 Merge pull request #11048 from greg0ire/restore-bc
Restore backward compatibility with previous format
2023-11-06 20:08:18 +01:00
Yonel Ceruto
7613f25d57 Adds metadata field type and enumType validation against Entity property type 2023-11-06 08:23:58 -05:00
Grégoire Paris
c075154e1e Restore backward compatibility with previous format
When unserializing from a cache entry in the previous format, the
sqlStatements need to be copied from the legacy property to the new
property before the reference is created.
2023-11-06 07:52:27 +01:00
Grégoire Paris
f08159eb87 Merge pull request #11027 from greg0ire/fw-compat-serialization
Make serialized SQL executors forward compatible
2023-11-05 23:27:48 +01:00
Grégoire Paris
300cffb942 Recommend SEQUENCE until doctrine/dbal 4 is released
Using IDENTITY with doctrine/dbal 3 results in SERIAL, which is not
recommended.
2023-11-05 20:59:24 +01:00
Grégoire Paris
2a9390d426 Make serialized SQL executors forward compatible
The idea here is that instead of having a backward compatibility layer
in the next major branch, we can have a forward compatibility layer in
this branch.
2023-11-05 19:56:16 +01:00
Benjamin Eberlei
ec74c83845 Fix typos 2023-11-05 19:26:35 +01:00
Grégoire Paris
73288bc472 Merge pull request #11013 from greg0ire/native-type-decl
Enforce native type declarations
2023-10-22 23:19:37 +02:00
Benjamin Eberlei
4b2b4860fb Housekeeping: Revert change to AbstractExporter, not needed without subselect fetch. 2023-10-22 20:11:36 +02:00
Benjamin Eberlei
609e10df36 Address review comments. 2023-10-22 20:08:18 +02:00
Benjamin Eberlei
d03aed1265 Explain internals of eager loading in a bit more detail and how its configured. 2023-10-22 20:08:06 +02:00
Benjamin Eberlei
6993ad28ed 1:1 and M:1 associations also use fetch batch size configuration now. 2023-10-22 20:07:04 +02:00
Grégoire Paris
8ab0af3d30 Enforce native type declarations
I tried to avoid changes in tests, so as to not unnecessarily widen the
gap between 2.x and 3.x.
2023-10-22 15:45:24 +02:00
Grégoire Paris
82f4a177b2 Use native type hint for ProxyFactory::getProxy
This requires heavily adapting tests, because the proxy instance must:
- be an instance of InternalProxy (easy)
- be a valid entity (hard, especially for PHPUnit)
2023-10-22 15:45:24 +02:00
Grégoire Paris
1fef3196d9 Merge remote-tracking branch 'origin/2.17.x' into 3.0.x 2023-10-21 20:06:57 +02:00
Grégoire Paris
16028e4fd3 Merge pull request #11023 from doctrine/2.16.x
Merge 2.16.x up into 2.17.x
2023-10-21 19:52:04 +02:00
Grégoire Paris
609647a51a Merge pull request #11015 from greg0ire/phase2-optim
Make phpdoc accurate
2023-10-21 19:35:18 +02:00
Grégoire Paris
293299a314 Make phpdoc accurate
When transforming these phpdoc types into native types, things break
down. They are correct according to the EBNF, but in practice, there are
so-called phase 2 optimizations that allow using ConditionalPrimary,
ConditionalFactor and ConditionalTerm instances in places where
ConditionalExpression is used.
2023-10-21 19:15:03 +02:00
Grégoire Paris
0b7fe1862e Merge pull request #11018 from stof/fix_result_set_builder_enum
Fix the support for enum types in the ResultSetMappingBuilder
2023-10-18 22:27:01 +02:00
Christophe Coevoet
866283d1a7 Fix the support for enum types in the ResultSetMappingBuilder 2023-10-18 10:04:20 +02:00
Grégoire Paris
3676e3c571 Merge pull request #11007 from greg0ire/refresh-archi-docs
Address split of doctrine/common
2023-10-17 21:41:52 +02:00
Grégoire Paris
d84f607487 Address split of doctrine/common
doctrine/common has been split in several packages. A lot of what was
true about doctrine/common is true about doctrine/persistence today, so
let us simply reuse the existing paragraphs and mention persistence
instead of common.
2023-10-17 20:02:34 +02:00
Alexander M. Turek
ad519a5c6f Prepare CI for stable DBAL 4 (#11011) 2023-10-16 08:41:34 +02:00
Grégoire Paris
4444065531 Remove dependency on doctrine/common (#10998)
We were only relying on it for functionality related to proxies, which
is very little code.
2023-10-15 21:30:26 +02:00
Grégoire Paris
e280b2df26 Use native return type declarations in Debug class (#11012) 2023-10-15 13:56:52 +02:00
Grégoire Paris
3c34265666 Merge pull request #11010 from greg0ire/3.0.x
Merge 2.17.x up into 3.0.x
2023-10-14 23:26:51 +02:00
Grégoire Paris
8693fa790c Merge remote-tracking branch 'origin/2.17.x' into 3.0.x 2023-10-14 23:12:19 +02:00
Grégoire Paris
edd962e385 Merge pull request #11000 from greg0ire/copy-debug
Copy Debug class from doctrine/common
2023-10-14 23:00:13 +02:00
Grégoire Paris
a33a3813b2 Copy Debug class from doctrine/common
This reduces our dependency to this shared library that now holds very
little code we use.
The class has not been copied verbatim:
- Unused parameters and methods have been removed.
- The class is final and internal.
- Coding standards have been enforced, including enabling strict_types,
  which lead to casting a variable to string before feeding it to
  explode().
- A bug found by static analysis has been addressed, where an INI
  setting obtained with ini_get() was compared with true, which is never
  returned by that function.
- Tests are improved to run on all PHP versions
2023-10-14 21:21:51 +02:00
Grégoire Paris
bf69d0ac4e Implement proxy name resolver (#11009)
It is important to have the same implementation as used in
doctrine/persistence without relying on copy/paste.
2023-10-14 19:48:11 +02:00
Benjamin Eberlei
3f2fa309d4 Add another testcase for DQL based fetch eager of collection. 2023-10-14 15:56:42 +02:00
Benjamin Eberlei
8057b51f85 last violation hopefully 2023-10-14 15:38:26 +02:00
Benjamin Eberlei
c09660ac50 Merge remote-tracking branch 'origin/2.17.x' into GH-1569-SubselectFetchMode 2023-10-14 15:29:11 +02:00
Benjamin Eberlei
8ec599bb17 Static analysis 2023-10-14 15:28:57 +02:00
Benjamin Eberlei
bf74b434b8 Housekeeping: phpcs 2023-10-14 14:23:20 +02:00
Benjamin Eberlei
cd54c56278 Directly load many to many collections, batching not supported yet. fix tests. 2023-10-14 14:21:15 +02:00
Benjamin Eberlei
76fd34f766 Avoid new fetch mode, use this strategy with fetch=EAGER for collections. 2023-10-14 14:04:30 +02:00
David Buchmann
1cec0b82bd Remove useless check (#11006) 2023-10-13 18:57:12 +02:00
Grégoire Paris
0e74a180c4 Merge pull request #10999 from greg0ire/prepare-common-severance 2023-10-13 11:25:16 +02:00
Grégoire Paris
fdfca0f0e7 Undeprecate Autoloader class
We plan to sunset doctrine/common, and should move the Autoloader class
to doctrine/orm
2023-10-13 09:02:36 +02:00
Alexander M. Turek
e997c6688c Remove schema visitors (#11001) 2023-10-12 20:23:35 +02:00
Grégoire Paris
03148b1300 Merge pull request #10964 from soltmar/2.16.x-update-order-of-mapping-attributes
Updated order of mapping attribute parameters
2023-10-11 23:04:43 +02:00
Mariusz Soltys
f47d68c826 Merge branch '3.0.x' into 2.16.x-update-order-of-mapping-attributes 2023-10-11 15:05:50 +01:00
Alexander M. Turek
42af7cabb7 Cover calling AbstractQuery::setParameter() with an array parameter (#10996) 2023-10-11 16:04:47 +02:00
Alexander M. Turek
06eb00d687 Fix array parameters with DBAL 4 (#10995) 2023-10-11 15:27:18 +02:00
Benjamin Eberlei
7827453b94 UPGRADE.md is missing two latest merges. 2023-10-11 13:48:34 +02:00
Benjamin Eberlei
6f3140a09e Merge pull request #10994 from beberlei/3.0.x-g
Merge up 2.17.x to 3.0.x
2023-10-11 13:40:02 +02:00
Benjamin Eberlei
2d31d71961 Adapt tests, upgrade cs and fix static coding violations and baseline 2023-10-11 13:38:10 +02:00
Benjamin Eberlei
2db1f76dee Rework AUTO keyword deafults to be IDENTITY always, except Oracle SEQUENCE. 2023-10-11 12:00:40 +02:00
Benjamin Eberlei
6e61571edc Housekeeping: phpcs 2023-10-11 11:09:21 +02:00
Benjamin Eberlei
22e7c02cf7 Throw exceptions for cases where attributes are illegal on Embeddables. (#10992)
* Throw exceptions for cases where attributes are illegal on Embeddables.

* Embedded is allowed on Embeddable, update SchemaValidator.
2023-10-11 11:05:24 +02:00
Grégoire Paris
4a5f48f7ff Merge remote-tracking branch 'origin/2.17.x' into 3.0.x 2023-10-11 11:00:55 +02:00
Grégoire Paris
5534db1810 Merge commit '07b091750' into 3.0.x 2023-10-11 10:55:09 +02:00
Grégoire Paris
18897fa7d5 Merge pull request #10985 from greg0ire/remove-partial-from-dql 2023-10-11 10:49:29 +02:00
Grégoire Paris
c5137da90e Merge pull request #8931 from greg0ire/gh-8893 2023-10-11 10:38:15 +02:00
Grégoire Paris
689da1f251 Remove unused exception 2023-10-11 10:31:35 +02:00
Grégoire Paris
5c250063b8 Remove EntityManager::getPartialReference() 2023-10-11 10:31:35 +02:00
Grégoire Paris
99fe3b5c5b Remove partial syntax in DQL
It is no longer possible to use the "PARTIAL" keyword in a DQL query, or
to artificially build an AST with a partial object expression. It is
still possible to use the result set mapping API to build partial
objects.
2023-10-11 10:24:02 +02:00
Grégoire Paris
e89b680a28 Deprecate reliance on non-optimal defaults
What was optimal 10 years ago no longer is, and things might change in
the future. Using AUTO is still the best solution in most cases, and it
should be easy to make it mean something else when it is not.
2023-10-11 10:19:39 +02:00
Alexander M. Turek
af5c250cc8 Merge branch '2.17.x' into 3.0.x
* 2.17.x:
  Allow creating mocks of the Query class (#10990)
  Add missing "deprecated" annotation on the annotation driver
  Deprecate EntityManager*::getPartialReference()
2023-10-11 09:59:27 +02:00
Grégoire Paris
07b0917505 Merge pull request #10989 from greg0ire/improve-exceptions
Add method name in exception
2023-10-10 21:22:05 +02:00
Alexander M. Turek
143ee25697 Allow creating mocks of the Query class (#10990) 2023-10-10 17:16:01 +02:00
Grégoire Paris
52853c2e9c Merge pull request #10988 from greg0ire/add-missing-annotation 2023-10-10 16:42:50 +02:00
Benjamin Eberlei
40bfe07172 Make sure to many assocatinos are also respecting AbstractQuery::setFetchMode 2023-10-10 16:29:00 +02:00
Grégoire Paris
1fe0910d6b Merge pull request #10332 from greg0ire/drop-lexer-2 2023-10-10 16:25:37 +02:00
Grégoire Paris
6983f48490 Merge pull request #10987 from greg0ire/deprecate-partialreference 2023-10-10 15:32:11 +02:00
Grégoire Paris
194f5062bb Add method name in exception
When we assert a given exception should be thrown, and get this instead,
it is hard to figure out what went wrong.
2023-10-10 15:19:16 +02:00
Grégoire Paris
922365d2c5 Add missing "deprecated" annotation on the annotation driver 2023-10-10 15:14:11 +02:00
Grégoire Paris
a1e055b608 Deprecate EntityManager*::getPartialReference()
Partial objects have been deprecated, so it makes no sense to still have
this way of getting some.
2023-10-10 14:39:08 +02:00
Alexander M. Turek
2cf0c59f7a Allow VarExporter 7 (#10984) 2023-10-10 12:42:04 +02:00
Mariusz Soltys
7e51a09347 Updated order of mapping attribute parameters 2023-10-10 11:15:33 +01:00
Alexander M. Turek
906e91cbb4 Merge branch '2.17.x' into 3.0.x
* 2.17.x:
  Don't assert that BIGINTs are stored as strings (#10980)
2023-10-10 11:36:17 +02:00
Alexander M. Turek
0e3489b240 Don't assert that BIGINTs are stored as strings (#10980) 2023-10-10 11:35:09 +02:00
Benjamin Eberlei
ff28ba8080 Disallow use of fetch=SUBSELECT on to-one associations. 2023-10-10 08:25:04 +02:00
Benjamin Eberlei
41410e6be1 Go through Persister API instead of indirectly through repository. 2023-10-10 08:17:25 +02:00
Benjamin Eberlei
b9e55bad4d Introduce configuration option for subselect batch size. 2023-10-10 07:59:29 +02:00
Benjamin Eberlei
47952c3228 Houskeeping: phpcs 2023-10-10 07:51:13 +02:00
Benjamin Eberlei
fdceb82454 Disallow WITH keyword on fetch joined associatiosn via subselect. 2023-10-10 07:49:38 +02:00
Benjamin Eberlei
dc899e26cf [GH-1569] Add new SUBSELECT fetch mode for OneToMany associations.
Co-authored-by: Wouter M. van Vliet <wouter@interpotential.com>
2023-10-10 07:26:17 +02:00
Alexander M. Turek
2aaec3a79a Merge branch '2.17.x' into 3.0.x
* 2.17.x:
  document Paginator::HINT_ENABLE_DISTINCT
  allow to disable "DISTINCT" added to the sql query by the limit subquery walker
  Test against php 8.3 (#10963)
  update checkout version to version 4
2023-10-09 17:51:53 +02:00
Alexander M. Turek
48edb33b3f Merge branch '2.16.x' into 2.17.x
* 2.16.x:
  Test against php 8.3 (#10963)
  update checkout version to version 4
2023-10-09 17:30:21 +02:00
Grégoire Paris
9c2e49a665 Merge pull request #10970 from goetas/distinct-limit 2023-10-09 16:43:20 +02:00
Grégoire Paris
4799c418c9 Merge pull request #10975 from greg0ire/void-execute-insert 2023-10-09 16:40:07 +02:00
Grégoire Paris
a1d7de6b66 Merge remote-tracking branch 'origin/2.17.x' into 3.0.x 2023-10-09 16:35:27 +02:00
Grégoire Paris
8ef5c80148 Merge pull request #10974 from beberlei/RemovePartialObjectExpressionUsage 2023-10-09 16:28:45 +02:00
Grégoire Paris
83d46d7cf9 Change EntityPersister return type
Calling UnitOfWork::assignPostInsertId() is now the way to go.
2023-10-09 16:13:29 +02:00
Benjamin Eberlei
083b1f98c1 Housekeeping: phpcs 2023-10-09 15:42:41 +02:00
Matthias Pigulla
3ff67c3e2f Merge pull request #10967 from greg0ire/remove-commit-order-calculator-from-2
Remove CommitOrderCalculator and related classes
2023-10-09 15:37:05 +02:00
Benjamin Eberlei
84a762e12e Adjust tests for new sql generation 2023-10-09 15:35:48 +02:00
Benjamin Eberlei
ef2123bd0f Remove use of PartialObjectExyxpression for LimitSubqueryOutputWalker to prepare for removal. 2023-10-09 15:30:10 +02:00
Asmir Mustafic
55699a9129 document Paginator::HINT_ENABLE_DISTINCT 2023-10-09 14:05:01 +02:00
Asmir Mustafic
68fc3b6458 allow to disable "DISTINCT" added to the sql query by the limit subquery walker 2023-10-09 14:05:01 +02:00
Serhii Petrov
32192c7b01 Test against php 8.3 (#10963) 2023-10-09 12:43:52 +02:00
Grégoire Paris
f3b6c4b356 Use lazy ghosts unconditionally (#10969)
* Use lazy ghosts unconditionally

* Stop extending proxy factory from doctrine/common

Extending it no longer serves any purpose.

* Transform annotation into actual method
2023-10-08 23:18:35 +02:00
Grégoire Paris
77843e45f3 Merge pull request #10972 from salehhashemi1992/ci/update-checkout-to-v4
update actions/checkout to v4
2023-10-08 18:44:13 +02:00
Grégoire Paris
343afda275 Merge pull request #10971 from greg0ire/restore-prefer-lowest
Restore job with --prefer-lowest
2023-10-08 18:43:53 +02:00
Grégoire Paris
27009986d7 Restore job with --prefer-lowest
It is useful to catch misconfigured dependency constraints. It was
removed in 413c33274d.
This implies configuring mocks so as to support psr/cache 1
psr/cache 1 does not use native return types, and phpdoc is not enough
to obtain a mock that has typed methods.
2023-10-08 13:08:16 +02:00
salehhashemi1992
1919eea0a9 update checkout version to version 4 2023-10-08 11:04:22 +03:30
Grégoire Paris
e71868fe8b Merge pull request #10968 from greg0ire/reject-id-collisions-unconditionally
Reject ID collisions in identity map unconditionally
2023-10-07 21:39:56 +02:00
Grégoire Paris
795e7735d8 Reject ID collisions in identity map unconditionally 2023-10-07 20:54:04 +02:00
Grégoire Paris
925631878f Remove CommitOrderCalculator and related classes
They are unused, and since they are internal, it should be fine to
remove them without a deprecation.
2023-10-07 11:57:26 +02:00
Grégoire Paris
46ef989f38 Update reference 2023-10-06 23:55:34 +02:00
Grégoire Paris
8a4d35d5e7 Merge origin/2.17.x into 3.0.x (using imerge) 2023-10-06 23:50:53 +02:00
Grégoire Paris
faec95fed2 Merge pull request #10909 from greg0ire/imerge/continue-merge-up
Continue merge up
2023-10-06 21:06:54 +02:00
Grégoire Paris
c69044bc9b Implement InternalProxy as well 2023-10-03 12:22:17 +02:00
Alexander M. Turek
db2791001c Merge branch '2.16.x' into 2.17.x
* 2.16.x:
  PHPStan 1.10.35, Psalm 5.15.0 (#10958)
  docs: in text, refer to attributes when talking about metadata (#10956)
  Fix bullet list layout (#10951)
  docs[query-builder]: fix rendering of `Doctrine\DBAL\ParameterType::*` (#10945)
  tests[ORMSetupTest]: testCacheNamespaceShouldBeGeneratedForApcu requires enabled apc (#10940)
  docs: use modern named arguments syntax
  Ignore "Unknown directive" error
  Use a stable release
  Remove output directory argument
  tutorials[getting-started]: example fix bug id type definition
  Verify UnitOfWork::HINT_DEFEREAGERLOAD exists and is true
2023-09-29 08:57:56 +02:00
Alexander M. Turek
62ed63bbbe PHPStan 1.10.35, Psalm 5.15.0 (#10958) 2023-09-29 08:56:45 +02:00
Danny van Kooten
081ec2ad26 docs: in text, refer to attributes when talking about metadata (#10956)
Co-authored-by: Danny van Kooten <dannyvankooten@users.noreply.github.com>
2023-09-28 21:49:15 +02:00
Grégoire Paris
9a1085d72f Merge pull request #10954 from dannyvankooten/3.0.x 2023-09-28 11:54:33 +02:00
Danny van Kooten
501226b90b remove reference to removed yaml configuration option 2023-09-28 11:02:28 +02:00
Grégoire Paris
633ce41460 Merge pull request #10946 from greg0ire/improved-validation
Adds metadata field type validation against Entity property type
2023-09-23 12:12:18 +02:00
Adrien Crivelli
e9537f4cde Fix bullet list layout (#10951) 2023-09-19 21:01:37 +02:00
DavideBicego
0f67ba2176 Adds metadata field type validation against Entity property type
This avoid situations where you might map a decimal to a float, when it
should really be mapped to a string. This is a big pitfall because in
that situation, the ORM will consider the field changed every time.
2023-09-15 11:19:58 +02:00
Marko Kaznovac
38ad3925e2 docs[query-builder]: fix rendering of Doctrine\DBAL\ParameterType::* (#10945) 2023-09-15 00:17:48 +02:00
Marko Kaznovac
858b01f85e tests[ORMSetupTest]: testCacheNamespaceShouldBeGeneratedForApcu requires enabled apc (#10940) 2023-09-10 22:57:36 +02:00
Grégoire Paris
9f555ea8fb Merge pull request #10933 from kaznovac/patch-2
docs: use modern named arguments syntax
2023-09-08 22:02:11 +02:00
Marko Kaznovac
1f8c02f345 docs: use modern named arguments syntax
use official named arguments syntax in example instead of pre php 8 codestyle for 'named' arguments
2023-09-08 13:47:11 +02:00
Grégoire Paris
d81afdb6e3 Merge pull request #10930 from greg0ire/improve-doc-job
Improve doc job
2023-09-02 23:15:56 +02:00
Grégoire Paris
0628204b43 Ignore "Unknown directive" error
We have a lot of errors about "Unknown directive" that we should make
known when implementing guides for Doctrine, but cannot address by
modifying the docs.

The unknown directives are:

- configuration-block
- toc
- tocheader
- sectionauthor
2023-09-02 19:29:05 +02:00
Grégoire Paris
816ecc6d6b Use a stable release
0.1.0 has been published 3 weeks ago. This means we no longer need to
  use dev stability
2023-09-02 19:02:59 +02:00
Grégoire Paris
f66263d859 Remove output directory argument
It is no actually necessary at all.
2023-09-02 19:01:46 +02:00
Grégoire Paris
8aa5aa2f57 Merge pull request #10929 from kaznovac/patch-1
tutorials[getting-started]: example fix bug id type definition
2023-09-02 18:52:43 +02:00
Marko Kaznovac
96e31a3b30 tutorials[getting-started]: example fix bug id type definition 2023-09-02 17:48:29 +02:00
Grégoire Paris
a60a273423 Merge pull request #10808 from oscmarb/verifiy-hint-defer-eager-load-is-true
Verify UnitOfWork::HINT_DEFEREAGERLOAD exists and is true
2023-09-01 07:52:11 +02:00
Alexander M. Turek
a2d2e173c2 Merge release 2.16.2 into 2.17.x (#10924) 2023-08-28 09:50:37 +02:00
Grégoire Paris
17500f56ea Merge pull request #10923 from kaznovac/patch-1
basic-mapping: fix new-line rendered in output
2023-08-27 20:21:56 +02:00
Marko Kaznovac
fc2f724e2d basic-mapping: fix new-line rendered in output 2023-08-27 19:17:04 +02:00
Óscar Martínez
7986fc64dd Verify UnitOfWork::HINT_DEFEREAGERLOAD exists and is true 2023-08-25 09:51:02 +02:00
Grégoire Paris
2f9e98754b Merge pull request #10915 from mpdude/post-events-later
Mitigate problems with `EntityManager::flush()` reentrance since 2.16.0 (Take 2)
2023-08-25 07:47:25 +02:00
Alexander M. Turek
aa333e2f1d Support Symfony 7 by adding return types conditionally (#10919) 2023-08-24 10:36:04 +02:00
Alexander M. Turek
b6441b4f26 Merge branch '2.16.x' into 2.17.x
* 2.16.x:
  Use required classes for Lifecycle Callback examples (#10916)
  Add space before backquote (#10918)
  Add back throws annotation to getSingleScalarResult (#10907)
  Fix link on known issues docs (#10904)
2023-08-23 23:47:29 +02:00
Sergii Dolgushev
bb5524099c Use required classes for Lifecycle Callback examples (#10916)
* Use required classes for Lifecycle Callback examples

* Coding Style fixes

---------

Co-authored-by: Sergii Dolgushev <Sergii.Dolgushev@secondwaveds.com>
2023-08-23 22:47:15 +02:00
Grégoire Paris
3a8cafe228 Add space before backquote (#10918)
According to the RST docs,

> [inline markup] it must be separated from surrounding text by non-word
> characters. Use a backslash escaped space to work around that: thisis\ *one*\ word.

Because we were missing a space before backquotes here, the links were
not rendered. Escaping the space allow not to actually produce a space
in the output.

See https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#inline-markup
2023-08-23 21:42:35 +02:00
Matthias Pigulla
8259a16681 Mitigate problems with EntityManager::flush() reentrance since 2.16.0 (Take 2)
The changes from #10547, which landed in 2.16.0, cause problems for users calling `EntityManager::flush()` from within `postPersist` event listeners.

* When `UnitOfWork::commit()` is re-entered, the "inner" (reentrant) call will start working through all changesets. Eventually, it finishes with all insertions being performed and `UoW::$entityInsertions` being empty. After return, the entity insertion order, an array computed at the beginning of `UnitOfWork::executeInserts()`, still contains entities that now have been processed already. This leads to a strange-looking SQL error where the number of parameters used does not match the number of parameters bound. This has been reported as #10869.

* The fixes made to the commit order computation may lead to a different entity insertion order than previously. `postPersist` listener code may be affected by this when accessing generated IDs for other entities than the one the event has been dispatched for. This ID may not yet be available when the insertion order is different from the one that was used before 2.16. This has been mentioned in https://github.com/doctrine/orm/pull/10906#issuecomment-1682417987.

This PR suggests to address both issues by dispatching the `postPersist` event only after _all_ new entities have their rows inserted into the database. Likewise, dispatch `postRemove` only after _all_ deletions have been executed.

This solves the first issue because the sequence of insertions or deletions has been processed completely _before_ we start calling event listeners. This way, potential changes made by listeners will no longer be relevant.

Regarding the second issue, I think deferring `postPersist` a bit until _all_ entities have been inserted does not violate any promises given, hence is not a BC break. In 2.15, this event was raised after all insertions _for a particular class_ had been processed - so, it was never an "immediate" event for every single entity. #10547 moved the event handling to directly after every single insertion. Now, this PR moves it back a bit to after _all_ insertions.
2023-08-23 07:55:21 +02:00
Grégoire Paris
2c39b3f118 Remove base test case class (#10910)
We are using PHPUnit 10, so none of the polyfills in that class are
needed now.
2023-08-15 15:44:34 +02:00
Grégoire Paris
436f0467ec imerge 'continue-merge-up': manual merge 1-1 2023-08-15 11:42:53 +02:00
David Arenas
5577d51c44 Add back throws annotation to getSingleScalarResult (#10907)
Fix regression introduced in #10870

`$result = $this->execute(null, $hydrationMode);` in `getSingleResult` can still throw NoResultException exception.
2023-08-13 13:01:30 +02:00
Eduardo Rocha
d1922a3065 Fix link on known issues docs (#10904) 2023-08-10 21:41:31 +02:00
Alexander M. Turek
9647d0e2ae Merge release 2.16.1 into 2.17.x (#10896) 2023-08-09 15:17:34 +02:00
Alexander M. Turek
597a63a86c PHPStan 1.10.28, Psalm 5.14.1 (#10895) 2023-08-09 15:05:08 +02:00
Alexander M. Turek
368eb01ac3 Merge 2.16.x into 2.17.x (#10894) 2023-08-09 11:46:12 +02:00
Bei Xiao
6b220e3c90 Fix return type of getSingleScalarResult (#10870) 2023-08-09 11:42:00 +02:00
Matthias Pigulla
6de4b68705 Use a dedicated exception for the check added in #10785 (#10881)
This adds a dedicated exception for the case that objects with colliding identities are to be put into the identity map.

Implements #10872.
2023-08-09 11:38:35 +02:00
Matthias Pigulla
16c0151831 Document more clearly that the insert order is an implementation detail (#10883) 2023-08-09 11:36:05 +02:00
Matthias Pigulla
440b244ebc Fix broken changeset computation for entities loaded through fetch=EAGER + using inheritance (#10884)
#10880 reports a case where the changes from #10785 cause entity updates to be missed.

Upon closer inspection, this change seems to be causing it:

https://github.com/doctrine/orm/pull/10785/files#diff-55a900494fc8033ab498c53929716caf0aa39d6bdd7058e7d256787a24412ee4L2990-L3003

The code was changed to use `registerManaged()` instead, which basically does the same things, but (since #10785) also includes an additional check against duplicate entity instances.

But, one detail slipped through tests and reviews: `registerManaged()` also updates `\Doctrine\ORM\UnitOfWork::$originalEntityData`, which is used to compute entity changesets. An empty array `[]` was passed for $data here.

This will make the changeset computation assume that a partial object was loaded and effectively ignore all field updates here:

a616914887/lib/Doctrine/ORM/UnitOfWork.php (L762-L764)

I think that, effectively, it is sufficient to call `registerManaged()` only in the two cases where a proxy was created.

Calling `registerManaged()` with `[]` as data for a proxy object is consistent with e. g. `\Doctrine\ORM\EntityManager::getReference()`.

In the case that a full entity has to be loaded, we need not call `registerManaged()` at all, since that will already happen inside `EntityManager::find()` (or, more specifically, `UnitOfWork::createEntity()` called inside it).

Note that the test case has to make some provisions so that we actually reach this case:
* Load an entity that uses `fetch="EAGER"` on a to-one association
* That association being against a class that uses inheritance (why's that?)
2023-08-09 11:34:53 +02:00
Alexander M. Turek
394f6fe1b4 Merge pull request #10888 from greg0ire/partial-merge-up
Partial merge up of 2.17.x into 3.0.x
2023-08-08 16:38:30 +02:00
Grégoire Paris
7d9a2c0a71 Merge commit 'e78163981292075c5cc987c1b50ec7a4fad0e20e' into 3.0.x 2023-08-08 14:00:33 +02:00
Nicolas Grekas
47cf50bcd5 Add note about not-enabling lazy-ghosts (#10887) 2023-08-07 15:20:38 +02:00
Alexander M. Turek
58df4078fc Merge branch '2.16.x' into 2.17.x
* 2.16.x:
  Turn identity map collisions from exception to deprecation notice (#10878)
  Add possibility to set reportFieldsWhereDeclared to true in ORMSetup (#10865)
  Fix UnitOfWork->originalEntityData is missing not-modified collections after computeChangeSet  (#9301)
  Add an UPGRADE notice about the potential changes in commit order (#10866)
  Update branch metadata (#10862)
2023-08-07 15:17:36 +02:00
Nicolas Grekas
eda1909c75 Deprecate not-enabling lazy-ghosts and decouple from doctrine/common's proxies (#10837) 2023-08-07 14:43:38 +02:00
Matthias Pigulla
a616914887 Turn identity map collisions from exception to deprecation notice (#10878)
In #10785, a check was added that prevents entity instances from getting into the identity map when another object for the same ID is already being tracked.

This caused regressions for users that work with application-provided IDs and expect this condition to fail with `UniqueConstraintViolationExceptions` when flushing to the database.

Thus, this PR turns the exception into a deprecation notice. Users can opt-in to the new behavior. In 3.0, the exception will be used.

Implements #10871.
2023-08-04 14:06:02 +02:00
Dieter Beck
fd0bdc69b0 Add possibility to set reportFieldsWhereDeclared to true in ORMSetup (#10865)
Otherwise it is impossible to avoid a deprecation warning when using ORMSetup::createAttributeMetadataConfiguration()
2023-08-02 14:34:13 +02:00
Michael Olšavský
f50803ccb9 Fix UnitOfWork->originalEntityData is missing not-modified collections after computeChangeSet (#9301)
* Fix original data incomplete after flush

* Apply suggestions from code review

Co-authored-by: Alexander M. Turek <me@derrabus.de>

---------

Co-authored-by: Alexander M. Turek <me@derrabus.de>
2023-08-02 13:44:15 +02:00
Matthias Pigulla
eeefc6bc0f Add an UPGRADE notice about the potential changes in commit order (#10866) 2023-08-02 13:42:49 +02:00
Grégoire Paris
710dde83aa Update branch metadata (#10862) 2023-08-01 14:56:34 +02:00
Alexander M. Turek
ab542e97df Allow symfony/console 7 (#10724) 2023-08-01 14:25:03 +02:00
Grégoire Paris
495cd06b9a Merge pull request #10727 from derrabus/revert/symfony-7
Revert "Allow symfony/console 7"
2023-08-01 14:07:04 +02:00
Grégoire Paris
fd7a14ad22 Merge pull request #10547 from mpdude/commit-order-entity-level
Compute the commit order (inserts/deletes) on the entity level
2023-08-01 09:21:09 +02:00
Matthias Pigulla
0d3ce5d4f8 Exclude deprecated classes from Psalm checks (until 3.0) 2023-08-01 08:53:56 +02:00
Matthias Pigulla
f01d107edc Fix commit order computation for self-referencing entities with application-provided IDs
This excludes such associations from the commit order computation, since the foreign key constraint will be satisfied when inserting the row.

See https://github.com/doctrine/orm/pull/10735/ for more details about this edge case.
2023-08-01 08:43:16 +02:00
Alexander M. Turek
3cc30c4024 Merge branch '2.15.x' into 2.16.x
* 2.15.x:
  Fix static analysis
  Other solution
  Avoid self deprecation
  fix: use platform options instead of deprecated custom options (#10855)
2023-07-28 16:26:45 +02:00
Alexander M. Turek
d2de4ec03c Revert "Introduce FilterCollection#restore method (#10537)"
This reverts commit 8e20e1598e.
2023-07-28 16:08:17 +02:00
Vincent Langlet
64ee76e94e Introduce FilterCollection#restore method (#10537)
* Introduce FilterCollection#restore method

* Add suspend method instead

* Add more tests
2023-07-28 16:08:06 +02:00
Vincent Langlet
8e20e1598e Introduce FilterCollection#restore method (#10537)
* Introduce FilterCollection#restore method

* Add suspend method instead

* Add more tests
2023-07-28 16:05:51 +02:00
Grégoire Paris
24df74d61d Merge pull request #10856 from VincentLanglet/fixDeprecation
Fix/Self deprecation with getQueryCacheImpl
2023-07-26 23:41:39 +02:00
Vincent Langlet
442f073d25 Fix static analysis 2023-07-26 17:42:20 +02:00
Vincent Langlet
a5161e9485 Other solution 2023-07-26 16:00:37 +02:00
Vincent Langlet
ddc7d953b9 Avoid self deprecation 2023-07-26 12:37:42 +02:00
Kévin Dunglas
db51ed4f4c fix: use platform options instead of deprecated custom options (#10855) 2023-07-25 16:23:46 +02:00
Grégoire Paris
2dc19e6919 Remove outdated comment (#10853)
Since support for persistence 2 has been dropped, this method may no
longer acces an aliased class name.
Besides, providing an FQCN with a leading backslash should work since
removing it is the first thing that happens inside
AbstractClassMetadataFactory::getMetadataFor().
2023-07-25 00:31:57 +02:00
Alexander M. Turek
6d27797b2e Merge release 2.15.4 into 2.16.x (#10850) 2023-07-23 23:49:30 +02:00
Nicolas Grekas
89250b8ca2 Use properties instead of getters to read property/class names via reflection (#10848) 2023-07-20 20:37:52 +02:00
Grégoire Paris
f7e4b61459 Merge pull request #10847 from greg0ire/remove-toc 2023-07-18 09:50:04 +02:00
Grégoire Paris
6b0afdbd58 Avoid triple colons
It confuses the guides, and is ugly.
2023-07-18 08:57:09 +02:00
Grégoire Paris
d3cf17b26d Remove toc
We already have the sidebar for this.
2023-07-18 08:56:24 +02:00
Alexander M. Turek
b68cab1b3d Declare compatibility with DBAL 4 (#10843) 2023-07-17 00:30:09 +02:00
Alexander M. Turek
bc61d7d21e Merge branch '2.15.x' into 2.16.x
* 2.15.x:
  PHPStan 1.10.25, Psalm 5.13.1 (#10842)
2023-07-16 23:40:09 +02:00
Alexander M. Turek
5213228a64 PHPStan 1.10.25, Psalm 5.13.1 (#10842) 2023-07-16 23:38:29 +02:00
Nicolas Grekas
dca7ddf969 Decouple public API from Doctrine\Persistence\Proxy (#10832) 2023-07-15 10:55:35 +02:00
Grégoire Paris
e781639812 Merge pull request #10841 from doctrine/2.15.x 2023-07-12 15:54:17 +02:00
Grégoire Paris
7848417488 Merge pull request #10838 from greg0ire/remove-dummy-title 2023-07-12 11:07:46 +02:00
Grégoire Paris
56e5856ad7 Remove dummy title
This was never meant to be under version control. Did not spot it in the
diff.

Closes #10836
2023-07-12 11:06:06 +02:00
Grégoire Paris
b5987ad29a Merge pull request #10598 from opsway/fix-generated-for-joined-inheritance
Support not Insertable/Updateable columns for entities with `JOINED` inheritance type
2023-07-11 23:48:10 +02:00
Grégoire Paris
385bdd33f1 Merge pull request #10798 from greg0ire/less-partial-load
Resort on Query::HINT_FORCE_PARTIAL_LOAD less
2023-07-11 23:46:17 +02:00
Nicolas Grekas
8c513a6523 Cleanup psalm-type AutogenerateMode (#10833) 2023-07-11 23:01:02 +02:00
Grégoire Paris
1413b496d7 Merge pull request #10824 from greg0ire/fix-build 2023-07-11 12:10:23 +02:00
Alexandr Vronskiy
3b3056f910 mistake on final property 2023-07-11 09:38:34 +03:00
Alexandr Vronskiy
fa5c37e972 Add final to protected
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2023-07-11 09:38:34 +03:00
Yevhen Vilkhovchenko
f3e36debfe Fix persist notInsertable|notUpdatable fields of root entity of joined inheritance type
1. Inherit ClassMetadataInfo::requiresFetchAfterChange flag from root entity when process parent columns mapping (see ClassMetadataInfo::addInheritedFieldMapping(), it uses same condition as ClassMetadataInfo::mapField()) so JoinedSubclassPersister::assignDefaultVersionAndUpsertableValues() to be called in JoinedSubclassPersister::executeInserts().
2. Override JoinedSubclassPersister::fetchVersionAndNotUpsertableValues() to fetch all parent tables (see $this->getJoinSql() call) generated columns. So make protected BasicEntityPersister::identifierFlattener stateless service (use it flattenIdentifier() method) and BasicEntityPersister::extractIdentifierTypes() (to avoid copy-paste).
3. JoinedSubclassPersister::fetchVersionAndNotUpsertableValues() doesnt check empty $columnNames because it would be an error if ClassMetadataInfo::requiresFetchAfterChange is true while no generated columns in inheritance hierarchy.
4. Initialize JoinedInheritanceRoot not-nullable string properties with insertable=false attribute to avoid attempt to insert default null data which cause error:
    PDOException: SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column "rootwritablecontent" of relation "joined_inheritance_root" violates not-null constraint
    DETAIL:  Failing row contains (5, null, dbDefault, dbDefault, , nonUpdatable).
  while $rootTableStmt->executeStatement() because JoinedSubclassPersister::getInsertColumnList() have no $insertData (prepared later) to decide is generated column provided by client code or not (so need to skip column)
2023-07-11 09:38:34 +03:00
Yevhen Vilkhovchenko
ca7abd04a2 Fix persist notInsertable|notUpdatable columns of entity with joined inheritance type
1. Postgres gives error when insert root entity ($rootTableStmt->executeStatement()) in JoinedSubclassPersister::executeInserts():
   PDOException: SQLSTATE[08P01]: <<Unknown error>>: 7 ERROR:  bind message supplies 4 parameters, but prepared statement "" requires 6
  so exclude notInsertable columns from JoinedSubclassPersister::getInsertColumnList() like it done in parent::prepareInsertData() which call BasicEntityPersister::prepareUpdateData(isInsert: true) where we have condition:
    if ($isInsert && isset($fieldMapping['notInsertable']))
2. Try to get generated (notInsertable|notUpdatable) column value on flush() with JoinedSubclassPersister::executeInserts() also fails:
    Unexpected empty result for database query.
  because method it calls $this->assignDefaultVersionAndUpsertableValues() after insert root entity row, while generated columns in child-entity table, so move call just after insert child row
3. Use option['default'] = 'dbDefault' in functional test entities, to emulate generated value on insert, but declare as generated = 'ALWAYS' for tests purpose (correctness of JoinedSubclassPersister::fetchVersionAndNotUpsertableValues() sql-query)
4. Use JoinedInheritanceRoot::rootField to skip JoinedSubclassPersister::update() optimization for empty changeset in updatable:false columns tests
2023-07-11 09:38:34 +03:00
Matthias Pigulla
a555626150 Improve and add test to set to-one and to-many associations with reference objects (#10799) 2023-07-11 00:07:02 +02:00
Grégoire Paris
ec7a8a7a0f Merge pull request #10828 from greg0ire/matching-xml
Match namespace in XML file with namespace in XSD file
2023-07-09 23:02:43 +02:00
Grégoire Paris
e94fa8588d Match namespace in XML file with namespace in XSD file
In 7fa3e6ec7c, a global search and replace
was used for http and https.
This broke the documentation examples in that as soon as you turn on XSD
validation, it will fail because the namespace in the XML file does not
match the ones defined in the XSD file, which do not exhibit the https.

Note that this is not a security concern, because these URIs are
not meant to be actually resolved, but to serve as a unique identifier
for the namespace in which we define our elements.
2023-07-09 21:18:57 +02:00
Matthias Pigulla
f26946b477 Add @deprecated annotations in addition to runtime deprecation notices 2023-07-08 16:22:55 +02:00
Matthias Pigulla
efc83bce8e Make it possible to have non-NULLable self-referencing associations when using application-provided IDs (#10735)
This change improves scheduling of extra updates in the `BasicEntityPersister`.

Extra updates can be avoided when
* the referred-to entity has already been inserted during the current insert batch/transaction
* we have a self-referencing entity with application-provided ID values (the `NONE` generator strategy).

As a corollary, with this change applications that provide their own IDs can define self-referencing associations as not NULLable.

I am considering this a bugfix since the ORM previously executed additional queries that were not strictly necessary, and that required users to work with NULLable columns where conceptually a non-NULLable column would be valid and more expressive.

One caveat, though:

In the absence of entity-level commit ordering (#10547), it is not guaranteed that entities with self-references (at the class level) will be inserted in a suitable order. The order depends on the sequence in which the entities were added with `persist()`.

Fixes #7877, closes #7882.

Co-authored-by: Sylvain Fabre <sylvain.fabre@assoconnect.com>
2023-07-08 15:53:54 +02:00
Grégoire Paris
450cae2caa Add dummy title to the sidebar before checking docs
The way we have our docs, the sidebar is a separate document and as
such, needs a title. Let us prepend a dummy title until the guides-cli
provides a way to ignore that particular error.
2023-07-07 13:59:27 +02:00
Grégoire Paris
81ddeb426c Merge pull request #10823 from nicolas-grekas/mergeup 2023-07-07 13:09:11 +02:00
Nicolas Grekas
42e63bf358 Merge branch 2.15.x into 2.16.x
* 2.15.x: (23 commits)
  Fix cloning entities when using lazy-ghost proxies
  Fixes recomputation of single entity change set when entity contains enum attributes. Due to the fact that originalEntityData contains enum objects and ReflectionEnumProperty::getValue() returns value of enum, comparison of values are always falsy, resulting to update columns value even though it has not changes.
  Fix code style issues
  Use absolute references
  Avoid colon followed by double colon
  Use correct syntax for references
  Fix invalid reference syntax
  Use rst syntax
  Use internal link
  Escape pipes
  Introduce new workflow to test docs
  Remove lone dash (#10812)
  Treat id field proprites same as regular field
  Move three "Ticket/"-style tests to the right namespace
  Follow recommendation about multiline type
  Fix unserialize() errors when running tests on PHP 8.3 (#10803)
  Explain `EntityManager::getReference()` peculiarities (#10800)
  Upgrade to Psalm 5.13
  test: assert `postLoad` has data first
  distinct() updates QueryBuilder state correctly
  ...
2023-07-07 12:55:31 +02:00
Grégoire Paris
4978e0e336 Merge pull request #10819 from nicolas-grekas/fix-proxy-clone 2023-07-06 16:23:53 +02:00
Nicolas Grekas
eee87c376d Fix cloning entities when using lazy-ghost proxies 2023-07-06 15:08:59 +02:00
Grégoire Paris
0b9060c728 Merge pull request #10806 from rmikalkenas/fix-enum-recomputation 2023-07-06 10:23:59 +02:00
Grégoire Paris
514f6b8c28 Merge pull request #10813 from Greg0/fix-primary-id-mapping-xml-driver 2023-07-06 09:12:53 +02:00
Rokas Mikalkėnas
c1018fe299 Fixes recomputation of single entity change set when entity contains enum attributes.
Due to the fact that originalEntityData contains enum objects and
ReflectionEnumProperty::getValue() returns value of enum,
comparison of values are always falsy, resulting to update
columns value even though it has not changes.
2023-07-05 23:57:34 +03:00
Grzegorz Kuźnik
075824f5b5 Fix code style issues 2023-07-05 21:10:48 +02:00
Grégoire Paris
d6f4834476 Merge pull request #10815 from greg0ire/test-docs 2023-07-05 10:01:37 +02:00
Grégoire Paris
9dadffe270 Use absolute references
According to the Sphinx docs, when in reference/architecture.rst, a
reference to reference/inheritance-mapping would resolve to
reference/reference/inheritance-mapping.rst, because it is relative to
the current document
2023-07-04 17:44:44 +02:00
Grégoire Paris
b6e7e6d723 Avoid colon followed by double colon
It seems to confuse the guides-cli, if it is even valid.
2023-07-04 17:31:05 +02:00
Grégoire Paris
710937d6f8 Use correct syntax for references
doc was used when it is clearly a ref, plus there was a leading
underscore preventing the resolution.
2023-07-04 17:26:04 +02:00
Grégoire Paris
5d2d6642c8 Fix invalid reference syntax
Without this change, a hash is displayed for some reason.
2023-07-04 17:14:03 +02:00
Grégoire Paris
4d56711d8c Use rst syntax
Using underscore for emphasis is not an RST thing, in rst the difference
between emphasis and strong emphasis is in the number of asterisks.

Right now these underscores are just ignored and displayed on the
website.

See https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#emphasis
2023-07-04 17:11:46 +02:00
Grégoire Paris
a157bc3fb3 Use internal link 2023-07-04 17:05:47 +02:00
Grégoire Paris
1aeab391c7 Escape pipes
Pipes can be used to define substitutions, it is part of the rst
standard. This explains why some of the links in this document are not
displayed on the website.

See https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#substitution-definitions
2023-07-04 16:48:14 +02:00
Grégoire Paris
a4ecd02349 Introduce new workflow to test docs
This allows to check compatibility with phpDocumentor/guides, but also
should allow to spot embarassing mistakes in our existing docs.
2023-07-04 16:45:18 +02:00
Matthias Pigulla
bb21865cba Deprecate classes related to old commit order computation 2023-07-04 14:30:29 +02:00
Matthias Pigulla
606da9280d Un-prefix simple generics like list<> and array<>
... as suggested in GH review.
2023-07-04 14:17:14 +02:00
Grégoire Paris
21708e43c4 Merge pull request #10785 from mpdude/guard-duplicate-identity-map-entries 2023-07-04 10:03:04 +02:00
Grégoire Paris
8c59828f6c Remove lone dash (#10812) 2023-07-03 21:46:12 +02:00
Grzegorz K
0877ecbe56 Treat id field proprites same as regular field 2023-07-03 15:15:08 +02:00
Grégoire Paris
8eb69922e6 Merge pull request #10809 from mpdude/show-trouble-delete-before-insert
Add test to show why delete-before-insert may be challenging
2023-06-30 08:08:57 +02:00
Matthias Pigulla
e9b6fd89a4 Add test to show why delete-before-insert may be challenging
There are a few requests (#5742, #5368, #5109, #6776) that ask to change the order of operations in the UnitOfWork to perform "deletes before inserts", or where such a switch appears to solve a reported problem.

I don't want to say that this is not doable. But this PR at least adds two tricky examples where INSERTs need to be done before an UPDATE can refer to new database rows; and where the UPDATE needs to happen to release foreign key references to other entities before those can be DELETEd.

So, at least as long as all operations of a certain type are to be executed in blocks, this example allows no other order of operations than the current one.
2023-06-29 14:32:08 +02:00
Matthias Pigulla
01a14327d2 Add a safeguard against multiple objects competing for the same identity map entry
While trying to understand #3037, I found that it may happen that we have more entries in `\Doctrine\ORM\UnitOfWork::$entityIdentifiers` than in `\Doctrine\ORM\UnitOfWork::$identityMap`.

The former is a mapping from `spl_object_id` values to ID hashes, the latter an array first of entity class names and then from ID hash to entity object instances.

(Basically, "ID hash" is a concatenation of all field values making up the `@Id` for a given entity.)

This means that at some point, we must have _different_ objects representing the same entity, or at least over time different objects are used for the same entity without the UoW properly updating its `::$entityIdentifiers` structure.

I don't think it makes sense to overwrite an entity in the identity map, since that means a currently `MANAGED` entity is replaced with something else.

If it makes sense at all to _replace_ an entity, that should happen through dedicated management methods to first detach the old entity before persisting, merging or otherwise adding the new one. This way we could make sure the internal structures remain consistent.
2023-06-28 22:50:17 +02:00
Grégoire Paris
4887359827 Merge pull request #10807 from mpdude/move-tests
Move three "Ticket/"-style tests to the right namespace
2023-06-28 20:54:43 +02:00
Matthias Pigulla
2df1071e7a Remove references to the temporary branch in workflow definitions 2023-06-28 17:10:20 +02:00
Matthias Pigulla
5afe9b80a8 Move three "Ticket/"-style tests to the right namespace 2023-06-28 16:39:47 +02:00
Matthias Pigulla
7fc359c2bb Avoid unnecessarily passing entity lists into executeDeletions/executeInserts 2023-06-28 14:46:22 +02:00
Matthias Pigulla
853b9f75ae Merge remote-tracking branch 'origin/2.16.x' into commit-order-entity-level 2023-06-28 14:43:54 +02:00
Grégoire Paris
584c4aeed1 Merge pull request #10804 from greg0ire/parenthesized 2023-06-28 14:11:41 +02:00
Grégoire Paris
44d2a83e09 Merge pull request #10532 from mpdude/entity-persister-must-not-batch 2023-06-28 11:45:39 +02:00
Grégoire Paris
c9c5157fda Follow recommendation about multiline type
Apparently, there is consensus about multiline types between:

- PHPStan
- Psalm
- Slevomat Coding Standard

See https://github.com/slevomat/coding-standard/issues/1586#issuecomment-1610195706

Using parenthesis is less ambiguous, it makes it clear to the parser
where the type begins and where it ends.

The change has a positive impact on the Psalm baseline, showing
that psalm-return annotation was not really understood previously.
2023-06-28 07:46:35 +02:00
Grégoire Paris
dba90c1a91 Merge pull request #10786 from vuongxuongminh/fix-attach-entity-listener-when-reset-class-metadata-factory
Fix attach entity listener when reset class metadata factory
2023-06-27 23:53:01 +02:00
Grégoire Paris
5f079c2061 Merge pull request #10531 from mpdude/commit-order-must-be-entity-level
Add test: Commit order calculation must happen on the entity level
2023-06-27 23:52:33 +02:00
Grégoire Paris
476b68cd1f Merge pull request #10805 from greg0ire/valid-phpunit-xml
Validate phpunit.xml against PHPUnit 10 schema
2023-06-27 23:52:14 +02:00
Grégoire Paris
3ffd3f6509 Validate phpunit.xml against PHPUnit 10 schema
The previous syntax was a PHPUnit 9 syntax.
2023-06-27 23:13:06 +02:00
Nicolas Grekas
55d477dc50 Fix unserialize() errors when running tests on PHP 8.3 (#10803) 2023-06-27 17:47:09 +02:00
Matthias Pigulla
1733bf8678 Remove remaining references to the merge() operation (#10793)
`EntityManager::merge()` has been deprecated in #8461 and removed in #9488.

This PR removes a few remaining references and artefacts that - to my understanding - refer to it.
2023-06-27 10:27:39 +02:00
Grégoire Paris
4da8d3be96 Resort on Query::HINT_FORCE_PARTIAL_LOAD less
A lot of our tests mention it, but I do not think it is important to the
test. Maybe it was a way to have more efficient tests? Most times,
removing the hint does not affect the test outcome.
2023-06-27 08:37:05 +02:00
Matthias Pigulla
4aadba65ce Explain EntityManager::getReference() peculiarities (#10800)
* Explain `EntityManager::getReference()` peculiarities

As one takeaway from https://github.com/doctrine/orm/issues/3037#issuecomment-1605657003 and #843, we should look into better explaining the `EntityManager::getReference()` method, it’s semantics, caveats and potential responsibilities placed on the user.

This PR tries to do that, so it fixes #10797.

* Update docs/en/reference/advanced-configuration.rst

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>

---------

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2023-06-27 00:16:55 +02:00
Grégoire Paris
814d8d4d39 Merge pull request #10802 from greg0ire/psalm-5-13
Upgrade to Psalm 5.13
2023-06-27 00:05:00 +02:00
Grégoire Paris
dc411954ad Upgrade to Psalm 5.13
This is a nice release as far as the ORM is concerned:
- a small baseline reduction;
- lots of useless calls to sprintf spotted.
2023-06-26 19:12:02 +02:00
Minh Vuong
da29eb675c test: assert postLoad has data first 2023-06-26 09:29:00 +07:00
Grégoire Paris
b17e52ba6b Merge pull request #10791 from mpdude/understand-3037
Avoid creating unmanaged proxy instances for referred-to entities during `merge()`
2023-06-25 23:52:53 +02:00
Grégoire Paris
7ef4afc688 Merge pull request #10743 from mpdude/post-insert-id-early
Make EntityPersisters tell the UoW about post insert IDs early
2023-06-25 23:51:15 +02:00
Grégoire Paris
4e138903d0 Merge pull request #10789 from macroparts/distinct-updates-state-correctly
distinct() updates QueryBuilder state correctly
2023-06-25 18:11:37 +02:00
Daniel Jurkovic
efb50b9bdd distinct() updates QueryBuilder state correctly
Previously calling distinct() when the QueryBuilder was in clean state would cause subsequent getDQL() calls to ignore the distinct queryPart

Fixes #10784
2023-06-25 17:53:24 +02:00
Grégoire Paris
84a87a6ac8 Merge remote-tracking branch 'origin/2.16.x' into 3.0.x 2023-06-24 11:15:42 +02:00
Grégoire Paris
70bcff7410 Merge pull request #10794 from doctrine/2.15.x
Merge 2.15.x up into 2.16.x
2023-06-23 23:22:31 +02:00
Matthias Pigulla
1989531d4f Update tests/Doctrine/Tests/ORM/Functional/Ticket/GH7407Test.php
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2023-06-23 22:47:34 +02:00
Grégoire Paris
f778d8cf98 Merge pull request #10792 from greg0ire/entity-level-commit-order
Entity level commit order
2023-06-23 22:37:10 +02:00
Grégoire Paris
18b32ab9db Merge remote-tracking branch 'origin/2.15.x' into entity-level-commit-order 2023-06-23 22:21:53 +02:00
Matthias Pigulla
d738ecfcfe Avoid creating unmanaged proxy instances for referred-to entities during merge()
This PR tries to improve the situation/problem explained in #3037:

Under certain conditions – there may be multiple and not all are known/well-understood – we may get inconsistencies between the `\Doctrine\ORM\UnitOfWork::$entityIdentifiers` and `\Doctrine\ORM\UnitOfWork::$identityMap` arrays.

Since the `::$identityMap` is a plain array holding object references, objects contained in it cannot be garbage-collected.
`::$entityIdentifiers`, however, is indexed by `spl_object_id` values. When those objects are destructed and/or garbage-collected, the OID may be reused and reassigned to other objects later on.

When the OID re-assignment happens to be for another entity, the UoW may assume incorrect entity states and, for example, miss INSERT or UPDATE operations.

One cause for such inconsistencies is _replacing_ identity map entries with other object instances: This makes it possible that the old object becomes GC'd, while its OID is not cleaned up. Since that is not a use case we need to support (IMHO), #10785 is about adding a safeguard against it.

In this test shown here, the `merge()` operation is currently too eager in creating a proxy object for another referred-to entity. This proxy represents an entity already present in the identity map at that time, potentially leading to this problem later on.
2023-06-23 22:19:06 +02:00
Matthias Pigulla
aa3ff458c7 Add test: Commit order calculation must happen on the entity level
Add tests for entity insertion and deletion that require the commit order calculation to happen on the entity level. This demonstrates the necessity for the changes in #10547.

This PR contains two tests with carefully constructed entity relationships, where we have a non-nullable `parent` foreign key relationships between entities stored in the same table.

Class diagram:

```mermaid
classDiagram
    direction LR
    class A
    class B
    A --> B : parent
    B --|> A
```

Object graph:

```mermaid
graph LR;
    b1 --> b2;
    b2 --> a;
    b3 --> b2;
```

 #### Situation before #10547

The commit order is computed by looking at the associations at the _table_ (= _class_) level. Once the ordering of _tables_ has been found, entities being mapped to the same table will be processed in the order they were given to `persist()` or `remove()`.

That means only a particular ordering of `persist()` or `remove()` calls (see comment in the test) works:

For inserts, the order must be `$a, $b2, $b1, $b3` (or `... $b3, $b1`), for deletions `$b1, $b3, $b2, $a`.

 #### Situation with entity-level commit order computation (as in #10547)

The ORM computes the commit order by considering associations at the _entity_ level. It will be able to find a working order by itself.
2023-06-23 22:14:04 +02:00
Grégoire Paris
f76bab2b73 Merge pull request #10790 from greg0ire/slevomat-cs-upgrade
Work around slevomat/coding-standard issues
2023-06-23 22:13:30 +02:00
Grégoire Paris
0e06d6b67d Apply latest coding standard rules 2023-06-23 18:11:22 +02:00
Grégoire Paris
5114dcee0b Work around slevomat/coding-standard issues
I tweaked the code so that it would not fall victim to
https://github.com/slevomat/coding-standard/issues/1585 or
https://github.com/slevomat/coding-standard/issues/1586, thus fixing the
phpcs job without losing information or breaking other jobs.
2023-06-23 18:11:07 +02:00
Matthias Pigulla
8bc74c624a Make EntityPersisters tell the UoW about post insert IDs early
This refactoring does two things:

* We can avoid collecting the post insert IDs in a cumbersome array structure that will be returned by the EntityPersisters and processed by the UoW right after. Instead, use a more expressive API: Make the EntityPersisters tell the UoW about the IDs immediately.
* IDs will be available in inserted entities a tad sooner. That may help to resolve #10735, where we can use the IDs to skip extra updates.
2023-06-23 09:08:07 +02:00
Grégoire Paris
6c0a5ecbf9 Merge pull request #10787 from doctrine/2.15.x-merge-up-into-2.16.x_XV3tWpNu 2023-06-22 16:01:49 +02:00
Grégoire Paris
5f6501f842 Merge remote-tracking branch 'origin/2.15.x' into 2.15.x-merge-up-into-2.16.x_XV3tWpNu 2023-06-22 14:44:27 +02:00
Alexander Dmitryuk
4c3bd20801 Fix missing setFilterSchemaAssetsExpression in phpdoc (#10776) 2023-06-22 14:36:06 +02:00
Grégoire Paris
f2abf6143b Merge pull request #10763 from mpdude/defer-collection-entity-removals-to-post-commit 2023-06-22 14:35:20 +02:00
Minh Vuong
338deacb58 fix: attach entity listener when reset metadata factory 2023-06-22 17:02:24 +07:00
Grégoire Paris
6fa95b93df Merge pull request #10778 from greg0ire/lifecycle-embedded-class 2023-06-22 10:04:53 +02:00
Grégoire Paris
829d5fbb9f Merge pull request #10780 from greg0ire/avoid-partial 2023-06-22 10:04:27 +02:00
Matthias Pigulla
d220494edc Improve documentation on exact behaviour of many-to-many deletion operations 2023-06-21 19:14:55 +02:00
Matthias Pigulla
c235901544 Move a check up (continue early) 2023-06-21 19:14:55 +02:00
Matthias Pigulla
ba089e551a Avoid unnecessary changes 2023-06-21 19:14:55 +02:00
Matthias Pigulla
ee0b3f214d Write tests more concisely 2023-06-21 19:14:55 +02:00
Matthias Pigulla
930fa831b2 Test expected query counts in ManyToManyBasicAssociationTest
When collection updates/join table cleanups do not happen through specialized Entity-/CollectionPersister methods but instead as "plain" updates, we may issue a lot more queries than expected.
2023-06-21 19:14:55 +02:00
Matthias Pigulla
98b404875f Defer removing removed entities from to-many collections until after transaction commit 2023-06-21 19:14:55 +02:00
Grégoire Paris
2004761475 Merge pull request #10777 from greg0ire/cleanup-bc-layers
Turn deprecation into an exception
2023-06-21 16:23:06 +02:00
Grégoire Paris
3ad9c43a96 Merge pull request #10782 from andersonamuller/patch-2 2023-06-19 13:25:19 +02:00
Anderson Müller
1bd3066b9f Remove missed note about deprecated drivers 2023-06-19 11:21:17 +02:00
Grégoire Paris
fcc5c106b4 Rely on partial objects less when in tests
Partial objects are deprecated. They were handy to make the generated
SQL more legible, but we should refrain from relying on them.
2023-06-18 18:20:29 +02:00
Grégoire Paris
5132f0deb0 Stop using $message argument
It brings nothing over what PHPUnit now natively does.
2023-06-18 18:16:29 +02:00
Grégoire Paris
663763ab1a Disallow lifecycle callbacks on embedded classes 2023-06-17 16:18:57 +02:00
Grégoire Paris
2a8f22c521 Turn deprecation into an exception 2023-06-17 15:43:12 +02:00
Grégoire Paris
fe8e313731 Merge pull request #10747 from wtfzdotnet/feature/fix-one-to-many-custom-id-orphan-removal 2023-06-16 10:07:29 +02:00
Grégoire Paris
41f704cd96 Merge pull request #10775 from doctrine/2.15.x
Merge 2.15.x up into 2.16.x
2023-06-13 20:10:31 +02:00
Grégoire Paris
1adb5c0c70 Merge pull request #10774 from greg0ire/document-dto-in-rsm 2023-06-12 13:52:10 +02:00
Grégoire Paris
e5174af669 Document how to produce DTOs with a result set mapping 2023-06-11 18:02:18 +02:00
Grégoire Paris
efd429dd24 Merge pull request #10769 from greg0ire/cleanup-bc-layers
Remove Notify change tracking policy
2023-06-10 22:59:33 +02:00
Vaidas
c3106f9fe7 Restore document proxy state to uninitialized on load exception (#10645) 2023-06-09 08:54:22 +02:00
Alexander M. Turek
cbf45dd97e PHPStan 1.10.18, Psalm 5.12.0 (#10771) 2023-06-08 16:57:07 +02:00
Grégoire Paris
716139c168 Remove Notify change tracking policy 2023-06-07 21:16:17 +02:00
Grégoire Paris
492635a8e8 Merge pull request #10768 from greg0ire/cleanup-bc-layers
Enable XML validation unconditionally
2023-06-07 08:19:49 +02:00
Grégoire Paris
0dad2daf2c Enable XML validation unconditionally
Note that this makes ext-dom a hard requirement when using the XML
driver.
2023-06-06 23:29:56 +02:00
Michael Roterman
3c0d140e52 OneToManyPersister does not take custom identifier types into account for orphan removal.
In my case a custom doctrine type of Uuid object is converted to string by simply casting it, resulting in a hex DELETE FROM x WHERE id = ? query,
whilst it should've been converted along the way to it's binary representation. This leads to no deletions being made at all as you would expect making use of doctrine custom type's as an identifier.

This commit fixes usage of ramsey/uuid or symfony/uid as custom id types when making use of orphan removal.
2023-06-06 19:51:41 +02:00
Michael Roterman
33675ff4a9 fix: Update baseline and assertions for OneToManyPersister 2023-06-06 18:18:26 +02:00
Grégoire Paris
e0b72408a1 Merge pull request #10764 from greg0ire/cleanup-bc-layers 2023-06-06 11:42:14 +02:00
Alexander M. Turek
5c74795893 Merge 2.15.x into 2.16.x (#10765) 2023-06-06 11:30:27 +02:00
Nicolas Grekas
3827dd769e Don't call deprecated getSQLResultCasing and usesSequenceEmulatedIdentityColumns when we know the platform (#10759) 2023-06-06 11:27:31 +02:00
Grégoire Paris
575d0c03ee Reject non instances of ORM\ClassMetadata 2023-06-06 08:49:30 +02:00
Grégoire Paris
a2a4f73b30 Enforce reporting fields where declared 2023-06-06 08:49:30 +02:00
Grégoire Paris
f1d6ba8919 Narrow types 2023-06-06 00:05:05 +02:00
Grégoire Paris
0872d1429d Add missing upgrade notes 2023-06-05 23:43:25 +02:00
Grégoire Paris
96f5f84e8b Merge pull request #10741 from greg0ire/cleanup-bc-layers
Cleanup bc layers
2023-06-05 23:26:28 +02:00
Grégoire Paris
0945f60484 Remove backward-compatibility layer
Note that we also remove UpdateCommandTest::testItPrintsTheSql() because
it relied on not passing --complete to work.
2023-06-05 23:08:31 +02:00
Grégoire Paris
f38922944e Remove unneeded DeprecatedProperty rule
That property has been removed from 3.0.x
2023-06-05 23:08:31 +02:00
Grégoire Paris
63e9ad9e9a Remove unneeded ignore rule
The linked issue has been addressed, this rules should have been removed
during a merge up, as it is no longer present on 2.x
2023-06-05 23:08:31 +02:00
Nicolas Grekas
6c9b29f237 Don't call canEmulateSchemas in SchemaTool when possible (#10762) 2023-06-05 21:42:13 +02:00
Grégoire Paris
2afe2dc8af Merge pull request #10758 from Gwemox/partial-revert-enum-id-hash 2023-06-05 11:41:32 +02:00
Thibault Buathier
cc3d872b95 revert: transform backed enum to value 2023-06-05 10:58:32 +02:00
Grégoire Paris
46ff264502 Merge remote-tracking branch 'origin/2.16.x' into 3.0.x 2023-06-05 09:36:36 +02:00
Grégoire Paris
8961bfe90c Merge pull request #10756 from doctrine/2.15.x
Merge 2.15.x up into 2.16.x
2023-06-05 09:11:52 +02:00
Grégoire Paris
15e3a7e861 Merge pull request #10751 from mpdude/7180-fixed
Add test to show #7180 has been fixed
2023-06-05 08:35:40 +02:00
Grégoire Paris
65dc154ce5 Merge pull request #10754 from greg0ire/fix-build
Fix build
2023-06-05 08:35:26 +02:00
Grégoire Paris
1280e005b6 Merge pull request #10755 from mpdude/9192-fixed
Add test to show #9192 has been fixed
2023-06-04 22:08:17 +02:00
Matthias Pigulla
79f53d5dae Add test to show #9192 has been fixed
This test implements the situation described in #9192. The commit order computation will be fixed by #10547.
2023-06-04 19:46:16 +00:00
Grégoire Paris
caaa0d6192 Ignore error about get_class($metadata)
This is the result of the contradiction between the phpdoc
(ClassMetadata), and the condition, which guarantees $metadata is not a
ClassMetadata. Relaxing the phpdoc leads to other phpstan issues, about
properties that exist in ClassMetadata but not in
PersistentClassMetadata. The right way to fix this would be to switch
from a deprecation to an exception, but that is not the path we have
taken, and all this will disappear in 3.0.x anyway, so let's not bother.
2023-06-03 20:59:29 +02:00
Grégoire Paris
68d3a63957 Use class name directly
Static analysis points out $this->getName() may return null. But there
is worse: the message mentions a "command class", and getName() is not a
class.
2023-06-03 20:59:29 +02:00
Matthias Pigulla
bf2937e63a Add test: Entity insertions must not happen table-wise
Add tests for entity insertion and deletion that require writes to different tables in an interleaved fashion, and that have to re-visit a particular table.

 #### Background

In #10531, I've given an example where it is necessary to compute the commit order on the entity (instead of table) level.

Taking a closer look at the UoW to see how this could be achieved, I noticed that the current, table-level commit order manifests itself also in the API between the UoW and `EntityPersister`s.

 #### Current situation

The UoW computes the commit order on the table level. All entity insertions for a particular table are passed through `EntityPersister::addInsert()` and finally written through `EntityPersister::executeInserts()`.

 #### Suggested change

The test in this PR contains a carefully constructed set of four entities. Two of them are of the same class (are written to the same table), but require other entities to be processed first.

In order to be able to insert this set of entities, the ORM must be able to perform inserts for a given table repeatedly, interleaved with writing other entities to their respective tables.
2023-06-03 13:07:41 +00:00
Matthias Pigulla
76b8a215c2 Update docs that name in @Index/@UniqueConstraint is optional (#10748)
Fixes #4283.
2023-06-03 00:14:43 +02:00
Matthias Pigulla
b163cea61c Update the FAQ entry on setting MySQL charset and collation for columns (#10746)
Fixes #2986.
2023-06-03 00:13:07 +02:00
Grégoire Paris
ed212ab924 Merge pull request #10749 from mpdude/6499-fixed
Add tests to show #6499 has been fixed
2023-06-02 23:36:44 +02:00
Matthias Pigulla
dd0e02e912 Add test to show #7180 has been fixed
Tests suggested in https://github.com/doctrine/orm/pull/7180#issuecomment-380841413 and https://github.com/doctrine/orm/pull/7180#issuecomment-381067448 by @arnaud-lb.

Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
2023-06-02 21:28:11 +00:00
Matthias Pigulla
aad875eea1 Add tests to show #6499 has been fixed
@frikkle was the first to propose these tests in #6533.
@rvanlaak followed up in #8703, making some adjustments.

Co-authored-by: Gabe van der Weijde <gabe.vanderweijde@triasinformatica.nl>
Co-authored-by: Richard van Laak <rvanlaak@gmail.com>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2023-06-02 21:14:17 +00:00
Grégoire Paris
84ab535e56 Merge pull request #10750 from mpdude/7006-fixed
Add test to show #7006 has been fixed
2023-06-02 22:07:47 +02:00
Matthias Pigulla
a72a0c3597 Update tests/Doctrine/Tests/ORM/Functional/Ticket/GH7006Test.php
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2023-06-02 22:00:20 +02:00
Matthias Pigulla
6217285544 Add test to show #7006 has been fixed 2023-06-02 17:52:51 +00:00
Grégoire Paris
330c0bc67e Merge pull request #10689 from mpdude/insert-entity-level-topo-sort 2023-06-02 15:21:08 +02:00
Grégoire Paris
b5595ca041 Merge pull request #10732 from mpdude/10348-fixed
Add a test case to show #10348 has been fixed
2023-06-02 07:50:03 +02:00
Grégoire Paris
4dfbe13897 Merge pull request #10740 from greg0ire/remove-ignore-rule
Remove useless ignore rule
2023-06-02 00:14:27 +02:00
Grégoire Paris
b64e1c9b1f Remove useless ignore rule
This is useless since 152f91fa3
2023-06-01 21:03:58 +02:00
Grégoire Paris
b779b112f3 Merge pull request #10738 from doctrine/2.15.x-merge-up-into-2.16.x_PvK1bbO1 2023-06-01 11:45:08 +02:00
Grégoire Paris
bf449bef7d Merge pull request #10737 from nicolas-grekas/lexer-deprec 2023-06-01 11:35:50 +02:00
Nicolas Grekas
152f91fa33 Fix deprecations from doctrine/lexer 2023-06-01 11:22:36 +02:00
Grégoire Paris
14d1eb5340 Document pdo_sqlite requirement for tests (#10734) 2023-06-01 08:57:07 +02:00
Matthias Pigulla
04e08640fb Add a test case to show #10348 has been fixed by #10566
This is part of the series of issues fixed by #10547. In particular, the changes from #10566 were relevant.

See #10348 for the bug description.

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2023-05-31 21:38:42 +00:00
Matthias Pigulla
aa27b3a35f Remove the now unused UnitOfWork::getCommitOrder() method 2023-05-31 07:31:56 +00:00
Matthias Pigulla
d76fc4ebf6 Compute entity-level commit order for entity insertions
This is the third step to break https://github.com/doctrine/orm/pull/10547 into smaller PRs suitable for reviewing. It uses the new topological sort implementation from #10592 and the refactoring from #10651 to compute the UoW's commit order for entity insertions not on the entity class level, but for single entities and their actual dependencies instead.

 #### Current situation

`UnitOfWork::getCommitOrder()` would compute the entity sequence on the class level with the following code:

70477d81e9/lib/Doctrine/ORM/UnitOfWork.php (L1310-L1325)

 #### Suggested change

* Instead of considering the classes of all entities that need to be inserted, updated or deleted, consider the new (inserted) entities only. We only need to find a sequence in situations where there are foreign key relationships between two _new_ entities.
* In the dependency graph, add edges for all to-one association target entities.
* Make edges "optional" when the association is nullable.

 #### Test changes

I have not tried to fully understand the few changes necessary to fix the tests. My guess is that those are edge cases where the insert order changed and we need to consider this during clean-up.

Keep in mind that many of the functional tests we have assume that entities have IDs assigned in the order that they were added to the EntityManager. That does not change – so the order of entities is generally stable, equal to the previous implementation.
2023-05-31 07:16:16 +00:00
Grégoire Paris
8b1ce48e79 Merge pull request #10730 from greg0ire/join-column-mapping
Migrate to the object API of Join{Column,Table}Mapping
2023-05-31 00:28:12 +02:00
Grégoire Paris
da0998c401 Add missing underscore to RST links (#10731) 2023-05-30 23:00:28 +02:00
Matthias Pigulla
ae60cf005f Commit order for removals has to consider SET NULL, not nullable (#10566)
When computing the commit order for entity removals, we have to look out for `@ORM\JoinColumn(onDelete="SET NULL")` to find places where cyclic associations can be broken.

 #### Background

The UoW computes a "commit order" to find the sequence in which tables shall be processed when inserting entities into the database or performing delete operations.

For the insert case, the ORM is able to schedule _extra updates_ that will be performed after all entities have been inserted. Associations which are configured as `@ORM\JoinColumn(nullable=true, ...)` can be left as `NULL` in the database when performing the initial `INSERT` statements, and will be updated once all new entities have been written to the database. This can be used to break cyclic associations between entity instances.

For removals, the ORM does not currently implement up-front `UPDATE` statements to `NULL` out associations before `DELETE` statements are executed. That means when associations form a cycle, users have to configure `@ORM\JoinColumn(onDelete="SET NULL", ...)` on one of the associations involved. This transfers responsibility to the DBMS to break the cycle at that place.

_But_, we still have to perform the delete statements in an order that makes this happen early enough. This may be a _different_ order than the one required for the insert case. We can find it _only_ by looking at the `onDelete` behaviour. We must ignore the `nullable` property, which is irrelevant, since we do not even try to `NULL` anything.

 #### Example

Assume three entity classes `A`, `B`, `C`. There are unidirectional one-to-one associations `A -> B`, `B -> C`, `C -> A`. All those associations are `nullable= true`.

Three entities `$a`, `$b`, `$c` are created from these respective classes and associations are set up.

All operations `cascade` at the ORM level. So we can test what happens when we start the operations at the three individual entities, but in the end, they will always involve all three of them.

_Any_ insert order will work, so the improvements necessary to solve #10531 or #10532 are not needed here. Since all associations are between different tables, the current table-level computation is good enough.

For the removal case, only the `A -> B` association has `onDelete="SET NULL"`. So, the only possible execution order is `$b`, `$c`, `$a`. We have to find that regardless of where we start the cascade operation.

The DBMS will set the `A -> B` association on `$a` to `NULL` when we remove `$b`. We can then remove `$c` since it is no longer being referred to, then `$a`.

 #### Related cases

These cases ask for the ORM to perform the extra update before the delete by itself, without DBMS-level support:
* #5665
* #10548
2023-05-30 22:58:36 +02:00
Grégoire Paris
07674b1887 Migrate to the object API of Join{Column,Table}Mapping 2023-05-30 08:52:02 +02:00
Grégoire Paris
ec43884612 Merge pull request #10729 from greg0ire/mandatory-table-name
Make the join table name and join column name mandatory
2023-05-30 08:43:21 +02:00
Grégoire Paris
ee62934911 Make the join column name mandatory 2023-05-28 23:28:15 +02:00
Grégoire Paris
8a6dbb4ae2 Make the join table name mandatory
It does not seem to ever be empty
2023-05-26 18:17:25 +02:00
Grégoire Paris
2a8a886bbe Merge pull request #10728 from greg0ire/declare-options
Declare options property
2023-05-25 23:55:06 +02:00
Grégoire Paris
2b03858717 Declare options property
This must have been lost when merging up d7d6b9d2c7
2023-05-25 17:27:17 +02:00
Grégoire Paris
497faffe0b Merge pull request #10723 from greg0ire/association-mapping-object-api 2023-05-25 10:30:19 +02:00
Alexander M. Turek
ddd3066bc4 Revert "Allow symfony/console 7 (#10724)"
This reverts commit 6662195936.
2023-05-25 08:48:53 +02:00
Alexander M. Turek
6662195936 Allow symfony/console 7 (#10724) 2023-05-25 08:47:35 +02:00
Grégoire Paris
cc011d8215 Merge pull request #10725 from doctrine/2.14.x
Merge 2.14.x up into 2.15.x
2023-05-24 14:08:21 +02:00
Grégoire Paris
d831c126c9 Merge pull request #10643 from htto/bugfix/sti-with-abstract-intermediate
Fix single table inheritance with intermediate abstract class(es)
2023-05-24 11:58:11 +02:00
Grégoire Paris
10eae1a7ff Merge pull request #10722 from phansys/query_single_result_exception
Fix and improve functional test cases expecting `NonUniqueResultException` from `AbstractQuery::getSingleScalarResult()`
2023-05-23 22:46:18 +02:00
Grégoire Paris
8a762f04f1 Manually fix remaining issues 2023-05-23 13:34:39 +02:00
Grégoire Paris
bbc56aaec6 Ignore issue about collections 2023-05-23 13:34:39 +02:00
Grégoire Paris
647712649b Add assertions 2023-05-23 13:34:39 +02:00
Grégoire Paris
61f2c4d53b Allow ClassMetadata::FETCH_EXTRA_LAZY as a value for
ClassMetadata->$fetch
2023-05-23 13:34:39 +02:00
Grégoire Paris
ca8ee91467 Leverage ClassMetadataFactory::getOwningSide() 2023-05-23 13:34:38 +02:00
Grégoire Paris
2987e9956f Add assertion 2023-05-23 13:34:38 +02:00
Grégoire Paris
917e0cff39 Move assertion 2023-05-23 13:34:38 +02:00
Grégoire Paris
6ce0cf4a3d Add assertions based on joinColumns access 2023-05-23 13:34:37 +02:00
Grégoire Paris
d4915a8b3d Ignore unfixable error 2023-05-23 13:34:37 +02:00
Grégoire Paris
749947efe7 Clarify things for SA 2023-05-23 13:34:37 +02:00
Grégoire Paris
535d869835 Ignore issue due to Psalm bug 2023-05-23 13:34:37 +02:00
Grégoire Paris
ea23628010 Rectorify 2023-05-23 13:34:37 +02:00
Grégoire Paris
d951aa05b9 Merge pull request #10721 from phansys/query_single_result 2023-05-23 11:33:49 +02:00
Javier Spagnoletti
be297b9fd3 Narrow return types for AbstractQuery::getSingleScalarResult() 2023-05-23 05:47:39 -03:00
Javier Spagnoletti
125e18cf24 Fix and improve functional test cases expecting NonUniqueResultException from AbstractQuery::getSingleScalarResult() 2023-05-23 05:32:38 -03:00
Grégoire Paris
10fa1e07b2 Merge remote-tracking branch 'origin/2.16.x' into 3.0.x 2023-05-16 17:42:44 +02:00
Grégoire Paris
8fba9d6868 Merge pull request #10708 from mbabker/2.15-link-fix 2023-05-16 17:06:17 +02:00
Michael Babker
7f4f1cda71 Correct docs link 2023-05-16 09:38:09 -05:00
Grégoire Paris
c32efc2588 Merge pull request #10699 from greg0ire/narrow-down-param-type-qs
Narrow down parameter types for quote strategies
2023-05-16 08:20:47 +02:00
Grégoire Paris
4e137f77a5 Merge pull request #10704 from greg0ire/drop-useless-block
Remove unreachable piece of code
2023-05-16 08:19:42 +02:00
Grégoire Paris
a33aa15c79 Remove unreachable piece of code
mappedBy is never defined on an inverse relationship.
Bi-directional self-referencing should IMO still result in 2 separate
associations, on 2 separate fields of the same class, like mentor or
mentee.
2023-05-15 14:10:22 +02:00
Grégoire Paris
255ce51526 Merge pull request #10703 from doctrine/2.15.x 2023-05-15 12:05:48 +02:00
Grégoire Paris
1c905b0e0a Merge pull request #10702 from greg0ire/fix-build 2023-05-15 11:53:09 +02:00
Grégoire Paris
7901790b97 Adapt to latest coding standards 2023-05-15 11:42:13 +02:00
Grégoire Paris
6032a2ccf7 Use OneToManyPersister::getMapping() more
Not sure how I forgot these.
2023-05-15 09:27:07 +02:00
Grégoire Paris
1f9d1bf4cb Narrow down parameter type declarations for quote strategies 2023-05-15 09:10:11 +02:00
Grégoire Paris
dff40cf351 Narrow down templated method return type
Maybe we do not know enough about the parameter to determine the type of
the returned relationship, but we can at least narrow it down to 3
possibilites.
2023-05-15 08:57:23 +02:00
Grégoire Paris
a55c72b47d Merge pull request #10701 from greg0ire/convenience
Introduce convenience methods to narrow types
2023-05-15 08:19:05 +02:00
Grégoire Paris
f03db50be1 Merge pull request #10697 from greg0ire/narrow-down-assoc-mapping-type
Narrow down ClassMetadata::associationMappings type
2023-05-14 23:28:38 +02:00
Grégoire Paris
2a77776c91 Merge pull request #10700 from greg0ire/wrong-phpdoc-getdefiningclass
fix wrong phpdoc
2023-05-14 23:22:59 +02:00
Grégoire Paris
c51c84fc47 Introduce convenience methods to narrow types
These methods assert the type of the mapping provided by the collection
according to the name of the class they are in: the one to many
persister only ever deals with one to many associations, and the many to
many persister only ever deals with many to many associations.
2023-05-13 11:33:08 +02:00
Grégoire Paris
00beecce74 fix wrong phpdoc
The keys in the join columns array have no meaning, and are just
sequential integers.
2023-05-13 11:24:01 +02:00
Grégoire Paris
9f60fdc288 Merge pull request #10698 from greg0ire/move-join-column-fieldnames-down
Move joinColumnFieldNames down the class hierarchy
2023-05-12 23:22:40 +02:00
Grégoire Paris
3b88e4844a Move joinColumnFieldNames down the class hierarchy
It has only meaning for ToOneOwningSideMapping
2023-05-12 21:17:20 +02:00
Grégoire Paris
63561fc382 Narrow down ClassMetadata::associationMappings type 2023-05-12 08:24:07 +02:00
Grégoire Paris
cef1d2d740 Merge pull request #10666 from MatTheCat/inherited-readonly-properties
Create `ReflectionReadonlyProperty` from their declaring class so their value can be set
2023-05-12 07:50:03 +02:00
Grégoire Paris
caa8041963 Merge pull request #10696 from greg0ire/templating-getowningside
Add templating for getOwningSide
2023-05-12 07:48:56 +02:00
Grégoire Paris
8126882305 Merge pull request #10486 from mpdude/fix-to-many-update-on-delete
Fix to-many collections left in dirty state after entities are removed by the UoW
2023-05-12 00:11:56 +02:00
Matthias Pigulla
a9513692cb Fix to-many collections left in dirty state after entities are removed by the UoW 2023-05-12 00:02:44 +02:00
Grégoire Paris
52c3d9d82a Merge pull request #10508 from Gwemox/fix-enum-identity
Fix id hash of entity with enum as identifier
2023-05-12 00:00:20 +02:00
Grégoire Paris
1c8b5181b5 Add templating for getOwningSide
It allows to remove many assertions.
2023-05-11 22:08:05 +02:00
MatTheCat
2f46e5a130 Rename test class and method 2023-05-11 09:36:43 +02:00
Mathieu
a3fa1d7faa Replace assertions by @doesNotPerformAssertions 2023-05-11 09:33:12 +02:00
MatTheCat
c7c57be0c2 Create ReflectionReadonlyProperty from their declaring class so their value can be set 2023-05-11 09:33:12 +02:00
MatTheCat
721794fb9c Add test case 2023-05-11 09:33:12 +02:00
Grégoire Paris
e5eaf9b855 Merge pull request #10688 from greg0ire/cmf-getowningassoc
Introduce method to get to the owning side
2023-05-09 07:42:22 +02:00
Grégoire Paris
380f8a42f3 Introduce method to get to the owning side
Throughout the codebase, there is this pattern where we ensure we have
the owning side of an association.
It involves accessing it from the associationMappings array. In the end,
static analysis cannot know that the association is indeed owning.
By introducing this convenience method, we make this clear, and also
delegate the complexity to the class metadata factory.
2023-05-08 17:33:15 +02:00
Grégoire Paris
38e47fdeab Merge pull request #10455 from mpdude/fix-mapping-driver-load
Make Annotations/Attribute mapping drivers report fields for the classes where they are declared
2023-05-08 15:46:54 +02:00
Grégoire Paris
05b5a64cb9 Make indexBy/orderBy easier to understand for SA (#10687)
Interfaces cannot have properties, and we do not have a concept of
sealed classes available to us without installing third party packages.
Interfaces can have methods however, which allows us to simplify calling
code.
I've been avoiding introducing getters for mapping properties because I
do not know what the performance implications are, but here, I think it
is sensible to make an exception, given the benefits.
2023-05-08 15:24:10 +02:00
Matthias Pigulla
9ac063d879 Add a new topological sort implementation (#10592)
This is the first chunk to break #10547 into smaller PRs suitable for reviewing. It adds a new topological sort implementation.

 #### Background

Topological sort is an algorithm that sorts the vertices of a directed acyclic graph (DAG) in a linear order such that for every directed edge from vertex A to vertex B, vertex A comes before vertex B in the ordering. This ordering is called a topological order.

Ultimately (beyond the scope of this PR), in the ORM we'll need this to find an order in which we can insert new entities into the database. When one entity needs to refer to another one by means of a foreign key, the referred-to entity must be inserted before the referring entity. Deleting entities is similar.

A topological sorting can be obtained by running a depth first search (DFS) on the graph. The order in which the DFS finishes on the vertices is a topological order. The DFS is possible iif there are no cycles in the graph. When there are cycles, the DFS will find them.

For more information about topological sorting, as well as a description of an DFS-based topological sorting algorithm, see https://en.wikipedia.org/wiki/Topological_sorting.

 #### Current situation

There is a DFS-based topological sorting implemented in the `CommitOrderCalculator`. This implementation has two kinks:

1. It does not detect cycles

When there is a cycle in the DAG that cannot be resolved, we need to know about it. Ultimately, this means we will not be able to insert entities into the database in any order that allows all foreign keys constraints to be satisfied.

If you look at `CommitOrderCalculator`, you'll see that there is no code dealing with this situation.

2. It has an obscure concept of edge "weights"

To me, it is not clear how those are supposed to work. The weights are related to whether a foreign key is nullable or not, but can (could) be arbitrary integers. An edge will be ignored if it has a higher (lower) weight than another, already processed edge... 🤷🏻?

 #### Suggested change

In fact, when inserting entities into the database, we have two kinds of foreign key relationships: Those that are `nullable`, and those that are not.

Non-nullable foreign keys are hard requirements: Referred-to entities must be inserted first, no matter what. These are "non-optional" edges in the dependency graph.

Nullable foreign keys can be set to `NULL` when first inserting an entity, and then coming back and updating the foreign key value after the referred-to (related) entity has been inserted into the database. This is already implemented in `\Doctrine\ORM\UnitOfWork::scheduleExtraUpdate`, at the expense of performing one extra `UPDATE` query after all the `INSERT`s have been processed. These edges are "optional".

When finding a cycle that consists of non-optional edges only, treat it as a failure. We won't be able to insert entities with a circular dependency when all foreign keys are non-NULLable.

When a cycle contains at least one optional edge, we can use it to break the cycle: Use backtracking to go back to the point before traversing the last _optional_ edge. This omits the edge from the topological sort order, but will cost one extra UPDATE later on.

To make the transition easier, the new implementation is provided as a separate class, which is marked as `@internal`.

 #### Outlook

Backtracking to the last optional edge is the simplest solution for now. In general, it might be better to find _another_ (optional) edge that would also break the cycle, if that edge is also part of _other_ cycles.

Remember, every optional edge skipped costs an extra UPDATE query later on. The underlying problem is known as the "minimum feedback arc set" problem, and is not easily/efficiently solvable. Thus, for the time being, picking the nearest optional edge seems to be reasonable.
2023-05-08 13:30:07 +02:00
Matthias Pigulla
b52a8f8b9e Make Annotations/Attribute mapping drivers report fields for the classes where they are declared
This PR will make the annotations and attribute mapping drivers report mapping configuration for the classes where it is declared, instead of omitting it and reporting it for subclasses only. This is necessary to be able to catch mis-configurations in `ClassMetadataFactory`.

Fixes #10417, closes #10450, closes #10454.

#### ⚠️ Summary for users getting `MappingExceptions` with the new mode

When you set the `$reportFieldsWhereDeclared` constructor parameters to `true` for the AnnotationDriver and/or AttributesDriver and get `MappingExceptions`, you may be doing one of the following:

* Using `private` fields with the same name in different classes of an entity inheritance hierarchy (see #10450)
* Redeclaring/overwriting mapped properties inherited from mapped superclasses and/or other entities (see #10454)

As explained in these two PRs, the ORM cannot (or at least, was not designed to) support such configurations. Unfortunately, due to the old – now deprecated – driver behaviour, the misconfigurations could not be detected, and due to previously missing tests, this in turn was not noticed.

#### Current situation

The annotations mapping driver has the following condition to skip properties that are reported by the PHP reflection API:

69c7791ba2/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php (L345-L357)

This code has been there basically unchanged since the initial 2.0 release. The same condition can be found in the attribute driver, probably it has been copied when attributes were added.

I _think_ what the driver tries to do here is to deal with the fact that Reflection will also report `public`/`protected` properties inherited from parent classes. This is supported by the observation (see #5744) that e. g. YAML and XML drivers do not contain this logic.

The conditions are not precise enough for edge cases. They lead to some fields and configuration values not even being reported by the driver. 

Only since the fields would be "discovered" again when reflecting on subclasses, they eventually end up in class metadata structures for the subclasses. In one case of inherited ID generator mappings, the `ClassMetadataFactory` would also rely on this behaviour.

Two potential bugs that can result from this are demonstrated in #10450 and #10454.

#### Suggested solution

In order to find a more reliable way of separating properties that are merely reported again in subclasses from those that are actual re-declarations, use the information already available in `ClassMetadata`. In particular, `declared` tells us in which non-transient class a "field" was first seen.

Make the mapping driver skip only those properties for which we already know that they have been declared in parent classes, and skip them only when the observed declaring class matches the expectation. 

For all other properties, report them to `ClassMetadataFactory` and let that deal with consistency checking/error handling.

#10450 and #10454 are merged into this PR to show that they pass now.

#### Soft deprecation strategy

To avoid throwing new/surprising exceptions (even for misconfigurations) during a minor version upgrade, the new driver mode is opt-in.

Users will have to set the `$reportFieldsWhereDeclared` constructor parameters to `true` for the `AnnotationDriver` and/or `AttributesDriver`. Unless they do so, a deprecation warning will be raised.

In 3.0, the "new" mode will become the default. The constructor parameter can be deprecated (as of ORM 3.1, probably) and is a no-op.

We need to follow up in other places (DoctrineBundle, ... – what else?) to make this driver parameter an easy-to-change configuration setting.
2023-05-08 11:23:28 +00:00
Terence Eden
70477d81e9 Documentation typo (#10686)
The past tense of spin is spun, not "spinned"

https://en.wiktionary.org/wiki/spin#English
2023-05-08 12:22:09 +02:00
Grégoire Paris
05678dcd97 Merge pull request #10681 from greg0ire/rework-class-hierarchy
Rework association mapping hierarchy
2023-05-07 23:49:32 +02:00
Grégoire Paris
a9c80c2293 Merge pull request #10682 from greg0ire/remove-unneeded-fields
Make sure unneeded fields are not present
2023-05-07 23:48:41 +02:00
Grégoire Paris
1b2771f964 Merge pull request #10685 from doctrine/2.15.x-merge-up-into-2.16.x_vNvlgHpG
Merge release 2.15.1 into 2.16.x
2023-05-07 21:06:56 +02:00
Grégoire Paris
e18b80c1bf Rework association mapping hierarchy
- Each type is now either final, abstract or an interface.
- The mappedBy attribute is no longer nullable and moved down the
  hierarchy.
- The inversedBy attribute is still nullable and also moved down the
  hierarchy.
- Code common to ManyToOneAssociationMapping and
  OneToOneOwningSideMapping is de-duplicated and moved up the hierarchy
- Code inside ToManyInverseSideMapping and ToManyOwningSideMapping comes
  from a trait to avoid duplication.
2023-05-07 21:04:02 +02:00
Alexander M. Turek
9bc6f5b4ac Support unserializing 2.14 ParserResult instances (#10684) 2023-05-07 20:56:25 +02:00
Grégoire Paris
3ddb2a845c Make sure unneeded fields are not present
Instead of ensuring every mapping array has a mappedBy and an inversedBy
field, let us do the opposite, and remove them when they are null.
Likewise if there is a joinColumns field, it is useless if null or
empty.
2023-05-05 21:02:25 +02:00
Grégoire Paris
9766b6b03e Merge pull request #10651 from mpdude/unit-of-work-schedule-single-entities
Prepare entity-level commit order computation in the `UnitOfWork`
2023-05-05 20:43:23 +02:00
Grégoire Paris
9baf213673 Merge pull request #10680 from greg0ire/3.0.x
Merge 2.16.x up into 3.0.x
2023-05-05 18:46:19 +02:00
Grégoire Paris
f874bc85f1 Merge remote-tracking branch 'origin/2.16.x' into 3.0.x 2023-05-05 09:32:05 +02:00
Grégoire Paris
37c8953015 Merge pull request #10678 from doctrine/2.15.x
Merge 2.15.x up into 2.16.x
2023-05-05 08:25:43 +02:00
Grégoire Paris
60c625be17 Upgrade to Psalm 5.11.0 (#10679) 2023-05-05 07:21:05 +02:00
Grégoire Paris
8b0d6a13c2 Merge pull request #10671 from BoShurik/fix-attribute-many-to-many-mapping
Fix attribute ManyToMany mapping
2023-05-04 23:52:47 +02:00
Grégoire Paris
a7ac6ff8d9 Merge pull request #10677 from greg0ire/psalm-5-10
Upgrade to Psalm 5.10.0
2023-05-04 23:49:02 +02:00
Grégoire Paris
222d544b0c Upgrade to Psalm 5.10.0 2023-05-04 22:12:31 +02:00
Grégoire Paris
a199ca3002 Merge pull request #10676 from doctrine/2.15.x
Merge 2.15.x up into 2.16.x
2023-05-04 19:35:13 +02:00
ixitheblue
6f1fd7a81e Fix iteration index initialisation (#10675)
In the code examples of the use of the ``Query#toIterable()`` method, an index ``$i`` is used to control the size of the current batch, which ends when the condition ``($i % $batchSize) === 0`` becomes true.

Because this condition is preceded by ``++$i`` and ``$i`` is initialized to 1, the first batch is actually of size ``$batchSize - 1`` instead of ``$batchSize``.

To solve this, ``$i`` should be initialized to 0 instead of 1.
2023-05-04 14:43:56 +02:00
BoShurik
2af6e4db38 Take into account join columns specifications.
Currently, the AttributeDriver ignores any join column attribute specified on a many to many relationship.
Let's copy code from the AnnotationDriver to fix that.

Fixes #9902
2023-05-04 15:36:29 +03:00
BoShurik
b48dafded8 Update doc-block for AttributeDriverTest's fixtures 2023-05-04 15:35:40 +03:00
Grégoire Paris
ffe1550a68 Bump version numbers in the README (#10674)
2.15.0 has been released.
2023-05-04 13:44:58 +02:00
Grégoire Paris
eef5a1db81 Merge pull request #10668 from stollr/doc_attr_uniqueconstraint
Added doc for the fields parameter of the UniqueConstraint attribute
2023-05-04 08:13:33 +02:00
Grégoire Paris
d075f5d5f8 Merge pull request #10667 from greg0ire/throw-on-invalid-oto
Throw on invalid one to one
2023-05-03 23:25:34 +02:00
Grégoire Paris
c2d053d185 Update branch metadata (#10672) 2023-05-03 22:41:13 +02:00
Grégoire Paris
fac8d84fdb Throw on invalid one to one
One to one relationships are not allowed to define a join column. That
should be done on the owning side of the relationship.
2023-05-03 21:28:25 +02:00
stollr
77822d623e Added doc for the fields parameter of the UniqueConstraint attribute 2023-05-03 10:45:07 +02:00
Grégoire Paris
09680b18ee Merge pull request #10646 from greg0ire/migrate-basic-entity-persister
Migrate basic entity persister to the object API of association mapping
2023-05-02 22:47:52 +02:00
Grégoire Paris
caf8d876da Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-04-26 21:43:19 +02:00
Grégoire Paris
7b5fafffbe Merge pull request #10654 from mpdude/join-column-does-not-make-it-own
Deprecate usage of `@JoinColumn` on the inverse side of one-to-one associations
2023-04-26 20:52:02 +02:00
Grégoire Paris
629c600b10 Merge origin/2.15.x into 3.0.x (using imerge) 2023-04-25 22:28:05 +02:00
Matthias Pigulla
aba8d74017 Deprecate usage of @JoinColumn on the inverse side of one-to-one associations
Following up on #10652:

 #### Current situation

The implementation of `\Doctrine\ORM\Mapping\ClassMetadataInfo::_validateAndCompleteOneToOneMapping` will consider a field with a one-to-one association to be the owning side also when it configures `@JoinColumn` settings.

 #### Suggested change

For a one to one association, a field should be the inverse side when it uses the `mappedBy` attribute, and be the owning side otherwise. The `JoinColumn` may be configured on the owning side only.

This PR adds a deprecation notice when `@JoinColumn` is used on the side of a one-to-one association where `mappedBy` occurs.

In 3.0, this will throw a `MappingException`.
2023-04-25 15:29:17 +02:00
Alexander M. Turek
a056552db9 Merge branch '2.14.x' into 2.15.x
* 2.14.x:
  PHPStan 1.10.14 (#10655)
  Remove JoinColumn from inverse side (#10652)
  Apply `SlevomatCodingStandard.Commenting.AnnotationName` CS rule (#10653)
2023-04-25 13:43:39 +02:00
Alexander M. Turek
1142a396d3 PHPStan 1.10.14 (#10655) 2023-04-25 13:32:39 +02:00
Grégoire Paris
f01b7d254d Remove JoinColumn from inverse side (#10652)
This makes no sense because it describes a one-to-one where each table
references the other one. I do not think this is deliberately supported,
and it probably will not be supported at all in 3.0.
2023-04-25 13:16:20 +02:00
Matthias Pigulla
ed34327941 More precisely state conditions for the postPersist event 2023-04-25 09:48:41 +02:00
Javier Spagnoletti
1ea8424e07 Apply SlevomatCodingStandard.Commenting.AnnotationName CS rule (#10653) 2023-04-25 08:56:58 +02:00
Grégoire Paris
7f46fad0f0 Merge pull request #10650 from greg0ire/better-comments
Improve named constructors' phpdoc
2023-04-24 23:36:22 +02:00
Matthias Pigulla
b42cf99402 Prepare entity-level commit order computation in the UnitOfWork
This is the second chunk to break #10547 into smaller PRs suitable for reviewing. It prepares the `UnitOfWork` to work with a commit order computed on the entity level, as opposed to a class-based ordering as before.

#### Background

#10531 and #10532 show that it is not always possible to run `UnitOfWork::commit()` with a commit order given in terms of  entity _classes_. Instead it is necessary to process entities in an order computed on the _object_ level. That may include

* a particular order for multiple entities of the _same_ class
* a particular order for entities of _different_ classes, possibly even going back and forth (entity `$a1` of class `A`, then `$b` of class `B`, then `$a2` of class `A` – revisiting that class).

This PR is about preparing the `UnitOfWork` so that its methods will be able to perform inserts and deletions on that level of granularity. Subsequent PRs will deal with implementing that particular order computation.

#### Suggested change

Change the private `executeInserts` and `executeDeletions` methods so that they do not take a `ClassMetadata` identifying the class of entities that shall be processed, but pass them the list of entities directly.

The lists of entities are built in two dedicated methods. That happens basically as previously, by iterating over `$this->entityInsertions` or `$this->entityDeletions` and filtering those by class.

#### Potential (BC breaking?) changes that need review scrutiny

* `\Doctrine\ORM\Persisters\Entity\EntityPersister::addInsert()` was previously called multiple times, before the insert would be performed by a call to `\Doctrine\ORM\Persisters\Entity\EntityPersister::executeInserts()`. With the changes here, this batching effectively no longer takes place. `executeInserts()` will always see one entity/insert only, and there may be multiple `executeInserts()` calls during a single `UoW::commit()` phase.
* The caching in `\Doctrine\ORM\Cache\Persister\Entity\AbstractEntityPersister` previously would cache entities from the last executed insert batch only. Now it will collect entities across multiple batches. I don't know if that poses a problem.
* Overhead in `\Doctrine\ORM\Persisters\Entity\BasicEntityPersister::executeInserts` is incurred multiple times; that may, however, only be about SQL statement preparation and might be salvageable.
* The `postPersist` event previously was not dispatched before _all_ instances of a particular entity class had been written to the database. Now, it will be dispatched immediately after every single entity that has been inserted.
2023-04-24 13:32:09 +02:00
Grégoire Paris
559e1d139a Improve named constructors' phpdoc
They were inconsistently documented.
2023-04-24 09:08:37 +02:00
Grégoire Paris
bd9cd989a0 Merge pull request #10649 from greg0ire/wrong-field
Use valid relationships
2023-04-23 22:13:53 +02:00
Grégoire Paris
f7e49a53be Use valid relationships
During a recent refactoring, I had to pick a relationship type for this
piece of code, and I chose wrong, because a many-to-one cannot have a
mappedBy field.
2023-04-23 10:34:12 +02:00
Grégoire Paris
ba9f51a363 Merge pull request #10648 from doctrine/2.14.x-merge-up-into-2.15.x_VZV5I0St
Merge release 2.14.3 into 2.15.x
2023-04-22 15:45:17 +02:00
Grégoire Paris
ade5559ed5 Migrate basic entity persister to the object API of association mapping 2023-04-21 22:33:44 +02:00
Grégoire Paris
c019f8649b Merge pull request #10641 from greg0ire/move-to-1-properties-down
Move $(sourceToTarget|targetToSource)KeyColumns down
2023-04-20 23:20:46 +02:00
Grégoire Paris
68571184ca Become strict about notices and warnings
Since PHPUnit 10, it is possible to display details when notices and
warnings happen, and to fail the test suite on notice.
failOnWarning is older than that.
2023-04-20 22:41:57 +02:00
Heiko Przybyl
1ae74b8ec5 Fix single table inheritance with intermediate abstract class(es)
Fixes #10625
2023-04-20 15:37:42 +02:00
Grégoire Paris
a64f315dfe Merge pull request #10642 from yobrx/patch-1 2023-04-20 11:46:32 +02:00
Yoann B
6ca319a6f4 fix array association on partial index 2023-04-20 10:59:39 +02:00
Grégoire Paris
f171d49dc0 Move $(sourceToTarget|targetToSource)KeyColumns down
These properties can be made non nullable if we move them down to the 2
owning side classes that actually use them.
2023-04-20 09:11:47 +02:00
Grégoire Paris
ae88844353 Merge pull request #10638 from greg0ire/migrate-m2m
Migrate ManyToManyPersister to the object API of association mappings
2023-04-19 23:34:03 +02:00
Grégoire Paris
8d1d32ce81 Migrate ManyToManyPersister to the object API of association mappings 2023-04-18 21:22:22 +02:00
Grégoire Paris
01aa9a5870 Add nice assertion for PHPStan 2023-04-18 21:15:39 +02:00
Grégoire Paris
bf7ffa94cf Merge pull request #10637 from greg0ire/move-properties-down 2023-04-18 15:01:40 +02:00
Grégoire Paris
672ff01f44 Move properties down
These properties only make sense for the owning side of a many-to-many
relationship.
Moving them down allows us simplify the serialization code, because the
case when these properties are empty no longer happen.
2023-04-17 22:52:04 +02:00
Grégoire Paris
fd64e137c8 Merge pull request #10636 from greg0ire/join-table-columns-down
Move joinTableColumns down
2023-04-17 22:22:50 +02:00
Grégoire Paris
49cc83d273 Move joinTableColumns down
This field only makes sense for the owning side of many-to-many
mappings. Moving it down allows us to make it non-nullable.
2023-04-17 21:45:20 +02:00
Grégoire Paris
fceb279947 Merge pull request #10630 from monadial/fix/fqcn-type-in-xml-mapping
Fixed xsd schema for support FQCN type
2023-04-16 10:26:37 +02:00
Grégoire Paris
ada109bc90 Merge pull request #10633 from greg0ire/inspect-owning-side
Check only owning relationships
2023-04-15 14:58:21 +02:00
Grégoire Paris
303baeea33 Merge pull request #10635 from greg0ire/convenience-methods
Introduce and leverage more convenience methods
2023-04-15 14:58:02 +02:00
Grégoire Paris
eeae5734a5 Merge pull request #10634 from greg0ire/wrong-comparison
Remove wrong comparison
2023-04-15 14:53:45 +02:00
Grégoire Paris
b6860328c0 Introduce and leverage more convenience methods 2023-04-15 14:49:32 +02:00
Grégoire Paris
3e04516740 Remove wrong comparison
This is a remnant of when this was done with the type and the &
operator.
2023-04-15 13:07:26 +02:00
Grégoire Paris
ec9e79a35b Check only owning relationships
The inverse side does not have access to join columns / join tables.
2023-04-15 11:48:34 +02:00
Alexander M. Turek
2977933119 Run tests on SQLite with foreign keys enabled (#10632) 2023-04-15 10:54:31 +02:00
Alexander M. Turek
2d3e89e2cb Remove obsolete RequiresPhp attributes (#10631) 2023-04-14 23:05:11 +02:00
Grégoire Paris
727a9914f2 Merge pull request #10628 from greg0ire/discriminator-mapping-object-api
Migrate to DiscriminatorColumnMapping's object API
2023-04-14 22:55:47 +02:00
Grégoire Paris
5aebfefc45 Merge pull request #10629 from greg0ire/embedded-class-mapping-object-api
Migrate to embedded class mapping object API
2023-04-14 22:54:36 +02:00
Tomas Mihalicka
5ac6fadf29 Fixed xsd schema for support FQCN type
After update to orm 2.14.2 invalid xsd schema error is occured, when in field,id or attribute-override have type is FQCN
2023-04-14 18:16:35 +02:00
Grégoire Paris
118eb87032 Migrate to embedded class mapping object API 2023-04-14 15:42:00 +02:00
Grégoire Paris
7df7503af6 Migrate to DiscriminatorColumnMapping's object API
Its array access implementation should stay for external consumers, but
should be deprecated as of Doctrine 3.1.0
2023-04-14 14:27:50 +02:00
Grégoire Paris
c49bba7a5e Merge pull request #10617 from greg0ire/field-mapping-object-api
Use Rector to migrate to the object API of FieldMapping
2023-04-14 07:40:39 +02:00
Grégoire Paris
2acb298e74 Use Rector to migrate to the object API of FieldMapping
This makes the array access implementation of FieldMapping useful only
to consumers, it is no longer useful internally, and should be
deprecated as of Doctrine 3.1.0
2023-04-13 19:39:51 +02:00
Grégoire Paris
eaac5cd3dc Merge pull request #10613 from greg0ire/association-mapping
Extract AssociationMapping in its own DTO
2023-04-13 19:32:13 +02:00
Grégoire Paris
e59ed88251 Merge pull request #10620 from ecourtial/fix-doc-typo
fix typo in HydrationCompleteHandler doc
2023-04-12 21:21:42 +02:00
Eric COURTIAL
a16aeaeac8 fix typo in HydrationCompleteHandler doc 2023-04-12 21:02:36 +02:00
Mathieu
fca1ef78a7 Handle null comparisons in ManyToManyPersister (#10587)
* Add test case for https://github.com/doctrine/orm/issues/7717

* Do not hide null equality checks in `SqlValueVisitor::walkComparison`

* Annotate `GH7717Parent::$children` type
2023-04-12 17:31:38 +02:00
Grégoire Paris
a78e5bcf65 Merge pull request #10519 from mpdude/deprecate-override-association
Deprecate overriding associations not inherited from a mapped superclass
2023-04-07 20:03:39 +02:00
Grégoire Paris
14d615201e Extract AssociationMapping in its own DTO 2023-04-07 08:39:19 +02:00
Thibault Buathier
09b4a75ed3 Fix id hash of entity with enum as identifier
When an entity have a backed enum as identifier, `UnitOfWork` tries to
cast to string when generating the hash of the id.
This fix calls `->value` when identifier is a `BackedEnum`.
Fixes #10471
Fixes #10334
2023-04-03 17:20:48 +02:00
Grégoire Paris
545070f879 Merge pull request #10612 from doctrine/embedded-class-mapping-dto 2023-04-03 10:06:40 +02:00
Grégoire Paris
9d3ae4a55a Extract embedded class mapping into its own DTO 2023-04-03 09:33:28 +02:00
Grégoire Paris
c213974234 Use the correct argument order for PHPUnit's assertions 2023-04-03 08:58:03 +02:00
Grégoire Paris
b984b567b8 Merge pull request #10599 from amina-seraoui/2.14.x
fix(persistent-collection): check association is not nullable before using it as an array
2023-04-02 23:26:11 +02:00
Grégoire Paris
e22592f06b Extract discriminator column mapping into its own DTO (#10609) 2023-04-02 14:19:03 +02:00
tasmim-concept
92c56164ee throw exception if association is null 2023-04-01 08:50:06 +02:00
Grégoire Paris
e4a7403ead Merge pull request #10607 from greg0ire/field-mapping-dto
Field mapping DTO
2023-03-31 23:34:30 +02:00
Grégoire Paris
175cdefd67 Extract FieldMapping in its own DTO
In the past, it has been decided to use arrays for this out of
legitimate performance concerns. But PHP has evolved, and now, it is
more performant and memory efficient to use objects.
2023-03-31 21:53:00 +02:00
Grégoire Paris
e8376b3995 Create array access implementation
We are going to have many DTOs, all of which will need an array access
implementation as a backward compatibility layer.
2023-03-31 09:10:38 +02:00
Grégoire Paris
b87f86e6f0 Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-03-30 21:03:14 +02:00
Grégoire Paris
b2707509fc Merge pull request #10605 from greg0ire/2.15.x
Merge 2.14.x up into 2.15.x
2023-03-30 20:37:50 +02:00
Grégoire Paris
1d02139d2a Merge remote-tracking branch 'origin/2.14.x' into 2.15.x 2023-03-30 17:22:56 +02:00
Grégoire Paris
e5fb1a4a8f Merge pull request #10604 from greg0ire/psalm-5.9.0 2023-03-30 17:18:54 +02:00
Grégoire Paris
8cb7a5e212 Upgrade to Psalm 5.9.0
It looks like some issues are now represented by different classes.
2023-03-30 17:05:25 +02:00
Grégoire Paris
7ed28dba50 Merge pull request #10601 from JanTvrdik/discriminated-column-options 2023-03-30 13:31:59 +02:00
Jan Tvrdík
f215515bab Support options like charset and collation on DiscriminatedColumn
[closes #10462]
2023-03-30 11:58:29 +02:00
Grégoire Paris
ffbfbfcda1 Merge pull request #10602 from greg0ire/remove-or
Remove duplicate array shape
2023-03-29 23:30:10 +02:00
Grégoire Paris
4a30f622ec Remove duplicate array shape
DiscriminatorColumnMapping is just a specialization of the array shape
that is right of the pipe: it has the same fields, except fewer fields
are nullable. The union of that is the same thing as the array shape.
2023-03-29 21:58:36 +02:00
Grégoire Paris
df7a5bc712 Merge pull request #7199 from greg0ire/inherit_base_mapping_exception
Inherit from homonym exception in parent package
2023-03-25 12:46:36 +01:00
Grégoire Paris
fc314a2abf Merge pull request #10596 from doctrine/remove-comment
Remove contradictory comment of ORMException
2023-03-24 23:41:35 +01:00
Claudio Zizza
ebfab93d15 Remove contradictory comment
ORMException is an interface in 3.0 already
2023-03-24 23:22:36 +01:00
Grégoire Paris
aec3556502 Merge pull request #10554 from mpdude/mapped-superclass-resolve-to-many-lazy-check
Make "targetEntity must not be a mapped superclass" a lazy check
2023-03-24 08:27:38 +01:00
Grégoire Paris
13d8695780 Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-03-23 16:08:09 +01:00
Grégoire Paris
33a19f1bf3 Merge pull request #10593 from mpdude/workflows
Run workflows also for the `entity-level-commit-order` branch
2023-03-23 09:15:33 +01:00
Matthias Pigulla
b6669746b7 Run workflows also for the entity-level-commit-order branch 2023-03-23 08:01:15 +00:00
Grégoire Paris
cc72796fff Inherit from homonym exception in parent package
This means that a class implementing a doctrine/persistence interface or
extending a class from that package can throw a specialized exception
that will still be caught by code in the parent package.
2023-03-22 20:02:40 +01:00
Grégoire Paris
da9b9de590 Merge pull request #10589 from e2palmes/patch-1 2023-03-22 12:12:27 +01:00
Emmanuel DE PALMÈS
9ec697db7d Added missing ';'
missing ';' on Obtaining the EntityManager section, bootstrap code line 32
2023-03-22 11:52:36 +01:00
Gabriel Ostrolucký
25bd41a504 Merge branch '2.14.x' into 2.15.x 2023-03-19 22:46:07 +01:00
Mikael Peigney
a50a611bee docs: Remove incorrect @SequenceGenerator info (#10583)
The default allocationSize for @SequenceGenerator has actually been set to 1 ever since 434325e (back in 2010!)
This was done to remove confusion, but the docs were never updated to reflect the change
2023-03-16 10:32:42 +01:00
David Maicher
abb30093ed add $isXsdValidationEnabled to SimplifiedXmlDriver constructor 2023-03-14 09:38:23 +01:00
Alexander M. Turek
df559d8ac0 PHPStan 1.10.6, Psalm 5.8.0 (#10575) 2023-03-14 07:03:59 +01:00
Cyril Beslay
a6de4b9663 docs: Update Logger removal in Batch Processing documentation (#10572)
Current documented way is using Doctrine DBAL2.
Since DBAL3, logging is done with Middlewares, so I updated the recommendation in documentation.
2023-03-12 00:09:30 +01:00
Grégoire Paris
6db296cd5c Merge pull request #10539 from mpdude/performance-to-one-inheritance
More precisely document the performance impact of to-one associations towards inheritance hierarchies
2023-03-08 23:00:08 +01:00
Matthias Pigulla
7c2adde6f2 More precisely document the performance impact of to-one associations towards inheritance hierarchies
This puts the remarks that apply to both JTI/STI in a common section at the beginning, and tries to explain a bit more in detail why it is that way.

It was sparked off by the discussion in #10538.
2023-03-08 17:27:44 +00:00
Grégoire Paris
35a29731bb Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-03-07 14:00:29 +01:00
Grégoire Paris
04573fc283 Address deprecation of fetchAll() (#10569)
The methods Connection::fetchAll() and Result::fetchAll() have been
deprecated in favor of more their precise counterparts.
2023-03-07 13:17:42 +01:00
Alexander M. Turek
7568328a6d Forbid PHPUnit annotations (#10567) 2023-03-06 12:02:16 +01:00
Christopher Hertel
b904f44c6c Convert PHPUnit annotations to attributes (#10559) 2023-03-06 11:14:22 +01:00
Alexander M. Turek
46ab755728 Merge 2.15.x into 3.0.x (#10565) 2023-03-06 09:31:33 +01:00
Alexander M. Turek
82362ee65e Merge 2.14.x into 2.15.x (#10564) 2023-03-06 09:30:02 +01:00
Grégoire Paris
69543ba1bf Skip test instead of commenting it out (#10563)
Skipping makes the test more discoverable.
2023-03-06 09:27:35 +01:00
Alexander M. Turek
476ffd5cd8 Merge branch '2.15.x' into 3.0.x
* 2.15.x:
  Skip test instead of commenting it out (#10560)
  Add missing return statements to Command:configure methods
  Fix a Markdown/RST formatting glitch
  Add mapping configurations for classes that were used in tests as entities, but never declared
  Allow to-many associations on mapped superclasses w/ ResolveTargetEntityListener
2023-03-05 23:02:45 +01:00
Alexander M. Turek
9ff0440aac Merge 2.14.x into 2.15.x (#10561) 2023-03-05 22:35:31 +01:00
Alexander M. Turek
a33885575f Skip test instead of commenting it out (#10560) 2023-03-05 22:24:44 +01:00
Gabriel Ostrolucký
e28dee0742 Add missing return statements to Command:configure methods 2023-03-05 21:31:46 +01:00
Alexander M. Turek
59fb8ca571 Remove Doctrine\ORM\Proxy\Proxy interface (#10551) 2023-03-05 12:43:47 +01:00
Alexander M. Turek
c44e19a5e7 PHPUnit 10 (#10492) 2023-03-05 12:43:00 +01:00
Alexander M. Turek
b69e8e0267 Add more native types to entity manager (#10556) 2023-03-02 15:19:42 +01:00
Matthias Pigulla
2c40e917c8 Revert unnecessary changes from #10473 2023-03-01 21:30:22 +00:00
Matthias Pigulla
5c06d46874 Add tests for the schema validator check 2023-03-01 21:30:22 +00:00
Matthias Pigulla
24c4ac4dd8 Do not check at runtime that associations do not refer to mapped superclasses 2023-03-01 20:40:55 +00:00
Grégoire Paris
4fad7a1190 Merge pull request #10473 from mpdude/mapped-superclass-resolve-to-many
Allow to-many associations on mapped superclasses w/ ResolveTargetEntityListener
2023-03-01 08:16:07 +01:00
Alexander M. Turek
4444a29c14 Merge branch '2.15.x' into 3.0.x
* 2.15.x:
  Ignore the cache dir of PHPUnit 10 (#10546)
  Make data providers static (#10545)
  Make data providers static (#10544)
  Bump dev tools (#10541)
  Mark SqlWalker methods as not deprecated (#10540)
  docs: consistency order for docblock in association mapping (#10534)
  Correct use of PHP attribute
  fix typo in faq.rst (#10526)
  fix: use executeStatement in SchemaTool (#10516)
  Write a test in a more specific way
  Put up a warning sign that mapping may not be inherited from transient classes (#10392)
  Avoid unnecessary information in query hints to improve query cache hit ratio
2023-02-28 17:09:23 +01:00
Alexander M. Turek
f36a8c879c Merge branch '2.14.x' into 2.15.x
* 2.14.x:
  Ignore the cache dir of PHPUnit 10 (#10546)
  Make data providers static (#10544)
  Bump dev tools (#10541)
  Mark SqlWalker methods as not deprecated (#10540)
  docs: consistency order for docblock in association mapping (#10534)
  Correct use of PHP attribute
  fix typo in faq.rst (#10526)
  fix: use executeStatement in SchemaTool (#10516)
  Write a test in a more specific way
  Put up a warning sign that mapping may not be inherited from transient classes (#10392)
  Avoid unnecessary information in query hints to improve query cache hit ratio
2023-02-28 13:50:36 +01:00
Alexander M. Turek
a28e2d8277 Ignore the cache dir of PHPUnit 10 (#10546) 2023-02-28 13:35:35 +01:00
Alexander M. Turek
fa4b945b94 Make data providers static (#10545) 2023-02-28 08:29:47 +01:00
Alexander M. Turek
4759a1bf75 Make data providers static (#10544) 2023-02-28 08:29:28 +01:00
Alexander M. Turek
9c2c1178e2 Stabilize DBAL version constraint (#10542) 2023-02-28 08:29:02 +01:00
Alexander M. Turek
e0ad7ac506 Bump dev tools (#10541)
* phpstan/phpstan (1.9.14 => 1.10.3)
* squizlabs/php_codesniffer (3.7.1 => 3.7.2)
* vimeo/psalm (5.6.0 => 5.7.7)
2023-02-28 08:28:45 +01:00
Christophe Coevoet
9485d4d835 Mark SqlWalker methods as not deprecated (#10540)
phpstan treats implementations of deprecated methods of an interface as being deprecated themselves by default.
However, SqlWalker does not intend to deprecate all those methods that are deprecated in TreeWalker, as they are
moved down. Marking them as not deprecated will avoid reporting usages of deprecated APIs when implementing
custom DQL functions for instance.
2023-02-26 15:21:47 +01:00
Matthias Pigulla
7814cbf4ec Fix a Markdown/RST formatting glitch 2023-02-24 17:59:02 +01:00
Matthieu Lempereur
9a6e1b3505 docs: consistency order for docblock in association mapping (#10534) 2023-02-22 14:00:30 +01:00
Grégoire Paris
c286742814 Merge pull request #10529 from joshpme/patch-1
Correct use of PHP attribute
2023-02-20 08:00:20 +01:00
Josh P
052887765b Correct use of PHP attribute
Incorrect syntax used in php 8 attribute. This should be key: value, rather than key=value
2023-02-20 15:37:30 +11:00
Al Zee
5464e21022 fix typo in faq.rst (#10526) 2023-02-17 08:25:10 +01:00
Grégoire Paris
c26c55926f Merge pull request #8797 from mpdude/query_count_hint 2023-02-15 17:15:45 +01:00
Simon Podlipsky
5369e4f425 fix: use executeStatement in SchemaTool (#10516) 2023-02-14 19:14:28 +01:00
Matthias Pigulla
29bc6cc955 Write a test in a more specific way
... so we can be sure that in fact the second result has a different size.

Co-authored-by: Luís Cobucci <lcobucci@gmail.com>
2023-02-14 08:04:56 +00:00
Grégoire Paris
f98b33f764 Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-02-14 00:11:12 +01:00
Grégoire Paris
979b3dcb8d Merge pull request #10513 from greg0ire/use-array-shapes
Use array shapes where appropriate
2023-02-13 23:57:57 +01:00
Grégoire Paris
759ae5678f Merge pull request #10520 from mpdude/10470-as-exception
Turn deprecation from #10470 into an exception in 3.0.x
2023-02-13 23:08:48 +01:00
Matthias Pigulla
6b61e52baa Turn deprecation from #10470 into an exception in 3.0.x 2023-02-13 20:50:42 +00:00
Matthias Pigulla
8efdcb0555 Deprecate overriding associations not inherited from a mapped superclass 2023-02-13 20:46:11 +00:00
Grégoire Paris
21c3f4d826 Merge pull request #10517 from greg0ire/3.0.x
Merge 2.15.x up into 3.0.x
2023-02-12 22:13:24 +01:00
Grégoire Paris
7a7464e6d3 Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-02-12 18:33:13 +01:00
Grégoire Paris
3810a0b6f9 Merge pull request #10470 from mpdude/prevent-entity-override
Deprecate overriding fields/associations inherited from other entities
2023-02-12 18:30:46 +01:00
Matthias Pigulla
c9b644dced Trigger a deprecation notice when entity fields/associations are overridden
This was brought up in #8348, but seemingly forgotten to be implenented in later versions.

Closes #10289.
2023-02-09 22:15:05 +00:00
Grégoire Paris
ae6de13c01 Use array shapes where appropriate
Working on converting these array shapes to DTO allowed me to find every
signature where they are supposed to be used.

The Psalm baseline gets worse because it considers accessing an array
key differently depending on whether it is defined vaguely, as
array<string, mixed>, or precisely, as array{my-key?: string}.
2023-02-09 19:44:47 +01:00
Matthias Pigulla
31ff969628 Put up a warning sign that mapping may not be inherited from transient classes (#10392)
This _seems_ to work, but...

To my understanding, that is only because `ReflectionClass::getProperties` will report `protected` properties also for subclasses, including DocBlocks etc. The mapping drivers are unable to tell where a field comes from, so they pick up the mapping and treat it as originating from the inheriting class.

If that is indeed outside of what the ORM was designed for (sombody please confirm?), then we should explicitly discourage it.

Yes, I have seen examples of this in the wild.
2023-02-09 00:19:38 +01:00
Grégoire Paris
0f77181a2c Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-02-09 00:07:14 +01:00
Matthias Pigulla
072c40357f Add mapping configurations for classes that were used in tests as entities, but never declared
Now that we validate association targets, that's an error.
2023-02-08 21:11:59 +00:00
Matthias Pigulla
ca94e82828 Allow to-many associations on mapped superclasses w/ ResolveTargetEntityListener
Allow to-many associations to be used on mapped superclasses when the owning (inverse) side does not refer back to the mapped superclass, thanks to `ResolveTargetEntityListener`.

 #### Current situation

The [documentation states](https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/inheritance-mapping.html):

> No database table will be created for a mapped superclass itself

> [...] persistent relationships defined by a mapped superclass must be unidirectional (with an owning side only). This means that One-To-Many associations are not possible on a mapped superclass at all.

That's a though limitation.

~Obviously~ ~apparently~ Probably the limitation comes from the fact that in a to-many association the "many" side has to hold a foreign key. Since the mapped superclass does not have a database table (it's not an entity), no such backreference can be established.

Currently, to-many associations trigger an exception as soon as they are seen on a mapped superclass:

d6c0031d44/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php (L459-L461)

 #### `ResolveTargetEntityListener`

The `ResolveTargetEntityListener` can be used to substitute interface or class names in mapping configuration at runtime, during the metadata load phase.

When this gimmick is used to replace _all_ references to the mapped superclass with an entity class in time, it should be possible to have to-many associations on the inheriting entity classes.

 #### Suggested solution

Instead of rejecting to-many associations on mapped superclasses right away, validate that at the end of the day (after the `loadClassMetadata` event has been processed) no association may target at a non-entity class. That includes mapped superclasses as well as transient classes.

 #### Motivating example

Consider a library that comes with a `User` base class. This class is `abstract` and has to be subclassed/filled when the library is used.

By making this a mapped superclass, library users have the freedom to either have a simple user entity class or a user class hierarchy, but we do not impose any requirements on them. (NB we also don't want to have a root entity in the library, because that would have to declare the entire class hierarchy, including library users' classes.)

The actual user class to be used will be configured through the `ResolveTargetEntityListener`.

The library also includes a `SocialMediaAccount` entity. A `User` can have multiple of these accounts, and we want to be able to navigate the accounts from the user side.

To make the example even more fancy, there is a self-referencing association on the `User`: A `User` has been created by another user, and holds a collection of all other `User`s it created.

The test case contained in this PR contains this example and validates that all association mappings look just as if the final user class had been written as an entity directly, without the superclass.

 #### Potential review talking points

- Am I missing other reasons why to-many is not feasible?
- We now reject association mappings with `targetEntity`s that are not entities; relevant BC break? (IMHO: no.)

 #### Review tip

Review commit by commit, not all files at once. The last commit adds a lot of entity declarations that were previously missed in tests and now raised exceptions; that's a lot of clutter in the PR.
2023-02-08 21:11:58 +00:00
Grégoire Paris
db0b9d13c6 Merge pull request #10511 from doctrine/2.14.x
Merge 2.14.x up into 2.15.x
2023-02-08 22:07:14 +01:00
Grégoire Paris
f86fa175df Merge pull request #10509 from greg0ire/php8-migration
Migrate the rest of the source code to PHP 8 syntax
2023-02-08 20:44:15 +01:00
Grégoire Paris
f5e7ddb21c Migrate the rest of the source code to PHP 8 syntax 2023-02-08 20:35:53 +01:00
Alexander M. Turek
01f139d76c Run tests with ext-pgsql (#10480) 2023-02-08 09:33:05 +01:00
Matthias Pigulla
7e2eb61deb Make missing inheritance declarations a failure (#10463)
This follows up on #10431: This kind of misconfiguration triggered a deprecation warning since 2.15.x. Now let's make it an exception.
2023-02-08 08:56:21 +01:00
Matthias Pigulla
660197ea71 Avoid unnecessary information in query hints to improve query cache hit ratio
I've noticed that over time my query caches fill up with redundant queries, i. e. different cache entries for the DQL -> SQL translation that are exactly the same. For me, it's an issue because the cache entries fill up precious OPcache memory.

Further investigation revealed that the queries themselves do not differ, but only the query hints – that are part of the computed cache key – do.

In particular, only the value for the `WhereInWalker::HINT_PAGINATOR_ID_COUNT` query hint are different. Since `WhereInWalker` only needs to know _if_ there are matching IDs but not _how many_, we could avoid such cache misses by using just a boolean value as cache hint.
2023-02-08 08:19:25 +01:00
Alexander M. Turek
ab06e07b53 Baseline Psalm errors for DBAL 3.6 (#10507) 2023-02-08 07:53:21 +01:00
Grégoire Paris
022b945ed5 Merge pull request #10444 from mpdude/paginator-dql-cacheable
Make Paginator-internal query cacheable in the query cache
2023-02-08 07:53:12 +01:00
Grégoire Paris
dfcb20ea1e Merge pull request #10506 from doctrine/php8-migration
Migrate Parser to PHP 8
2023-02-08 00:01:25 +01:00
Sebastian Busch
7203d05539 Clarify difference between transactional() methods of Connection and EntityManager (#10133)
One could interpret the old description as if `Connection#transactional()` would not rollback the transaction. Also, the fact that the `EntityManager` gets closed in case of an exception was not mentioned.
2023-02-07 23:38:04 +01:00
Grégoire Paris
ce03a61b7a Migrate Parser to PHP 8 2023-02-07 23:35:57 +01:00
Grégoire Paris
0f25ae4b83 Merge pull request #10503 from greg0ire/php8-migration
Migrate ClassMetadata to PHP 8 syntax
2023-02-07 08:13:46 +01:00
Alexander M. Turek
6c17e47624 Merge branch '2.14.x' into 2.15.x
* 2.14.x:
  Remove calls to assertObjectHasAttribute() (#10502)
  Remove calls to withConsecutive() (#10501)
  Use recognized array key
  Fix #9095 by re-applying #9096
  Use linebreaks
2023-02-07 01:21:39 +01:00
Alexander M. Turek
0bd5fbf215 Remove calls to assertObjectHasAttribute() (#10502) 2023-02-07 00:13:13 +01:00
Grégoire Paris
4fe224a320 Migrate ClassMetadata to PHP 8 syntax 2023-02-06 23:54:52 +01:00
Grégoire Paris
703648580a Merge pull request #10500 from greg0ire/no-underscore-protected
Stop relying on underscores to indicate property visibility
2023-02-06 23:43:15 +01:00
Grégoire Paris
09caeb2753 Stop relying on underscores to indicate property visibility
It conflicts with our coding standard.
2023-02-06 23:27:21 +01:00
Grégoire Paris
7f9827df4f Merge pull request #10497 from greg0ire/php8-migration
Migrate more classes to PHP 8 syntax
2023-02-06 23:26:22 +01:00
Alexander M. Turek
6a713dd39e Remove calls to withConsecutive() (#10501) 2023-02-06 23:23:05 +01:00
Grégoire Paris
941292fe85 Migrate more classes to PHP 8 syntax 2023-02-06 23:06:21 +01:00
Grégoire Paris
5f169d9325 Merge pull request #10420 from mpdude/fix-9095
Fix #9095 by re-applying #9096
2023-02-06 08:23:15 +01:00
Grégoire Paris
cf4680d0e6 Merge pull request #10498 from greg0ire/fix-invalid-test
Use recognized array key
2023-02-06 08:22:26 +01:00
Matthias Pigulla
cc5775c3f4 Make class final (as suggested in GH review) 2023-02-05 21:38:03 +00:00
Grégoire Paris
c5cf6a046b Use recognized array key
"joinColumn" has no meaning for the static PHP driver. That's because it
performs no translation, unlike other drivers: we're using the
ClassMetadata API directly.

Before this change, changing the value of the "name" key did not break
the test suite. After this change, it does.
2023-02-05 14:35:06 +01:00
Matthias Pigulla
77df5db3b9 Make Paginator-internal query cacheable in the query cache
Make the `Paginator`-internal query (`... WHERE ... IN (id, id2,
id3...)`) cacheable in the query cache again.

When the Paginator creates the internal subquery that does the actual
result limiting, it has to take DBAL type conversions for the identifier
column of the paginated root entity into account (#7820, fixed in
 #7821).

In order to perform this type conversion, we need to know the DBAL type
class for the root entity's `#[Id]`, and we have to figure it out based
on a given (arbitrary) DQL query. This requires DQL parsing and
inspecting the AST, so #7821 placed the conversion code in the
`WhereInWalker` where all the necessary information is available.

The problem is that type conversion has to happen every time the
paginator is run, but the query that results from running
`WhereInWalker` would be kept in the query cache. This was reported in
 #7837 and fixed by #7865, by making this particular query expire every
time. The query must not be cached, since the necessary ID type
conversion happens as a side-effect of running the `WhereInWalker`.

The Paginator internal query that uses `WhereInWalker` has its DQL
re-parsed and transformed in every request.

This PR moves the code that determines the DBAL type out of
`WhereInWalker` into a dedicated SQL walker class, `RootTypeWalker`.

`RootTypeWalker` uses a ~hack~  clever trick to report the type back: It
sets the type as the resulting "SQL" string. The benefit is that
`RootTypeWalker` results can be cached in the query cache themselves.
Only the first time a given DQL query has to be paginated, we need to
run this walker to find out the root entity's ID type. After that, the
type will be returned from the query cache.

With the type information being provided, `Paginator` can take care of
the necessary conversions by itself. This happens every time the
Paginator is used.

The internal query that uses `WhereInWalker` can be cached again since
it no longer has side effects.
2023-02-05 11:17:38 +01:00
Matthias Pigulla
ee8269ea55 Fix #9095 by re-applying #9096
Since #10411 has been merged, no more need to specify all intermediate
abstract entity classes.

Thus, we can relax the schema validator check as requested in #9095. The
reasons given in #9142 no longer apply.

Fixes #9095
2023-02-05 11:13:21 +01:00
Grégoire Paris
d038f23570 Use linebreaks 2023-02-05 11:11:21 +01:00
Grégoire Paris
de8b444938 Merge pull request #10496 from greg0ire/php8-migration
Migrate database driver to PHP 8 syntax
2023-02-05 09:05:45 +01:00
Grégoire Paris
e8c1e6c1d3 Migrate database driver to PHP 8 syntax 2023-02-04 23:25:16 +01:00
Grégoire Paris
4ad077b3d7 Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-02-04 21:33:12 +01:00
Grégoire Paris
83d56d75e1 Merge remote-tracking branch 'origin/2.14.x' into 2.15.x 2023-02-04 10:09:15 +01:00
Alexander M. Turek
3843d7e0cc Make all data providers static (#10493) 2023-02-04 08:35:56 +00:00
Jan Nedbal
d50ba2e248 Fix invalid phpdocs missing null (#10490) 2023-02-03 22:36:32 +00:00
Jan Nedbal
8debb92d78 Add forgotten exception throws (#10489) 2023-02-03 21:32:13 +00:00
Grégoire Paris
8ff7938e31 Hunt down invalid docblocks (#10476)
It is OK to ignore some of the errors we get, but not this one.
2023-01-31 21:12:00 +01:00
Grégoire Paris
9415275195 Merge pull request #10479 from greg0ire/php8-migration 2023-01-30 11:31:01 +01:00
Grégoire Paris
5c34678580 Migrate exec namespace to PHP 8 syntax 2023-01-29 16:44:55 +01:00
Grégoire Paris
d593c33ffa Merge pull request #10478 from greg0ire/better-psalm-type-location
Move psalm types to ClassMetadata
2023-01-28 16:35:37 +01:00
Grégoire Paris
6c925f5b60 Move psalm types to ClassMetadata
This spares us from referencing ClassMetadataInfo from other classes,
which is a good thing since it is deprecated. It also means merging up
is easier.
2023-01-28 15:40:27 +01:00
Grégoire Paris
82bf68d482 Remove underscore prefix on private variables (#10477) 2023-01-28 15:33:34 +01:00
Grégoire Paris
d6c0031d44 Merge pull request #10453 from mpdude/mapped-superclass-association
Add regression test for a to-many relationship on a base class & mapped superclass in the hierarchy
2023-01-28 11:12:16 +01:00
Alexander M. Turek
642a20bcff Merge branch '2.15.x' into 3.0.x
* 2.15.x:
  Psalm 5.6.0, PHPStan 1.9.14 (#10468)
  Fix some tests that were missed in #10431 (#10464)
  Remove commented-out code sections (#10465)
2023-01-27 09:41:48 +01:00
Alexander M. Turek
2ee936acb4 Merge branch '2.14.x' into 2.15.x
* 2.14.x:
  Psalm 5.6.0, PHPStan 1.9.14 (#10468)
2023-01-26 19:08:35 +01:00
Alexander M. Turek
c78f933e57 Psalm 5.6.0, PHPStan 1.9.14 (#10468) 2023-01-26 19:05:45 +01:00
Matthias Pigulla
843bff4971 Fix some tests that were missed in #10431 (#10464)
In #10431, some invalid inheritance declarations in our test base were fixed. However, the change missed to update XML, PHP and static PHP mapping configurations as well.

Apparently, this did not raise any flags because the misconfiguration only caused a deprecation notice in 2.15.x. Running the tests against 3.0 (where the misconfiguration will be an error) unveiled the mistake.
2023-01-26 19:04:57 +01:00
Matthias Pigulla
d679292861 Remove commented-out code sections (#10465)
This removes comments added in #10431 on the 2.15.x branch, as suggested in https://github.com/doctrine/orm/pull/10460#issuecomment-1404889903.
2023-01-26 14:09:35 +01:00
Alexander M. Turek
4d8cf2698e Merge branch '2.15.x' into 3.0.x
* 2.15.x:
  Deprecate undeclared entity inheritance (#10431)
  Psalm 5.5.0 (#10445)
2023-01-26 08:49:28 +01:00
Grégoire Paris
5233a139bb Merge 01028cf3b into 3.0.x (using imerge) 2023-01-25 12:05:43 +01:00
Matthias Pigulla
65687821a7 Deprecate undeclared entity inheritance (#10431)
Inheritance has to be declared as soon as one entity class extends (directly or through middle classes) another one.

This is also pointed out in the opening comment for #8348:

> Entities are not allowed to extend from entities without an inheritence mapping relationship (Single Table or Joined Table inheritance). [...] While Doctrine so far allowed these things, they are fragile and will break on certain scenarios.

Throwing an exception in case of this misconfiguration is nothing we should do light-heartedly, given that it may surprise users in a bugfix or feature release. So, we should start with a deprecation notice  and make this an exception in 3.0. The documentation is updated accordingly at #10429.

Catching missing inheritance declarations early on is important to avoid weird errors further down the road, giving users a clear indication of the root cause.

In case you are affected by this, please understand that although things "previously worked" for you, you have been using the ORM outside of what it was designed to do. That may have worked in simple cases, but may also have caused invalid results (wrong or missing data after hydration?) that possibly went unnoticed in subtle cases.
2023-01-24 22:47:27 +01:00
Matthias Pigulla
80eb85beaa Add regression test for a to-many relationship on a base class & mapped superclass in the hierarchy
This picks the test case from #9517 and rebases it onto 2.14.x.

The problem has been covered in #8415, so this PR closes #9517 and fixes #9516.

Co-authored-by: Robert D'Ercole <bobdercole@gmail.com>
2023-01-24 20:47:41 +00:00
Grégoire Paris
fbcf91d074 Merge pull request #10448 from greg0ire/php8-migration
Migrate ParserResult to PHP 8 syntax
2023-01-24 08:58:28 +01:00
Grégoire Paris
3d1f172788 Migrate ParserResult to PHP 8 syntax 2023-01-23 22:21:39 +01:00
Grégoire Paris
ca0dffb53e Merge remote-tracking branch 'origin/2.14.x' into 2.15.x 2023-01-23 19:27:03 +01:00
Grégoire Paris
01028cf3b8 Merge commit '8b2854393' into 2.15.x 2023-01-23 19:20:22 +01:00
Grégoire Paris
84bfe7cbb9 Merge pull request #10446 from greg0ire/update-psalm-baseline
Update Psalm baseline
2023-01-23 19:20:00 +01:00
Grégoire Paris
1b3978e8c9 Update Psalm baseline 2023-01-23 19:17:40 +01:00
Alexander M. Turek
ed56f42cd5 Psalm 5.5.0 (#10445) 2023-01-23 17:33:19 +01:00
Matthias Pigulla
8b28543939 Avoid wasting Opcache memory with Paginator queries (#10434)
This PR prevents the Paginator from causing OpCache "wasted memory" to increase _on every request_ when used with Symfony's `PhpFilesAdapter` as the cache implementation for the query cache.

Depending on configured thresholds, wasted memory this will either cause periodic opcache restarts or running out of memory and not being able to cache additional scripts ([Details](https://tideways.com/profiler/blog/fine-tune-your-opcache-configuration-to-avoid-caching-suprises)).

Fixes #9917, closes #10095.

There is a long story (#7820, #7821, #7837, #7865) behind how the Paginator can take care of DBAL type conversions when creating the pagination query. This conversion has to transform identifier values before they will be used as a query parameter, so it has to happen every time the Paginator is used.

For reasons, this conversion happens inside `WhereInWalker`. Tree walkers like this are used only during the DQL parsing/AST processing steps. Having a DQL query in the query cache short-cuts this step by fetching the parsing/processing result from the cache.

So, to make sure the conversion happens also with the query cache being enabled, this line

1753d03500/lib/Doctrine/ORM/Tools/Pagination/Paginator.php (L165)

was added in #7837. It causes `\Doctrine\ORM\Query::parse()` to re-parse the query every time, but will also put the result into the query cache afterwards.

At this point, the setup described in #9917 – which, to my knowledge, is the default in Symfony + DoctrineBundle projects – will ultimately bring us to this code:

4b3391725f/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php (L248-L249)

When writing a cache item with an already existing key, the driver has to make sure the opcache will honor the changed PHP file. This is what causes _wasted memory_ to increase.

Instead of using `\Doctrine\ORM\Query::expireQueryCache()`, which will force `\Doctrine\ORM\Query::parse()` to parse the query again before putting it into the cache, use `\Doctrine\ORM\Query::useQueryCache(false)`. The subtle difference is the latter will not place the processed query in the cache in the first place.

A test case is added to check that repeated use of the paginator does not call the cache to update existing keys. That should suffice to make sure we're not running into the issue, while at the same time not complicating tests by using the `PhpFilesAdapter` directly.

Note that in order to observe the described issue in tests, you will need to use the `PhpFilesDriver` and also make sure that OpCache is enabled and also activated for `php-cli` (which is running the unit tests).

This particular subquery generated/used by the Paginator is not put into the query cache. The DQL parsing/to-SQL conversion has to happen _every time_ the Paginator is used.

This, however, was already the case before this PR. In other words, this PR only changes that we do not store/update the cached result every time, but instead completely omit caching the query.
2023-01-23 13:14:46 +01:00
Javier Spagnoletti
eec3c42494 Replace hardcoded name with Command::getName() in output message from UpdateCommand (#10443) 2023-01-23 12:51:16 +01:00
Grégoire Paris
7f783b59c8 Merge pull request #10442 from greg0ire/embedded-class-array-shape 2023-01-23 10:58:11 +01:00
Grégoire Paris
68662f5920 Add embedded class mapping array shape
This should be replaced with a DTO in the next major.
To be able to have something usable, I had to move the validation of the
DTO (checking that it has a "class" attribute) to mapEmbedded, which
happens earlier than doLoadMetadata(). It is unclear to me why it was
not put here in the first place.
2023-01-22 23:49:43 +01:00
Grégoire Paris
6ea4411789 Merge pull request #10440 from greg0ire/php8-migration
Migrate entity manager to PHP 8 syntax
2023-01-22 23:47:38 +01:00
Grégoire Paris
4357161c3d Migrate entity manager to PHP 8 syntax 2023-01-22 15:37:38 +01:00
Adrien Crivelli
769b161dff Identity map cannot contain null value (#10156) 2023-01-22 14:15:20 +07:00
Grégoire Paris
bc394877bc Use the right property (#10441) 2023-01-22 14:04:12 +07:00
Grégoire Paris
1753d03500 Merge pull request #10433 from mpdude/re-enable-tests-7820
Make sure tests from #7837 are actually run
2023-01-21 10:02:34 +01:00
Grégoire Paris
9857cf971b Merge pull request #10438 from greg0ire/2.15.x
Merge 2.14.x up into 2.15.x
2023-01-20 23:58:44 +01:00
Grégoire Paris
f73dae9bc4 Merge remote-tracking branch 'origin/2.14.x' into 2.15.x 2023-01-20 21:19:28 +01:00
Grégoire Paris
1c357b9fb3 Merge pull request #10426 from mpdude/parent-classes-docblock
Slight docblock improvements for `CM::parentClasses`
2023-01-20 12:46:34 +01:00
Matthias Pigulla
3d031ed541 Slight docblock improvements for CM::parentClasses 2023-01-20 11:26:28 +00:00
Grégoire Paris
15ed97b7b1 Merge pull request #10437 from greg0ire/update-baseline
Update Psalm baseline
2023-01-20 12:03:42 +01:00
Grégoire Paris
9fd4af23e1 Update Psalm baseline 2023-01-20 12:00:34 +01:00
Grégoire Paris
7ce6d8d427 Merge pull request #10436 from greg0ire/update-baseline
Update Psalm baseline
2023-01-20 11:43:52 +01:00
Grégoire Paris
a48d95c71d Update Psalm baseline 2023-01-20 11:42:11 +01:00
Matthias Pigulla
aee1d33042 Review the documentation regarding entity inheritance (#10429)
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2023-01-19 19:59:28 +01:00
Matthias Pigulla
8da741ad75 Make sure tests from 7820 are actually run 2023-01-19 12:05:32 +00:00
Grégoire Paris
4206f01e7b Use FieldMapping array shape even more (#10430)
I experimented on converting FieldMapping to a DTO, and it allowed me to
find more places where it should be used.
2023-01-19 10:06:03 +01:00
Matthias Pigulla
7d4052c9e7 Fix version number in UPGRADE.md (#10428)
This was a mistake in #10423.
2023-01-19 08:23:27 +01:00
Grégoire Paris
3b5bd316e6 Merge pull request #10427 from greg0ire/3.0.x
Merge 2.15.x up into 3.0.x
2023-01-18 23:29:04 +01:00
Grégoire Paris
2d92c09101 Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-01-18 23:26:21 +01:00
Grégoire Paris
fc6feb5938 Merge pull request #10423 from mpdude/deprecate-table-type-per-class
Add deprecations for "table per class" inheritance
2023-01-18 23:23:53 +01:00
Matthias Pigulla
89b98bdff9 Add deprecations for "table per class" inheritance 2023-01-18 16:30:57 +00:00
Grégoire Paris
4c1e520bd3 Migrate remaining exceptions to PHP 8 syntax (#10402) 2023-01-18 17:11:42 +01:00
Matthias Pigulla
7a08253f18 Remove "table per class" inheritance that was never actually implemented (#10414) 2023-01-18 16:13:26 +01:00
Matthias Pigulla
ba7387fd8c Fixup GH8127 test case (#10424)
* Fixup GH8127 test case

This removes the unnecessary "middle2" class and puts back in the effect of the data provider.

Both changes were accidentally committed when I was working on #10411 and just meant as experiments during debugging.

* Fix CS
2023-01-18 14:42:26 +01:00
Grégoire Paris
a83e4f7978 Merge pull request #10418 from greg0ire/unique-bool
Use correct type for FieldMapping#unique
2023-01-18 07:37:15 +01:00
Grégoire Paris
4f335ab565 Merge pull request #10415 from greg0ire/maintain-psalm-xml
Remove ignore rules for fixed issues
2023-01-18 07:36:27 +01:00
Grégoire Paris
e6382d393e Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-01-17 23:17:32 +01:00
Grégoire Paris
f88b0032ad Use correct type for FieldMapping#unique
Looking at usages in the codebase, it is supposed to be at least
bool|string, but not string.
When dumping the value inside `getFieldMapping`, it is always a boolean.
2023-01-17 16:29:07 +01:00
Grégoire Paris
69c7791ba2 Merge pull request #8415 from mpdude/mapped-superclass-association-inheritance
Fix association handling when there is a MappedSuperclass in the middle of an inheritance hierarchy
2023-01-17 16:25:20 +01:00
Grégoire Paris
1090dbe9be Merge pull request #10411 from mpdude/discover-missing-subclasses
Fill in missing subclasses when loading ClassMetadata
2023-01-17 16:13:53 +01:00
Matthias Pigulla
c46b604ed7 Fix CS 2023-01-17 14:40:55 +00:00
Matthias Pigulla
8d9ebeded8 Fix association handling when there is a MappedSuperclass in the middle of an inheritance hierarchy
This fixes two closely related bugs.

1. When inheriting a to-one association from a mapped superclass, update the `sourceEntity` class name to the current class only when the association is actually _declared_ in the mapped superclass.
2. Reject association types that are not allowed on mapped superclasses only when they are actually _declared_ in a mapped superclass, not when inherited from parent classes.

Currently, when a many-to-one association is inherited from a `MappedSuperclass`, mapping information will be updated so that the association has the current (inheriting) class as the source entity.

2138cc9383/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php (L384-L393)

This was added in 7dc8ef1db9 for [DDC-671](https://github.com/doctrine/orm/issues/5181).

The reason for this is that a mapped superclass is not an entity itself and has no table.

So, in the database, associations can only be from the inheriting entities' tables towards the referred-to target. This is also the reason for the limitation that only to-one associations may be added in mapped superclasses, since for those the database foreign key can be placed on the table(s) of the inheriting entities (and there may be more than one child class).

Neither the decision to update the `sourceEntity` nor the validation check should be based on `$parent->isMappedSuperclass`.

This only works in the simple case where the class hierarchy is `Mapped Superclass → Entity`.

The check is wrong when we have an inheritance hierarchy set up and the class hierarchy is `Base Entity → Mapped Superclass → Child Entity`.

Bug 1: The association should keep the root entity as the source. After all, in a JTI, the root table will contain the foreign key, and we need to base joins on that table when traversing `FROM LeafClass l JOIN l.target`.

Bug 2: Do not reject the to-many association declared in the base class. It is ok to have the reverse (owning) side point back to the base entity, as it would be if there were no mapped superclasses at all. The mapped superclass does not declare, add or otherwise interfere with the to-many association at all.

Base the decision to change the `sourceEntity` on `$mapping['inherited']` being set. This field points to the topmost _parent entity_ class in the ancestry tree where the relationship mapping appears for the first time.

When it is not set, the current class is the first _entity_ class in the hierarchy with that association. Since we are inheriting the relation, it must have been added in a mapped superclass above, but was not yet present in the nearest parent entity class.

In that case, it may only be a to-one association and the source entity needs to be updated.

(See #10396 for a clarification of the semantics of `inherited`.)

Here is a simplified example of the class hierarchy.

See the two tests added for more details – one is for checking the correct usage of a to-one association against/with the base class in JTI. The other is to test that a to-many association on the base class is not rejected.

I am sure that there are other tests that (still) cover the update of `sourceEntity` is happening.

```php
/**
 * @Entity
 */
class AssociationTarget
{
    /**
     * @Column(type="integer")
     * @Id
     * @GeneratedValue
     */
    public $id;
}

/**
 * @Entity
 * @InheritanceType("JOINED")
 * @DiscriminatorColumn(name="discriminator", type="string")
 * @DiscriminatorMap({"1" = "BaseClass", "2" = "LeafClass"})
 */
class BaseClass
{
    /**
     * @Column(type="integer")
     * @Id
     * @GeneratedValue
     */
    public $id;

    /**
     * @ManyToOne(targetEntity="AssociationTarget")
     */
    public $target;
}

/**
 * @MappedSuperclass
 */
class MediumSuperclass extends BaseClass
{
}

/**
 * @Entity
 */
class LeafClass extends MediumSuperclass
{
}
```

When querying `FROM LeafClass l`, it should be possible to `JOIN l.target`. This currently leads to an SQL error because the SQL join will be made via `LeafClass.target_id` instead of `BaseClass.target_id`. `LeafClass` is considered the `sourceEntity` for the association – which is wrong–, and so the foreign key field is expected to be in the `LeafClass` table (using JTI here).

Fixes #5998, fixes #7825.

I have removed the abstract entity class, since it is not relevant for the issue and took the discussion off course. Also, the discriminator map now contains all classes.

Added the second variant of the bug, namely that a to-many association would wrongly be rejected in the same situation.
2023-01-17 14:37:40 +00:00
Grégoire Paris
55f9178e84 Remove ignore rules for fixed issues
The ArgumentTypeCoercion one is hiding issues we could address.
Addressing them will require changes that should go in the next minor,
so I'm moving them to the baseline instead. That way, we cannot
introduce more issues of this type in this file.
2023-01-17 15:34:10 +01:00
Grégoire Paris
37572802cc Reuse association mapping array shape (#10403) 2023-01-17 11:27:42 +01:00
Matthias Pigulla
60955755e0 Remove outdated todo 2023-01-17 08:49:36 +00:00
Grégoire Paris
a5bdc619c7 Merge pull request #10408 from greg0ire/field-mapping-improvements
Field mapping improvements
2023-01-17 09:08:33 +01:00
Matthias Pigulla
a8e979819a Include a test for DDC-6558 2023-01-16 21:13:30 +00:00
Matthias Pigulla
4e8e3ef30b Discover entity subclasses that need not be declared in the discriminator map 2023-01-16 20:33:25 +00:00
Grégoire Paris
65a7c8882f Merge pull request #10413 from doctrine/2.14.x-merge-up-into-2.15.x_2sgwy6Oi
Merge release 2.14.1 into 2.15.x
2023-01-16 20:44:54 +01:00
Grégoire Paris
2d6295c9db Merge remote-tracking branch 'origin/2.14.x' into 2.15.x 2023-01-16 20:24:44 +01:00
Grégoire Paris
de7eee5ed7 Merge pull request #10385 from nicolas-grekas/uninitialized-prop-reproducer
Fix initializing lazy objects and get rid of "Typed property must not be accessed before initialization" errors
2023-01-16 19:36:59 +01:00
Grégoire Paris
4051937fda Merge pull request #10412 from ThomasLandauer/patch-8
Adding link to Attributes reference
2023-01-16 19:35:20 +01:00
Thomas Landauer
b2e42dc92d Adding link to Attributes reference
In fact, I moved it upwards, and updated it to new target :-)
2023-01-16 17:19:29 +01:00
Alexander M. Turek
f0616626e0 Test with a stable PHPUnit (#10406) 2023-01-16 15:53:19 +07:00
Grégoire Paris
f219b87870 Merge pull request #10393 from mpdude/traits-warning
Place a warning about the uses of traits in the documentation
2023-01-16 08:56:11 +01:00
Matthias Pigulla
a8ef69dbe6 Factor out logic that tracks mapping inheritance (#10397) 2023-01-16 06:33:54 +04:00
Grégoire Paris
c0a7317e8d Reuse array shape 2023-01-15 21:55:32 +01:00
Grégoire Paris
843b0fcc16 Add missing fields 2023-01-15 21:55:32 +01:00
Grégoire Paris
b56de5b0e2 Type TypedFieldMapper API more precisely 2023-01-15 21:55:32 +01:00
Grégoire Paris
87fefbac34 Merge pull request #10396 from mpdude/document-inherited-declared-meaning
Document the meanings of 'inherited' and 'declared' in field mapping information
2023-01-15 15:40:38 +01:00
Alexander M. Turek
0b35e637b8 Merge branch '2.14.x' into 2.15.x
* 2.14.x:
  Stop allowing phpbench's master branch
2023-01-15 14:54:24 +07:00
Matthias Pigulla
853e80ca98 Reword text 2023-01-14 22:56:23 +00:00
Grégoire Paris
d68baef880 Merge pull request #10404 from greg0ire/stable-phpbench
Stop allowing phpbench's master branch
2023-01-14 20:44:08 +01:00
Grégoire Paris
fdccfbd120 Stop allowing phpbench's master branch
A stable version has been published, it allows doctrine/annotations 2
2023-01-14 16:41:18 +01:00
Grégoire Paris
3cd65b12a8 Merge pull request #10401 from greg0ire/3.0.x
Merge 2.15.x up into 3.0.x
2023-01-14 11:34:19 +01:00
Grégoire Paris
d4c53a8885 Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-01-14 11:14:06 +01:00
Grégoire Paris
277614d9c2 Merge pull request #10400 from doctrine/2.14.x
Merge 2.14.x up into 2.15.x
2023-01-14 11:10:20 +01:00
Matthias Pigulla
180afa8c8f Write down what "transient" means (#10394)
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2023-01-14 10:33:58 +01:00
Grégoire Paris
dbbf5c7279 Merge pull request #10390 from greg0ire/wrong-phpdoc-exception
Use more accurate phpdoc for OptimisticLockException
2023-01-14 10:29:13 +01:00
Grégoire Paris
5d9b8f0ea8 Merge pull request #10399 from mpdude/fix-toothbrush-example
Fix DDL example for Mapped Superclasses
2023-01-14 10:28:24 +01:00
Matthias Pigulla
174947155d Fix DDL example for Mapped Superclasses
This was not updated to reflect the changes made when the example was improved in b3ee7141eb.
2023-01-14 08:14:04 +00:00
Grégoire Paris
2138cc9383 Sync variable name with class name (#10395) 2023-01-14 00:16:41 +01:00
Matthias Pigulla
39a434914d Be more vague about the Entity Generator 2023-01-13 23:04:40 +00:00
Matthias Pigulla
227f60c832 Update lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2023-01-13 23:51:39 +01:00
Matthias Pigulla
f72f6b199b Document the meanings of 'inherited' and 'declared' in field mapping information 2023-01-13 22:35:36 +00:00
Grégoire Paris
c8b0931f9c Merge pull request #10379 from greg0ire/remove-cmi
Remove ClassMetadataInfo
2023-01-13 23:18:24 +01:00
Matthias Pigulla
92e63ca4f9 Place a warning about the uses of traits in the documentation 2023-01-13 13:33:53 +00:00
Grégoire Paris
3c98973ab3 Use more accurate phpdoc for OptimisticLockException
While working on migrating this part of the codebase to PHP 8, I found
phpdoc that is wrong.
2023-01-12 18:01:17 +01:00
Grégoire Paris
c226b951b3 Merge pull request #10378 from greg0ire/php8-migration
Migrate classes with the fewest changes
2023-01-11 09:33:24 +01:00
Grégoire Paris
91b662edb6 Merge pull request #10380 from greg0ire/php8-migration-exceptions
Migrate exceptions to PHP 8 syntax
2023-01-10 11:04:17 +01:00
Grégoire Paris
c313440962 Migrate exceptions to PHP 8 syntax
Co-authored-by: Alexander M. Turek <me@derrabus.de>
Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>
2023-01-10 07:58:40 +01:00
Kevin Bond
3b8692fa4a add reproducer 2023-01-09 16:09:03 +01:00
Nicolas Grekas
c9efc1cdee Fix initializing lazy objects and get rid of "Typed property must not be accessed before initialization" errors 2023-01-09 15:58:20 +01:00
Grégoire Paris
a86d5a799d Migrate classes with the fewest changes 2023-01-09 09:10:17 +01:00
Alexander M. Turek
9b1f397ab2 Merge branch '2.15.x' into 3.0.x
* 2.15.x:
  Use more precise types for class strings (#10381)
  PHPStan 1.9.8, Psalm 5.4.0 (#10382)
  fix typo for missing a comma (#10377)
  Docs: Removing `type: 'integer'` from mappings (#10368)
  Docs: Moving *attributes* mapping to first position (#10364)
  Docs: Deleting duplicate mapping example (#10363)
2023-01-09 11:47:02 +07:00
Alexander M. Turek
29b8b0bffb Merge branch '2.14.x' into 2.15.x
* 2.14.x:
  PHPStan 1.9.8, Psalm 5.4.0 (#10382)
  fix typo for missing a comma (#10377)
  Docs: Removing `type: 'integer'` from mappings (#10368)
  Docs: Moving *attributes* mapping to first position (#10364)
  Docs: Deleting duplicate mapping example (#10363)
2023-01-09 11:32:00 +07:00
Grégoire Paris
b7ba018f0a Use more precise types for class strings (#10381) 2023-01-09 11:29:56 +07:00
Alexander M. Turek
c5e4e41e05 PHPStan 1.9.8, Psalm 5.4.0 (#10382) 2023-01-09 11:16:44 +07:00
Grégoire Paris
d83b1e338c Remove ClassMetadataInfo 2023-01-07 18:38:46 +01:00
Grégoire Paris
07937b5b9a Merge pull request #10374 from greg0ire/php8-migration
Migrate classes with the fewest changes to PHP 8
2023-01-07 10:59:50 +01:00
Grégoire Paris
a3db423eab Migrate classes with the fewest changes to PHP 8 2023-01-06 23:32:22 +01:00
Grégoire Paris
2b2f4e8acc Merge pull request #10375 from greg0ire/remove-deprecated-methods
Remove deprecated methods and classes
2023-01-06 23:31:24 +01:00
fauVictor
9431b2ea45 fix typo for missing a comma (#10377) 2023-01-06 16:31:05 +01:00
Grégoire Paris
84e78b8200 Remove deprecated methods and classes
This is a follow-up for https://github.com/doctrine/orm/pull/9876
2023-01-04 21:28:14 +01:00
Grégoire Paris
601948baaa Merge pull request #10373 from greg0ire/3.0.x
Merge 2.15.x up into 3.0.x
2023-01-04 20:50:17 +01:00
Grégoire Paris
19168ca8d6 Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-01-04 20:08:12 +01:00
Grégoire Paris
72b1bf0c02 Use the same type as in the DBAL (#10372)
* Use the same type as in the DBAL

Implementations pass this parameter unchanged to DBAL methods.

* Update Psalm baseline
2023-01-04 19:32:28 +01:00
Grégoire Paris
5e828e20cf Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2023-01-04 18:00:24 +01:00
Thomas Landauer
036ea713a5 Docs: Removing type: 'integer' from mappings (#10368)
Yet another micro-PR ;-) - as requested at https://github.com/doctrine/orm/pull/10364#issuecomment-1370155521

I also changed `$currentPrice` from `float` to `int`, since IMO it's better to store prices as `int` (=cents).

Question: Is there a reason why most typehints are `int|null`, instead of `?int`? Should I change them?
2023-01-04 00:16:22 +01:00
Grégoire Paris
70241d3407 Merge pull request #10365 from greg0ire/precise-return-type
Address new behavior of $firstResult
2023-01-03 23:55:01 +01:00
Grégoire Paris
3a10714d6f Merge pull request #10367 from greg0ire/php8-migration
Migrate files with the least changes to PHP 8
2023-01-03 23:54:44 +01:00
Grégoire Paris
7e379f6872 Migrate files with the least changes to PHP 8
These are the lowest hanging fruits I could find after running Rector: I
looked for files with a diff of 2 lines.
I did not include some changes that I find controversial, such as
marking some constants as final when we should maybe consider making
classes themselves final.
2023-01-03 23:20:25 +01:00
Thomas Landauer
0852847659 Docs: Moving *attributes* mapping to first position (#10364) 2023-01-03 22:42:12 +01:00
Grégoire Paris
1d5d47964c Address new behavior of $firstResult
Following 1915dcd1e8, 0 is now used as a
default value, and Query::$firstResult is no longer nullable, but it
seems getFirstResult() was overlooked. The class is final, so this is no
breaking change.
2023-01-03 21:29:09 +01:00
Thomas Landauer
1e2625a82f Docs: Deleting duplicate mapping example (#10363)
I'm guessing this was forgotten to delete some time ago...
2023-01-03 20:43:26 +01:00
Alexander M. Turek
8b1c353650 Merge branch '2.15.x' into 3.0.x
* 2.15.x:
  PHPStan 1.9.5 (#10359)
  Drop doctrine/lexer 1
2023-01-02 23:22:27 +01:00
Alexander M. Turek
c9c4203a1e Merge branch '2.14.x' into 2.15.x
* 2.14.x:
  PHPStan 1.9.5 (#10359)
2023-01-02 23:14:10 +01:00
Alexander M. Turek
3010fd1680 PHPStan 1.9.5 (#10359) 2023-01-02 23:12:40 +01:00
Grégoire Paris
75bff1d983 Drop doctrine/lexer 2
This allows us to have a totally typed lexer
2023-01-02 22:37:41 +01:00
Grégoire Paris
091da8c420 Merge pull request #10329 from greg0ire/drop-lexer-1-backport
Drop doctrine/lexer 1
2023-01-02 21:07:13 +01:00
Alexander M. Turek
8b35dae5a9 Merge branch '2.15.x' into 3.0.x
* 2.15.x:
  Shorter deprecation message (#10357)
  Add Fully-Qualified class name in UnrecognizedField exception to ease debugging (#10342)
  Include parameter types in hydration cache key generation (#10355)
  Allow doctrine/instantiator 2 (#10351)
2022-12-31 17:56:01 +01:00
Alexander M. Turek
515a3d8b8b Merge branch '2.14.x' into 2.15.x
* 2.14.x:
  Shorter deprecation message (#10357)
  Add Fully-Qualified class name in UnrecognizedField exception to ease debugging (#10342)
  Include parameter types in hydration cache key generation (#10355)
2022-12-31 17:45:59 +01:00
Alexander M. Turek
85ac2769a9 Shorter deprecation message (#10357) 2022-12-31 17:43:12 +01:00
Alexander M. Turek
9062af45ca Fix build for DBAL 4 (#10354) 2022-12-31 16:18:08 +01:00
Axel Venet
28e98b3475 Add Fully-Qualified class name in UnrecognizedField exception to ease debugging (#10342) 2022-12-31 15:20:29 +01:00
Alexander M. Turek
99a37d864e Include parameter types in hydration cache key generation (#10355) 2022-12-31 00:44:23 +01:00
Grégoire Paris
603ab9a185 Drop doctrine/lexer 1 2022-12-31 00:20:27 +01:00
Alexander M. Turek
57f256912a Leverage new ArrayParameterType constants (#10352) 2022-12-30 19:53:30 +01:00
Alexander M. Turek
10d27c18ea Allow doctrine/instantiator 2 (#10351) 2022-12-30 19:52:12 +01:00
Alexander M. Turek
b31afda33b Modernize QueryExpressionVisitor (#10346) 2022-12-29 15:11:29 +01:00
Alexander M. Turek
ccb9ef7246 Merge pull request #10347 from derrabus/improvement/allow-lexer-3
Allow Lexer 3
2022-12-29 15:10:14 +01:00
Grégoire Paris
bdb3fc72da Allow Lexer 3
Co-authored-by: Alexander M. Turek <me@derrabus.de>
2022-12-29 12:58:35 +01:00
Alexander M. Turek
8aa05b89a0 Merge branch '2.15.x' into 3.0.x
* 2.15.x:
  Support of NOT expression from doctrine/collections ^2.1 (#10234)
  Fix Psalm errors with Collection 2.1.2 (#10343)
  Added warning about query cache in relation to parameters (#10276)
2022-12-29 00:48:06 +01:00
Alexander M. Turek
ae9fb8ca21 Merge 2.14.x into 2.15.x (#10344) 2022-12-28 17:23:15 +01:00
Rémi San
c7f2a1d580 Support of NOT expression from doctrine/collections ^2.1 (#10234) 2022-12-28 17:22:39 +01:00
Alexander M. Turek
27df173971 Fix Psalm errors with Collection 2.1.2 (#10343) 2022-12-28 17:19:21 +01:00
Antonio Norman
0aa45dd607 Added warning about query cache in relation to parameters (#10276)
* Added warning about query cache in relation to parameters

* Updated warning about query cache in relation to parameters

* Update docs/en/reference/filters.rst

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>

* Update docs/en/reference/filters.rst

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>
2022-12-24 23:01:28 +01:00
Grégoire Paris
d8a2e329b6 Merge remote-tracking branch 'origin/2.15.x' into 3.0.x 2022-12-20 23:36:39 +01:00
Grégoire Paris
b3f441cb8b Merge pull request #10330 from doctrine/2.14.x
Merge 2.14.x up into 2.15.x
2022-12-20 20:07:49 +01:00
Grégoire Paris
f8bf84d1aa Merge pull request #10088 from HypeMC/enums-in-simpleobjecthydrator 2022-12-20 16:50:24 +01:00
michnovka
c825e34f8d Improve and fix TypedFieldMapper docs (#10327) 2022-12-20 13:09:59 +01:00
Grégoire Paris
ff6bad486b Require dev version of phpbench (#10328)
It is important to have the same version of all dependencies in dev and
in the CI, otherwise it makes it hard to have the right static analysis
baseline for every environment.
2022-12-20 09:18:23 +01:00
michnovka
ad58c6a6e2 Cleanup code from PR10313 from 2.14.x (#10326) 2022-12-20 07:32:34 +01:00
Alexander M. Turek
8f360f08c5 Migrate Doctrine\ORM\Internal\CommitOrder to PHP 8.1 (#10323) 2022-12-20 07:28:33 +01:00
Grégoire Paris
2e2bca8cf8 Merge pull request #10324 from doctrine/2.14.x-merge-up-into-3.0.x_YfifaF7w
Merge release 2.14.0 into 3.0.x
2022-12-19 23:57:12 +01:00
Grégoire Paris
30a2680bfd Merge pull request #10325 from greg0ire/update-branch-metadata
Update branch metadata
2022-12-19 23:48:49 +01:00
Grégoire Paris
a460a4d054 Update branch metadata 2022-12-19 23:35:07 +01:00
Grégoire Paris
32eae38f07 Merge remote-tracking branch 'origin/2.14.x' into 2.14.x-merge-up-into-3.0.x_YfifaF7w 2022-12-19 23:32:57 +01:00
Alexander M. Turek
f82485e651 Support doctrine/annotations 2 (#10320) 2022-12-19 22:51:58 +01:00
Alexander M. Turek
3a2bfce92c Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Drop forceful loading of annotations (#10321)
  Document stdClass structures used by CommitOrderCalculator (#10315)
  Psalm 5.3.0 (#10317)
  PHPStan 1.9.4 (#10318)
  add apcu enabled check if apcu extension loaded (#10310) (#10311)
  Add TypedFieldMapper for automatic mapping of typed PHP fields to DBAL types (#10313)
2022-12-19 22:41:51 +01:00
Grégoire Paris
c4835cca0d Drop forceful loading of annotations (#10321)
Since doctrine/annotations 1.10, autoloading is used when everything
else has failed. Using registerFile() has been deprecated in favor of
that later on.
2022-12-19 20:12:23 +01:00
Alexander M. Turek
82a406332e Document stdClass structures used by CommitOrderCalculator (#10315) 2022-12-19 15:43:46 +01:00
Alexander M. Turek
8093c2eef6 Merge branch '2.13.x' into 2.14.x
* 2.13.x:
  Psalm 5.3.0 (#10317)
  PHPStan 1.9.4 (#10318)
2022-12-19 15:22:24 +01:00
Alexander M. Turek
099e51d899 Psalm 5.3.0 (#10317) 2022-12-19 15:04:28 +01:00
Alexander M. Turek
5df84d4ec0 PHPStan 1.9.4 (#10318) 2022-12-19 12:16:41 +01:00
Alexander M. Turek
f94cb9a5e6 Merge branch '2.13.x' into 2.14.x
* 2.13.x:
  add apcu enabled check if apcu extension loaded (#10310) (#10311)
2022-12-19 00:23:32 +01:00
aleksejs1
c23220b68a add apcu enabled check if apcu extension loaded (#10310) (#10311)
* add apcu enabled check if apcu extension loaded (#10310)

* Apply suggestions from code review

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>

* add use function apcu_enabled

* enable apcu_cli for cache tests

Co-authored-by: Aleksejs Kovalovs <kovalovs@co.inbox.lv>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2022-12-18 21:21:27 +01:00
michnovka
6255461b84 Add TypedFieldMapper for automatic mapping of typed PHP fields to DBAL types (#10313)
Previously, only a predefined set of automatic mappings was allowed, such as int, float, boolean, DateTime etc.
With this extension, it is possible to supply custom TypedFieldMapper implementation which takes as parameter the ReflectionProperty of a given field and decides the appropriate mapping.
A new configuration option was added to set and get the TypedFieldMapper.
The old logic was moved into a class DefaultTypedFieldMapper which is used by default when no mapper is supplied.
The selected TypedFieldMapper is passed into ClassMetadataInfo constructor. If empty, the DefaultTypedFieldMapper is used.
There is also ChainTypedFieldMapper class which allows chaining multiple TypedFieldMappers and apply them in a cascade (always if a field gets type assigned by the earlier mapper in the list, it will not be changed later).
2022-12-18 21:08:30 +01:00
Grégoire Paris
57e18d0b1b Merge pull request #10309 from greg0ire/drop-lexer-1
Drop doctrine/lexer 1
2022-12-15 11:54:03 +01:00
michnovka
b3f9acd1bf Clean-up code after PR10288 merge (#10305) 2022-12-15 11:50:18 +01:00
Grégoire Paris
cdc7feccc8 Drop doctrine/lexer 1
This allows us to introduce the TokenType enum that represents the type
of DQL tokens.
2022-12-14 22:15:20 +01:00
Grégoire Paris
275fe31c04 Merge pull request #10308 from greg0ire/3.0.x
Merge 2.14.x up into 3.0.x
2022-12-14 21:38:25 +01:00
Grégoire Paris
8e9ea9e9e0 Merge remote-tracking branch 'origin/2.14.x' into 3.0.x 2022-12-14 20:52:37 +01:00
Grégoire Paris
0aa5946286 Merge pull request #10301 from greg0ire/allow-lexer-2
Allow lexer 2
2022-12-14 20:29:27 +01:00
Grégoire Paris
eda7558674 Allow doctrine/lexer 2 2022-12-14 13:49:51 +01:00
Alexander M. Turek
92a8453b92 Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Add assertions about non nullability
  Add support for enum discriminator columns
2022-12-14 09:29:24 +01:00
Alexander M. Turek
7fd49b7547 Remove $entityAnnotationClasses and getReader() (#10303) 2022-12-13 23:28:07 +01:00
Grégoire Paris
13bab31da6 Merge pull request #10302 from greg0ire/non-nullability-assertions
Add assertions about non nullability
2022-12-13 23:22:19 +01:00
Grégoire Paris
f960bc2c11 Add assertions about non nullability 2022-12-13 21:13:38 +01:00
Grégoire Paris
15058ca83e Merge pull request #10288 from michnovka/2.13.x-enum-discriminator-columns
Allow enum discriminator columns
2022-12-13 20:01:31 +01:00
Alexander M. Turek
8212ba8803 Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Bump coding standard to v11 (#10295)
  PHPStan 1.9.3 (#10298)
  Rename AbstractCommandTest (#10294)
2022-12-13 19:38:01 +01:00
Alexander M. Turek
9b14786738 Merge branch '2.13.x' into 2.14.x
* 2.13.x:
  Bump coding standard to v11 (#10295)
  PHPStan 1.9.3 (#10298)
  Rename AbstractCommandTest (#10294)
2022-12-13 19:09:05 +01:00
Alexander M. Turek
83f6356f25 Bump coding standard to v11 (#10295) 2022-12-13 19:08:04 +01:00
Alexander M. Turek
4e6cb908f6 PHPStan 1.9.3 (#10298) 2022-12-13 18:51:58 +01:00
Tomas
497ee166bd Add support for enum discriminator columns
This commit adds enumType option to DiscriminatorColumn as well as support for custom DBAL types which use PHP enums for PHP values.
Previously, the enumType option was completely missing, but also even using custom types that used PHP enums would end up in exception because ObjectHydrator would try to convert enums to string using (string) explicit conversion.
Apart from hydrators, ClassMetadataBuilder was extended to support specifying enumType.
Documentation was updated.
2022-12-13 11:15:39 +01:00
Alexander M. Turek
9b723a88aa Rename AbstractCommandTest (#10294) 2022-12-12 16:36:16 +01:00
Alexander M. Turek
2bfcb6e5ab Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Fix changeset computation for enum arrays (#10277)
  Psalm 5.2.0 (#10291)
  Run tools on PHP 8.2 (#10287)
2022-12-12 14:15:47 +01:00
Alexander M. Turek
db18161a1a Merge branch '2.13.x' into 2.14.x
* 2.13.x:
  Fix changeset computation for enum arrays (#10277)
  Psalm 5.2.0 (#10291)
  Run tools on PHP 8.2 (#10287)
2022-12-12 13:59:45 +01:00
michnovka
bd11475615 Fix changeset computation for enum arrays (#10277)
Previously, array of enums were incorrectly compared in UoW::computeChangeSet() resulting always in false positive, since the original data for comparison is fetched using ReflectionEnumProperty::getValue(), which returns the enum values, not enum objects.
This fix ensures comparing the individual enum array members' values.
2022-12-12 13:58:21 +01:00
Alexander M. Turek
90f1f54e73 Psalm 5.2.0 (#10291) 2022-12-12 13:54:50 +01:00
Alexander M. Turek
b25561ad96 Run tools on PHP 8.2 (#10287) 2022-12-11 11:58:09 +01:00
Alexander M. Turek
9d8cadf1fc Remove setAccessible() calls (#10286) 2022-12-10 23:18:23 +01:00
Alexander M. Turek
a17809c3b9 Modernize Closure::fromCallable() calls (#10285) 2022-12-10 23:18:10 +01:00
Alexander M. Turek
9dbe3d003a Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Control proxy implementation via env (#10282)
  Fix association mapping with enum fields
  Correct spelling errors
2022-12-10 21:55:54 +01:00
Alexander M. Turek
284e81403b Merge branch '2.13.x' into 2.14.x
* 2.13.x:
  Fix association mapping with enum fields
  Correct spelling errors
2022-12-10 18:32:48 +01:00
Alexander M. Turek
3ea8550ca6 Control proxy implementation via env (#10282) 2022-12-10 18:11:02 +01:00
Alexander M. Turek
38c476f704 Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Leverage LazyGhostTrait when possible
  Fix deprecation message (#10270)
2022-12-10 15:27:43 +01:00
Grégoire Paris
aa4b62ce78 Merge pull request #10187 from nicolas-grekas/ve-proxy-2
Leverage LazyGhostTrait when possible
2022-12-09 14:14:42 +01:00
Nicolas Grekas
e5e674c686 Leverage LazyGhostTrait when possible 2022-12-08 22:09:29 +01:00
Grégoire Paris
b391431a0e Merge pull request #10274 from michnovka/2.13.x-complex-enum-ids
Fix enum IDs in association mappings
2022-12-08 08:59:52 +01:00
Tomas
d5a6b36e6f Fix association mapping with enum fields
Enum fields as ID have worked for some time, but referencing these fields from other entities in association mappings such as OneToOne, ManyToOne and ManyToMany resulted in fatal error as there was an attempt to convert enum value to string improperly.
2022-12-07 16:56:35 +01:00
HypeMC
9d5ab4ce76 Ensure consistent original data with enums
Previously different hydrators would store the original data for enum
fields in different ways, the SimpleObjectHydrator would keep them as
strings while other hydrators would convert then to native php enums.

This would make the data in the internal UnitOfWork::$originalEntityData
array inconsistent which could've caused problems in the long run.

Now, all hydrators convert enum fields to native php enums ensuring the
original data is always consistent regardless of the hydrator used.
2022-12-07 04:54:22 +01:00
Alexander M. Turek
90efde936a Remove InExpression (#10272) 2022-12-06 21:46:53 +01:00
Alexander M. Turek
caaf1509bf Drop support for Symfony 4 (#10259) 2022-12-06 21:46:30 +01:00
Grégoire Paris
9e578a4f0d Migrate AST namespace to PHP 8 syntax (#10219)
* Migrate AST namespace to PHP 8 syntax

* Use typed properties when type is non-object

We know the phpdoc types in that namespace are pretty messed up, but it
should be safe to assume that's only the case when the type is an object
type.
2022-12-05 22:38:16 +01:00
Alexander M. Turek
a2b5bae923 Fix deprecation message (#10270) 2022-12-05 21:45:50 +01:00
Grégoire Paris
aeed977d6e Merge pull request #10271 from kalifg/patch-1
Correct spelling errors
2022-12-05 19:43:18 +01:00
Michael Dwyer
f66b008b8b Correct spelling errors 2022-12-05 12:31:10 -06:00
Alexander M. Turek
f1c180ba50 Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Add $not constructor parameter to AST classes (#10267)
2022-12-05 12:26:48 +01:00
Alexander M. Turek
5a8541b450 Add $not constructor parameter to AST classes (#10267) 2022-12-05 11:44:53 +01:00
Grégoire Paris
8c732120bc Use intersection types (#10255)
We could not do that before, because it would make Psalm crash.
2022-12-04 22:28:19 +01:00
Grégoire Paris
6cf69ec6d1 Merge pull request #10266 from greg0ire/3.0.x
Merge 2.14.x into 3.0.x
2022-12-04 09:34:22 +01:00
Grégoire Paris
67f876372c Merge remote-tracking branch 'origin/2.14.x' into 3.0.x 2022-12-04 00:17:19 +01:00
Grégoire Paris
fa18e130cb Merge pull request #10265 from doctrine/2.13.x
Merge 2.13.x up into 2.14.x
2022-12-04 00:12:25 +01:00
Grégoire Paris
2ed3f55c01 Merge pull request #10264 from greg0ire/psalm-5.1
Upgrade to Psalm 5.1.0
2022-12-04 00:00:18 +01:00
Grégoire Paris
2dfb4f44e2 Upgrade to Psalm 5.1.0 2022-12-03 10:58:00 +01:00
Alexander M. Turek
f4d658ab7e Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Bump Psalm to 5.0.0 and fix errors for Symfony 6.2 (#10261)
  Make use statements redundant
  Leverage Lexer's Token type (follow up)
2022-11-30 22:10:44 +01:00
Alexander M. Turek
24bf06725b Merge branch '2.13.x' into 2.14.x
* 2.13.x:
  Bump Psalm to 5.0.0 and fix errors for Symfony 6.2 (#10261)
  Leverage Lexer's Token type (follow up)
2022-11-30 22:01:47 +01:00
Alexander M. Turek
4b577e7a18 Bump Psalm to 5.0.0 and fix errors for Symfony 6.2 (#10261) 2022-11-30 22:00:40 +01:00
Grégoire Paris
7433c3ad47 Merge pull request #10227 from greg0ire/php8-migration-expr
Migrate Expr and Lexer to PHP 8 syntax
2022-11-28 08:03:39 +01:00
Grégoire Paris
4d73e3ce78 Migrate Expr and Lexer to PHP 8 syntax 2022-11-27 22:14:04 +01:00
Grégoire Paris
d5ef6be4cc Merge pull request #10256 from greg0ire/parser-consistent-style
Make use statements redundant
2022-11-27 21:59:00 +01:00
Grégoire Paris
65da1fe8cb Merge pull request #10257 from greg0ire/fix-phpdoc-parser
Leverage Lexer's Token type (follow up)
2022-11-27 21:53:55 +01:00
Grégoire Paris
54336840e6 Make use statements redundant
In 68bc00b6c6, while fixing coding style,
I introduced many, many use statements in that file. Using
half-qualified names sometimes, and unqualified names some other times
makes no sense.

If AST\ is used at least once, use it always.
2022-11-26 17:09:39 +01:00
Grégoire Paris
5afa36097a Merge pull request #10254 from greg0ire/3.0.x
Merge 2.14.x up into 3.0.x
2022-11-26 15:01:01 +01:00
Grégoire Paris
afe010ed0f Merge remote-tracking branch 'origin/2.14.x' into 3.0.x 2022-11-26 14:52:30 +01:00
Grégoire Paris
74986f1d53 Merge pull request #10253 from greg0ire/2.14.x
Merge 2.13.x up into 2.14.x
2022-11-26 14:35:02 +01:00
Grégoire Paris
1df221860f Leverage Lexer's Token type (follow up)
Follow-up of f82db6a894.
The previous value introduced in
dc37c2cd2f was too restrictive, hence the
changes to the Psalm baseline.
2022-11-26 14:24:02 +01:00
Grégoire Paris
16cd49ba89 Merge remote-tracking branch 'origin/2.13.x' into 2.14.x 2022-11-26 14:18:14 +01:00
Grégoire Paris
57ac275137 Merge pull request #10252 from greg0ire/psalm-5
Upgrade to Psalm v5
2022-11-26 14:11:21 +01:00
Grégoire Paris
e958046c4a Upgrade to Psalm v5
It is not stable yet, but should be good enough, and this will help
taking care of #10118

Let us baseline all the new issues, just because they are new does not
mean they are more important than already-baselined errors. Besides, it
is more important to have higher standards for new code than to get an
increased baseline.
2022-11-26 13:41:02 +01:00
Grégoire Paris
3038f6aeef Psalm 5 fixes (#10248)
* Account for ClassMetadata::inheritanceType always being truthy

* Remove redundant cast to array
2022-11-24 21:28:23 +01:00
Grégoire Paris
28bf6cb1fa Merge pull request #10247 from derrabus/sa/paginator
Fix types for Paginator
2022-11-23 21:49:53 +01:00
Alexander M. Turek
e864c4cbc2 Fix types for Paginator 2022-11-23 21:40:17 +01:00
Grégoire Paris
02f3a93b71 Merge pull request #10243 from greg0ire/php8-migration-persisters
Migrate persisters to PHP 8 syntax
2022-11-22 21:47:05 +01:00
Grégoire Paris
e9f3a43f37 Migrate persisters to PHP 8 syntax 2022-11-21 23:49:34 +01:00
Grégoire Paris
f9d5a89a39 Merge pull request #10242 from VincentLanglet/staticAnalysis
Solve some PHPStan baseline errors
2022-11-21 08:09:27 +01:00
Vincent Langlet
db7333cc84 Update baseline 2022-11-20 23:55:47 +01:00
Vincent Langlet
47b4ccc4e6 Solve some baseline errors 2022-11-20 22:49:51 +01:00
Grégoire Paris
5a7fce12b8 Merge pull request #10238 from VincentLanglet/lockMode
Use more precise phpdoc
2022-11-20 22:20:08 +01:00
Vincent Langlet
cc9e456ed8 Use more precise phpdoc 2022-11-20 21:56:59 +01:00
Alexander M. Turek
8c7386fea0 Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Remove fragile assertions (#10239)
  update help for RunDqlCommand (#10233)
  Make the code easier to statically analyse
  Widen parameter type
  Document property as non-nullable
2022-11-20 21:09:46 +01:00
Alexander M. Turek
da356316c1 Merge branch '2.13.x' into 2.14.x
* 2.13.x:
  Remove fragile assertions (#10239)
2022-11-20 20:57:47 +01:00
Grégoire Paris
a5a6cc6630 Remove fragile assertions (#10239)
RuntimePublicReflectionProperty has been deprecated in favor of
RuntimeReflectionProperty.

Let us use a more robust assertion.
2022-11-20 19:53:31 +01:00
Grégoire Paris
1ce806fcb7 Merge pull request #10231 from greg0ire/static-analysis-improvements
Make the code easier to statically analyse
2022-11-16 08:08:49 +01:00
David Maicher
958d0b6193 update help for RunDqlCommand (#10233) 2022-11-15 17:38:56 +01:00
Grégoire Paris
843f3c3b23 Make the code easier to statically analyse 2022-11-14 23:00:25 +01:00
Grégoire Paris
82e4c644f9 Merge pull request #10230 from greg0ire/2.14.x
Merge 2.13.x up into 2.14.x
2022-11-14 22:50:32 +01:00
Grégoire Paris
9399f1f3a8 Merge remote-tracking branch 'origin/2.13.x' into 2.14.x 2022-11-14 22:43:56 +01:00
Grégoire Paris
fc3201bded Merge pull request #10229 from greg0ire/fix-phpdoc-exception
Widen parameter type
2022-11-14 22:15:29 +01:00
Grégoire Paris
ad69810775 Merge pull request #10224 from greg0ire/fix-wrong-phpdoc
Document property as non-nullable
2022-11-13 22:11:54 +01:00
Grégoire Paris
3178b4ec4f Widen parameter type
This exception is used in two places, one where $generatedMode is
clearly a string, and another where typing it as a string will cause a
type error, because $generatedMode is supposed to be an int there.
2022-11-13 19:13:40 +01:00
Grégoire Paris
6c7a5e6faa Document property as non-nullable
The constructor forbids it.
2022-11-11 18:39:25 +01:00
Grégoire Paris
d6b9da008b Merge remote-tracking branch 'origin/2.14.x' into 3.0.x 2022-11-11 16:34:25 +01:00
Grégoire Paris
dcc1c26826 Merge pull request #10222 from doctrine/2.13.x
Merge 2.13.x up into 2.14.x
2022-11-11 16:31:42 +01:00
Grégoire Paris
465c02fe68 Reverse-engineer actual type from code (#10221)
The code contains tests for is_array(), is object(), and an else clause.
The type is wrong, and the variable name misleading.
2022-11-11 16:29:36 +01:00
Grégoire Paris
8afb644a18 Ignore PropertyNotSetInConstructor (#10218)
Inside the Query\AST namespace, many classes use public properties that
are supposed to be set from outside the class. Let us ignore
PropertyNotSetInConstructor for that entire namespace instead of doing
it on a case by case basis.
2022-11-11 14:56:31 +01:00
Alexander M. Turek
436142a1d8 Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Add a constructor to CacheKey (#10212)
  Psalm 4.30.0, PHPStan 1.9.2 (#10213)
  Allow "Expr\Func" as condition in join (#10202)
  refactor: use list type in SchemaTool (#10199)
2022-11-11 11:00:23 +01:00
Alexander M. Turek
953e42d059 Add a constructor to CacheKey (#10212) 2022-11-11 10:50:07 +01:00
Grégoire Paris
a8445c9661 Migrate function nodes to PHP 8 syntax (#10214) 2022-11-11 10:49:48 +01:00
Alexander M. Turek
318af0a666 Merge branch '2.13.x' into 2.14.x
* 2.13.x:
  Psalm 4.30.0, PHPStan 1.9.2 (#10213)
2022-11-11 10:16:45 +01:00
Alexander M. Turek
7e45ad935c Psalm 4.30.0, PHPStan 1.9.2 (#10213) 2022-11-10 22:29:50 +01:00
Willem Verspyck
90ececcc85 Allow "Expr\Func" as condition in join (#10202) 2022-11-10 14:43:40 +01:00
Simon Podlipsky
88b36e07e1 refactor: use list type in SchemaTool (#10199) 2022-11-10 14:22:22 +01:00
Grégoire Paris
bfb9e16fcf Merge pull request #10210 from greg0ire/php8-migration
Migrate Cache namespace to php 8
2022-11-09 00:05:11 +01:00
Grégoire Paris
3d729a768f Stop modifying readonly properties 2022-11-08 23:58:15 +01:00
Grégoire Paris
2f1ed28f09 Migrate cache namespace to php 8 2022-11-08 23:58:15 +01:00
Grégoire Paris
ee1b78441c Purge annotations from /lib (#10203)
* Remove file used by annotation registry

* Remove meta-annotations

They should have been removed when the annotation driver was removed.

* Remove unneeded coding standard rule exclusion

* Remove annotation documentation of indexBy
2022-11-07 12:00:28 +01:00
Grégoire Paris
2cbd674141 Merge remote-tracking branch 'origin/2.14.x' into 3.0.x 2022-11-06 23:02:35 +01:00
Grégoire Paris
a37c2cc05f Merge pull request #10206 from greg0ire/rename-variable
Use a more accurate name for $annotationName
2022-11-06 22:13:19 +01:00
Grégoire Paris
40b34b03c1 Use a more accurate name for $annotationName 2022-11-06 21:44:29 +01:00
Grégoire Paris
8d9ab72613 Merge pull request #10204 from greg0ire/rename-internal-methods
Rename internal methods
2022-11-06 21:26:20 +01:00
Grégoire Paris
12f0674b1a Deprecate AttributeDriver::$entityAnnotationClasses 2022-11-06 21:04:05 +01:00
Grégoire Paris
069206ba14 Refer to attributes in comments and variable names 2022-11-06 21:04:05 +01:00
Grégoire Paris
e8a4d2e91b Remove useless comment
Cannot tell what this ignores.
2022-11-06 21:04:05 +01:00
Grégoire Paris
284baf890e Improve phpdoc 2022-11-06 21:04:05 +01:00
Grégoire Paris
a1f9b28cdc Replace Annotations with Attributes in method names
These are internal, so it should be fine.
2022-11-06 21:04:04 +01:00
Grégoire Paris
2b7485af97 Merge pull request #10205 from greg0ire/avoid-references-to-annotations
Avoid references to annotations
2022-11-06 20:56:45 +01:00
Grégoire Paris
edb6332359 Avoid $annotation as a parameter name 2022-11-06 14:58:38 +01:00
Grégoire Paris
48c1eef1b8 Migrate comments to attributes 2022-11-06 14:51:02 +01:00
Alexander M. Turek
5d88dc9be4 Merge branch '2.13.x' into 2.14.x
* 2.13.x:
  PHPStan 1.9.0 (#10200)
2022-11-04 13:08:38 +01:00
Alexander M. Turek
0b14c01b93 PHPStan 1.9.0 (#10200) 2022-11-03 21:04:02 +01:00
michnovka
3182cceda4 EntityManager#refresh lockMode on 3.0.x (#10196) 2022-11-02 16:50:55 +01:00
michnovka
c97f0a1078 Backport NonProxyLoadingEntityManager::refresh() signature change (#10197) 2022-11-02 16:49:13 +01:00
Alexander M. Turek
71bcd64fb5 Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Remove Doctrine\Persistence\ObjectManager::refresh from Psalm baseline
  Add lockMode to EntityManager#refresh() (#10040)
2022-11-02 00:49:02 +01:00
Alexander M. Turek
474f76fc8b Remove Doctrine\Persistence\ObjectManager::refresh from Psalm baseline 2022-11-02 00:15:00 +01:00
michnovka
25ce9b9101 Add lockMode to EntityManager#refresh() (#10040) 2022-11-01 23:59:11 +01:00
Alexander M. Turek
c2fa7282ca Merge pull request #10192 from derrabus/remove/annotation
Remove the Annotation interface
2022-10-31 10:24:41 +01:00
Alexander M. Turek
373fd32b0e Remove the Annotation interface 2022-10-31 09:50:08 +01:00
Alexander M. Turek
3865835070 Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Deprecate the Annotation interface (#10178)
  Bump CI to PHP 8.2 and latest database versions (#10180)
  Remove reference to deprecated DriverChain from docs (#10179)
2022-10-31 09:26:10 +01:00
Alexander M. Turek
75340b68b2 Merge 2.13.x into 2.14.x (#10190) 2022-10-31 09:20:30 +01:00
Grégoire Paris
4be38e2dda Remove last remnants of the YAML driver (#10185) 2022-10-26 23:50:26 +02:00
Alexander M. Turek
543be3fe35 Deprecate the Annotation interface (#10178) 2022-10-26 21:51:46 +02:00
Alexander M. Turek
552d98d554 Bump CI to PHP 8.2 and latest database versions (#10180) 2022-10-26 15:12:52 +02:00
Alexander M. Turek
8f605c652a Remove reference to deprecated DriverChain from docs (#10179) 2022-10-26 15:09:12 +02:00
Alexander M. Turek
ba286de3cb Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  PHPStan 1.8.11 (#10182)
  Add isMemberOf and isInstanceOf to Expr helper list (#10104)
  Migrate more references to annotations (#10176)
  Fix grammer in working-with-objects (#10120)
  Automap events in AttachEntityListenersListener (#10122)
  Adapt use statements to the code (#10174)
2022-10-26 12:00:57 +02:00
Alexander M. Turek
1edfa91714 Merge 2.13.x into 2.14.x (#10181) 2022-10-26 11:53:28 +02:00
Alexander M. Turek
75e42abfdf PHPStan 1.8.11 (#10182) 2022-10-26 11:36:22 +02:00
Romain Monteil
3133bf06c2 Add isMemberOf and isInstanceOf to Expr helper list (#10104)
* Add isMemberOf and isInstanceOf to Expr helper list

* Apply suggestions from code review

Co-authored-by: Alexander M. Turek <me@derrabus.de>
2022-10-26 11:04:17 +02:00
Grégoire Paris
7cf4074d3a Migrate more references to annotations (#10176) 2022-10-26 10:42:42 +02:00
Jonny Eom
bb1deba510 Fix grammer in working-with-objects (#10120) 2022-10-26 10:39:05 +02:00
HypeMC
c828a3814b Automap events in AttachEntityListenersListener (#10122) 2022-10-26 10:36:06 +02:00
Alexander M. Turek
31db15f501 Remove DriverChain (#10175) 2022-10-26 10:15:47 +02:00
Grégoire Paris
1f15e3b198 Purge annotations from the codebase and docs (#10177) 2022-10-26 09:37:39 +02:00
Grégoire Paris
189883e267 Merge pull request #10113 from greg0ire/migrate-to-attributes
Migrate to attributes
2022-10-26 07:30:01 +02:00
Alexander M. Turek
ae6524bb2f Bump DBAL to 3.5 and remove BC hacks (#10173) 2022-10-25 23:51:42 +02:00
Grégoire Paris
ef4543df33 Just a little cs fix, no big deal. 2022-10-25 23:32:47 +02:00
Grégoire Paris
d46f67bf95 Add missing ManyToOne attribute
The tests does not behave as expected without it.
2022-10-25 23:32:47 +02:00
Grégoire Paris
bbdbfb807c Run Rector
I used the following config:

<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Doctrine\Set\DoctrineSetList;

return function (RectorConfig $rectorConfig): void {
    $rectorConfig->paths([
        __DIR__ . '/tests',
    ]);
    $rectorConfig->sets([
        DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
    ]);
};
2022-10-25 23:32:47 +02:00
Grégoire Paris
29aee06e76 Remove annotations that duplicate attributes 2022-10-25 23:32:47 +02:00
Grégoire Paris
f8587c4ed7 Remove annotation driver 2022-10-25 23:32:47 +02:00
Grégoire Paris
a5553a0786 Adapt use statements to the code (#10174) 2022-10-25 23:25:36 +02:00
Grégoire Paris
9c7f575569 Switch to attribute driver 2022-10-25 23:12:12 +02:00
Alexander M. Turek
adceff29f1 Remove EntityManager::create() (#10172) 2022-10-25 16:59:19 +02:00
Alexander M. Turek
59b7fa2ebc Fix build 2022-10-25 00:22:28 +02:00
Alexander M. Turek
94e3772221 Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Deprecate EntityManager::create() (#9961)
  Address deprecation of SchemaDiff::toSaveSql()
  Address deprecation of SchemaDiff::toSql()
  Use error style for notifications
  Fix calls to AbstractSchemaManager::createSchema() (#10165)
  Fix build with DBAL 3.5 (#10163)
  Adjust comments (#10160)
  Deprecate methods related to the annotation driver
  Use correct link
  Deprecate annotations
  Remove trailing whitespace
  Migrate more documentation towards attributes
  Remove wrong sentence
  Do not export phpstan stuff (#10154)
2022-10-24 23:16:35 +02:00
Grégoire Paris
cf91ce63d3 Merge pull request #10153 from greg0ire/address-dbal-deprecations
Address dbal deprecations
2022-10-24 08:53:38 +02:00
Alexander M. Turek
f3f453286f Deprecate EntityManager::create() (#9961) 2022-10-24 00:15:56 +02:00
Grégoire Paris
7cb96fcf0e Address deprecation of SchemaDiff::toSaveSql()
This implies deprecating a feature relying on that method.
2022-10-23 23:29:36 +02:00
Grégoire Paris
ac94d826dc Address deprecation of SchemaDiff::toSql()
The new method AbstractPlatform::getAlterSchemaSQL() should be preferred
when available.
2022-10-23 22:58:31 +02:00
Grégoire Paris
f33919d7d6 Merge pull request #10162 from greg0ire/stderr-for-humans
Use error style for notifications
2022-10-23 22:56:18 +02:00
Grégoire Paris
f256d996cc Use error style for notifications
stderr is not a great name for something that is not meant to be
processed (piped into) a program, but to be read by humans.
Most commands should use stderr, and some of them should partially use
stdout, typically when dumping SQL requests.
2022-10-23 21:51:12 +02:00
Grégoire Paris
d617323a48 Merge pull request #10161 from greg0ire/deprecate-mapping-drivers
Make the mapping driver deprecations more obvious
2022-10-23 10:30:43 +02:00
Alexander M. Turek
6b61e26238 Fix calls to AbstractSchemaManager::createSchema() (#10165) 2022-10-22 17:04:53 -07:00
Alexander M. Turek
edad800711 Merge 2.13.x into 2.14.x (#10164) 2022-10-23 01:19:54 +02:00
Alexander M. Turek
0b9c949590 Fix build with DBAL 3.5 (#10163) 2022-10-23 01:11:03 +02:00
Grégoire Paris
3ee7d96179 Adjust comments (#10160) 2022-10-22 15:34:10 +02:00
Grégoire Paris
fba05675b6 Deprecate methods related to the annotation driver 2022-10-22 15:23:57 +02:00
Grégoire Paris
8160e89c5a Use correct link 2022-10-22 15:05:19 +02:00
Grégoire Paris
a76b776802 Deprecate annotations 2022-10-22 14:54:12 +02:00
Grégoire Paris
ad1d1ca942 Remove trailing whitespace 2022-10-22 14:54:12 +02:00
Grégoire Paris
be835bb8e2 Merge remote-tracking branch 'origin/2.13.x' into 2.14.x 2022-10-21 21:28:17 +02:00
Grégoire Paris
9f926f04ba Merge pull request #10157 from greg0ire/followup-migrate-docs-to-attributes
Migrate more documentation towards attributes
2022-10-21 21:25:08 +02:00
Grégoire Paris
4e445feb6c Migrate more documentation towards attributes
The previous rework missed some details / left the documentation in an
inconsistent state. Searching for "annotation" case insensitively allows
to find discrepancies and forgotten things.
2022-10-21 12:31:10 +02:00
Grégoire Paris
d79e61f8d9 Remove wrong sentence 2022-10-21 12:31:10 +02:00
Simon Podlipsky
06eafd82ac Do not export phpstan stuff (#10154) 2022-10-19 13:36:12 +02:00
Alexander M. Turek
8efcaf97eb Add native types to annotation classes (#10151) 2022-10-18 09:39:12 +02:00
Alexander M. Turek
eda69c23bd Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Modernize documentation code
  Add CI jobs for SQLite3 driver (#10141)
  Fix type doc blocks in annotation classes (#10145)
  Fix FieldMapping for generated key (#10144)
  Stop triggering static analysis workflows on tests
2022-10-17 23:29:39 +02:00
Alexander M. Turek
bac784c9ba Merge 2.13.x up into 2.14.x (#10149) 2022-10-17 23:19:27 +02:00
Grégoire Paris
5f4b76b88f Merge pull request #10126 from greg0ire/migrate-docs-to-attributes
Modernize documentation code
2022-10-17 23:11:33 +02:00
Grégoire Paris
794777b21f Modernize documentation code
- migrate to attributes;
- add helpful phpdoc annotations;
- use typed properties;
- add type declarations.

Co-authored-by: Alexander M. Turek <me@derrabus.de>
2022-10-17 22:56:34 +02:00
Alexander M. Turek
119c378a3a Add CI jobs for SQLite3 driver (#10141) 2022-10-17 22:48:07 +02:00
Grégoire Paris
90bc6dc300 Merge pull request #10136 from greg0ire/trigger-sa-workflows-less
Stop triggering static analysis workflows on tests
2022-10-17 22:45:22 +02:00
Alexander M. Turek
1ad936a448 Fix type doc blocks in annotation classes (#10145) 2022-10-17 22:20:08 +02:00
Ondřej Mirtes
e93e8e0bdf Fix FieldMapping for generated key (#10144) 2022-10-17 15:37:06 +02:00
Alexander M. Turek
8c00c88818 Merge 2.14.x into 3.0.x (#10140) 2022-10-17 10:26:54 +02:00
Alexander M. Turek
7e75807918 Merge 2.13.x into 2.14.x (#10139) 2022-10-17 10:14:22 +02:00
Grégoire Paris
bdf067b58a Stop triggering static analysis workflows on tests
In my opinion it is not great that we do not run static analysis tools on
tests, but since we do not, let us stop triggering extra jobs for no reason.
2022-10-15 23:59:57 +02:00
Grégoire Paris
f08b67f0cc Merge pull request #10135 from greg0ire/remove-extra-file
Remove file suffixed with singular
2022-10-15 11:59:05 +02:00
Grégoire Paris
5f8504b5cf Remove file suffixed with singular
It was wrongly preserved after a conflict that followed a rename.
2022-10-15 11:57:22 +02:00
Grégoire Paris
16e25656d9 Merge pull request #10134 from greg0ire/lighter-builds-💚🌍
Run only relevant workflows
2022-10-15 11:48:21 +02:00
Grégoire Paris
cacdc56b6e Run only relevant workflows
The downside of this is that we will have to tweak the settings so that
no job is required anymore.
The upside is that builds should be faster, and less resource-intensive.
2022-10-15 11:44:34 +02:00
Alexander M. Turek
99e07eb11c Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Allow doctrine/event-manager 2 (#10123)
  Psalm 4.29 (#10128)
  Address deprecation of Table::changeColumn() (#10121)
  Make code blocks consistent (#10103)
  Fix change set computation with enums (#10074)
  PHPStan 1.8.8, Psalm 4.28.0 (#10115)
  fix deprecated trigger help comment
2022-10-13 18:01:09 +02:00
Alexander M. Turek
90f82202a8 Merge 2.13.x into 2.14.x (#10129) 2022-10-13 15:21:22 +02:00
Alexander M. Turek
97aa5b37e6 Allow doctrine/event-manager 2 (#10123) 2022-10-13 13:15:37 +02:00
Alexander M. Turek
13d1c7b286 Psalm 4.29 (#10128) 2022-10-13 10:03:12 +02:00
Grégoire Paris
1a9f40c785 Address deprecation of Table::changeColumn() (#10121)
It is deprecated in favor of Table::modifyColumn().
2022-10-11 19:38:01 +02:00
Pierre du Plessis
06c77cebb5 Make code blocks consistent (#10103) 2022-10-10 23:31:20 +02:00
Grégoire Paris
5367ce843e Merge pull request #10084 from greg0ire/drop-collections-1 2022-10-10 14:16:46 +02:00
HypeMC
1ed0057276 Fix change set computation with enums (#10074)
* add failing testcase test enum Change sets

* Fix change set computation with enums

Co-authored-by: Olda Salek <mzk@mozektevidi.net>
2022-10-10 11:59:04 +02:00
Grégoire Paris
55d58ddb60 Merge pull request #10117 from doctrine/2.14.x
Merge 2.14.x up into 3.0.x
2022-10-10 09:00:45 +02:00
Grégoire Paris
7ce9a6fe5c Merge pull request #10116 from greg0ire/address-dbal-deprecations
Address deprecations form DBAL
2022-10-10 08:42:54 +02:00
Grégoire Paris
8e062955d5 Address deprecations from DBAL
See https://github.com/doctrine/dbal/pull/5731
2022-10-10 08:42:21 +02:00
Alexander M. Turek
5b6f3cd598 PHPStan 1.8.8, Psalm 4.28.0 (#10115) 2022-10-09 23:31:52 +02:00
Grégoire Paris
dc2bd9e412 Migrate collections to PHP 8 syntax 2022-10-09 23:29:08 +02:00
Grégoire Paris
7c17bba801 Remove SQL resultset mapping (#10114) 2022-10-09 22:24:18 +02:00
Grégoire Paris
38271d4aeb Merge pull request #10110 from davidromani/2.13.x
Fix deprecated trigger help comment
2022-10-08 22:42:56 +02:00
Grégoire Paris
0c6d3ec6e0 Merge remote-tracking branch 'origin/2.14.x' into 3.0.x 2022-10-07 21:40:29 +02:00
Grégoire Paris
813e807ea6 Merge pull request #10112 from greg0ire/dont-instantiate-interface
Do not instantiate interface
2022-10-07 21:38:59 +02:00
Grégoire Paris
cfefa1e9b7 Do not instantiate interface
In DBAL 4.0, Doctrine\DBAL\Exception becomes an interface.
2022-10-07 21:28:57 +02:00
David Romaní
84213b9f05 fix deprecated trigger help comment 2022-10-07 18:03:42 +02:00
Grégoire Paris
0e65b0c3dc Merge pull request #10108 from doctrine/2.13.x
Merge 2.13.x up into 2.14.x
2022-10-07 08:52:39 +02:00
Grégoire Paris
e750360bd5 Merge pull request #10101 from greg0ire/followup-9488
Assert that serialization leaves PersistentCollection usable
2022-10-07 08:37:17 +02:00
Alexander M. Turek
e14e9bebcc Merge pull request #10105 from greg0ire/backport-dbal-fixes
Backport DBAL-related fixes
2022-10-06 19:57:45 +02:00
Grégoire Paris
e8ac1169ad Bump CI workflows (#10106) 2022-10-06 16:57:00 +02:00
Grégoire Paris
9422260efd Specify precision for decimal columns
doctrine/dbal 4 no longer provides a default value for that column
option.
2022-10-06 11:32:28 +02:00
Grégoire Paris
d46512332c Address AbstractSchemaManager::createSchema() removal 2022-10-06 10:56:38 +02:00
Grégoire Paris
0d56ffc261 Address method rename
See https://github.com/doctrine/dbal/pull/5724
2022-10-06 10:46:22 +02:00
Grégoire Paris
dd8c7003b8 Assert that serialization leaves PersistentCollection usable
That feature is no longer covered since support for merging entities in
the entity manager was removed.
2022-10-06 10:40:06 +02:00
Grégoire Paris
426ab21b69 Merge pull request #10102 from greg0ire/address-dbal-changes 2022-10-06 10:24:21 +02:00
Grégoire Paris
f310e1f5ba Address method rename
See https://github.com/doctrine/dbal/pull/5724
2022-10-06 08:57:32 +02:00
Grégoire Paris
9bec416bb0 Merge pull request #10100 from greg0ire/forward-compat-attributes
Forward compat attributes
2022-10-05 22:44:49 +02:00
Grégoire Paris
021722acc7 Remove ignored annotation
Making it a separate, valid annotation breaks the tests
2022-10-05 22:15:04 +02:00
Grégoire Paris
5a528bef5d Use short class name
It is more friendly with conversion to attributes
2022-10-05 22:00:44 +02:00
Grégoire Paris
5fbcb18334 Spell cities properly 2022-10-05 21:55:24 +02:00
Grégoire Paris
8280f41fa5 Merge pull request #10099 from greg0ire/fix-attribute-docs
Fix attribute reference
2022-10-05 21:48:46 +02:00
Grégoire Paris
d95d8d0a19 Fix broken links 2022-10-05 21:40:09 +02:00
Grégoire Paris
d36004f825 Remove trailing whitespace 2022-10-05 21:39:31 +02:00
Grégoire Paris
18366db578 Remove reference to JoinColumns
While that class can be an annotation, it cannot be an attribute because
it is not necessary when using attributes.

See https://github.com/doctrine/orm/issues/9986
2022-10-05 21:38:38 +02:00
Grégoire Paris
95c818928e Merge pull request #10098 from greg0ire/deprecate-annotations 2022-10-05 13:37:57 +02:00
Grégoire Paris
f27034880a Remove trailing whitespace 2022-10-05 12:24:53 +02:00
Grégoire Paris
3735822662 Deprecate annotation driver
No new project should use that driver.
2022-10-05 12:24:53 +02:00
Grégoire Paris
52f7ddc680 Use appropriate directive 2022-10-05 09:46:43 +02:00
Grégoire Paris
41fd9816e8 Merge remote-tracking branch 'origin/2.14.x' into 3.0.x 2022-10-04 23:38:17 +02:00
Grégoire Paris
de32d8239f Merge pull request #10089 from greg0ire/remove-unneeded-checks
Document properties as possibly null
2022-10-04 23:28:01 +02:00
Grégoire Paris
1b5bef3d4d Merge pull request #10094 from doctrine/fix_doc_toc 2022-10-04 15:55:16 +02:00
Christophe Coevoet
880b622fe6 Fix heading levels for the embeddable tutorial 2022-10-04 14:13:44 +02:00
Grégoire Paris
397751ee65 Update Psalm baseline 2022-10-03 21:41:04 +02:00
Grégoire Paris
b0038eeea6 Document properties as possibly null
__sleep() does not list these properties as suposed to be serialized.
This means we have to assert that it is not in the many scenarios where
we resort to these properties. Introducing a private method allows us to
centralize the assertions.
2022-10-03 21:41:03 +02:00
Grégoire Paris
f06f9f843e Merge pull request #10093 from doctrine/2.13.x
Merge 2.13.x up in 2.14.x
2022-10-03 21:40:34 +02:00
Grégoire Paris
cbf141f7ed Add missing variable name in param phpdoc and switch to psalm-assert (#10092)
* Add missing variable name in param phpdoc

* Use psalm-assert instead of psalm-param

The parameter can in fact be any string, but if an exception is not
thrown, then it was a valid value.
2022-10-03 21:17:21 +02:00
Grégoire Paris
5d3fc62023 Merge pull request #10086 from franmomu/create_specific_event_classes
Create dedicated event argument classes
2022-10-02 21:49:09 +02:00
Grégoire Paris
154e7130f5 Merge pull request #10091 from doctrine/2.13.x
Merge 2.13.x up into 2.14.x
2022-10-02 16:54:10 +02:00
Grégoire Paris
536bb4f678 Merge pull request #10090 from greg0ire/update-psalm-baseline
Update Psalm baseline
2022-10-02 16:23:14 +02:00
Grégoire Paris
3f2f42277e Update Psalm baseline 2022-10-02 16:02:57 +02:00
Fran Moreno
99f044cbc7 Deprecate LifecycleEventArgs 2022-10-01 14:39:31 +02:00
Fran Moreno
e8ca7b4abf Add dedicated classes for events 2022-10-01 14:39:31 +02:00
Grégoire Paris
5abe6a5875 Merge pull request #10083 from greg0ire/3.0.x
Merge 2.14.x up into 3.0.x
2022-09-30 23:07:19 +02:00
Grégoire Paris
e308b0aee1 Merge remote-tracking branch 'origin/2.14.x' into 3.0.x 2022-09-30 20:02:02 +02:00
Grégoire Paris
b05fb96ad3 Merge pull request #10070 from greg0ire/preview-coll-2
Add support for doctrine/collection 2
2022-09-29 23:30:59 +02:00
Grégoire Paris
bb020320ca Allow collections 2 2022-09-29 23:08:43 +02:00
Grégoire Paris
1e0ac8899c Merge pull request #10079 from doctrine/2.13.x
Merge 2.13.x up into 2.14.x
2022-09-29 23:07:20 +02:00
Grégoire Paris
757d950128 Merge pull request #10080 from greg0ire/add-missing-template-annotation
Address changes from doctrine/collections 1.8.0
2022-09-29 22:58:03 +02:00
Grégoire Paris
f07840b10c Address changes from doctrine/collections 1.8.0
Not quite sure why this annotation is not inherited.
2022-09-29 17:07:57 +02:00
Grégoire Paris
38b1fee344 Merge pull request #10048 from greg0ire/php8-migration
Migrate QueryBuilder / ClassMetadataInfo
2022-09-27 23:45:04 +02:00
Grégoire Paris
6e8afeeb60 Merge pull request #10072 from greg0ire/fix-return-type 2022-09-27 13:50:49 +02:00
Grégoire Paris
9130b27aca Remove return type override
In the parent class, all 3 methods are documented to return mixed.
This was not forward compatible with the addition of return types.
2022-09-27 13:41:09 +02:00
Grégoire Paris
75a7cc983c Migrate ClassMetadataInfo to PHP 8.1 2022-09-27 08:45:54 +02:00
Grégoire Paris
2e7c2bb385 Merge pull request #10058 from HypeMC/enum-with-query-builder-fix
Fix using enums with the QueryBuilder
2022-09-23 22:08:15 +02:00
HypeMC
d69a0fa2cf Fix using enums with the QueryBuilder 2022-09-22 22:39:52 +02:00
Grégoire Paris
d62359a009 Migrate QueryBuilder to PHP 8.1 2022-09-22 17:50:12 +02:00
Grégoire Paris
745250942f Merge remote-tracking branch 'origin/2.14.x' into 3.0.x 2022-09-22 16:26:14 +02:00
Grégoire Paris
4a04c8c2db Merge pull request #10055 from doctrine/2.13.x
Merge 2.13.x up into 2.14.x
2022-09-22 15:49:21 +02:00
Grégoire Paris
a8b02fd70f Merge pull request #10054 from greg0ire/sa-fixes 2022-09-22 15:36:43 +02:00
Alexander M. Turek
f32ae29385 Add types to PersisterHelper (#10053) 2022-09-22 15:34:46 +02:00
Alexander M. Turek
60adc6b7d9 Fix CS 2022-09-22 12:06:40 +02:00
Alexander M. Turek
c65ff6651c Merge branch '2.13.x-enum-arrayhydration' into 2.13.x
* 2.13.x-enum-arrayhydration:
  Fix ArrayHydration of enums
2022-09-22 12:04:22 +02:00
Alexander M. Turek
5f29fcdea2 Revert "Fix EnumType not being hydrated with HYDRATE_ARRAY (#9995)"
This reverts commit bb3ce7e802.
2022-09-22 12:04:09 +02:00
Grégoire Paris
470e2ddd05 Merge pull request #10045 from nicolas-grekas/proxy-common-less 2022-09-22 11:29:02 +02:00
Alexander M. Turek
ffd47ce2dd Add types to mapping builders (#10052) 2022-09-22 11:24:05 +02:00
Nicolas Grekas
6ec5ab9145 Deprecate Doctrine\ORM\Proxy\Proxy and decouple a bit more from Doctrine\Common\Proxy 2022-09-22 09:56:30 +02:00
Grégoire Paris
2b8ac15813 Mark ClassMetadataInfo::sequenceGeneratorDefinition as nullable 2022-09-22 09:12:50 +02:00
Alexander M. Turek
a3ec3f368f Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  PHPStan 1.8.5, Psalm 4.27.0 (#10033)
  Fix EnumType not being hydrated with HYDRATE_ARRAY (#9995)
  "Strange" return lines in documentation of inheritance-mapping.rst (#10027)
  More strange break lines in inheritance-mapping.rst (#10028)
  Add phpdoc for discriminatorColumn
2022-09-22 08:52:01 +02:00
Alexander M. Turek
86000d9c70 Merge 2.13.x into 2.14.x (#10051) 2022-09-22 08:41:04 +02:00
Grégoire Paris
57054caca5 Merge pull request #10050 from greg0ire/fix-dbal-build
Fix dbal 4 build
2022-09-22 00:09:16 +02:00
Grégoire Paris
965de8b742 Address AbstractSchemaManager::createSchema() removal 2022-09-21 23:54:39 +02:00
Grégoire Paris
1479848714 Specify precision for decimal columns
doctrine/dbal 4 no longer provides a default value for that column
option.
2022-09-21 23:30:11 +02:00
Grégoire Paris
6dd07e4c76 Merge pull request #9983 from VincentLanglet/discriminatorColumn
Add phpdoc for ClassMetadataInfo::discriminatorColumn property
2022-09-21 23:17:54 +02:00
Alexander M. Turek
328bf707cc Merge 2.13.x into 2.14.x (#10046) 2022-09-18 15:20:51 +02:00
Alexander M. Turek
0d043059b9 PHPStan 1.8.5, Psalm 4.27.0 (#10033) 2022-09-18 15:06:51 +02:00
Ilya Shashilov
bb3ce7e802 Fix EnumType not being hydrated with HYDRATE_ARRAY (#9995)
Co-authored-by: Ilya Shashilov <kvushiha@gmail.com>
2022-09-14 14:33:42 +02:00
Tomas
bc7e252f00 Fix ArrayHydration of enums 2022-09-12 17:01:40 +02:00
Carlos Buenosvinos
498da2ff98 "Strange" return lines in documentation of inheritance-mapping.rst (#10027) 2022-09-04 18:16:02 +02:00
Carlos Buenosvinos
73e1e42ab5 More strange break lines in inheritance-mapping.rst (#10028) 2022-09-03 21:40:53 +02:00
Alexander M. Turek
5fe78f7892 Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Bump Ubuntu version and shared workflows (#10020)
  Make paginator covariant (#10002)
  Fail gracefully if EM could not be constructed in tests (#10008)
2022-08-31 00:01:28 +02:00
Alexander M. Turek
7a9037e9d7 Merge branch '2.13.x' into 2.14.x
* 2.13.x:
  Bump Ubuntu version and shared workflows (#10020)
  Fail gracefully if EM could not be constructed in tests (#10008)
2022-08-30 21:22:58 +02:00
Alexander M. Turek
5d11648767 Bump Ubuntu version and shared workflows (#10020) 2022-08-30 21:10:38 +02:00
Vincent Langlet
8d03f8f089 Make paginator covariant (#10002) 2022-08-30 13:43:14 +02:00
Alexander M. Turek
0ecac1b255 Fail gracefully if EM could not be constructed in tests (#10008) 2022-08-30 13:40:54 +02:00
Grégoire Paris
cdd79bc764 Merge commit '8dfe8b878' into 3.0.x 2022-08-29 23:18:19 +02:00
Grégoire Paris
52b96538b7 Merge pull request #10011 from greg0ire/cs10-on-3.0
Upgrade to doctrine/coding-standard 10.0 on 3.0.x
2022-08-29 23:16:43 +02:00
Grégoire Paris
4aa3c630df Address DBAL deprecations
- listTableDetails() has been deprecated in favor of introspectTable().
- createSchema() has been deprecated in favor of introspectSchema().
2022-08-29 23:03:28 +02:00
Grégoire Paris
883c8c443f Update baseline 2022-08-29 22:29:28 +02:00
Grégoire Paris
1d3c6d6eb8 Adjust CPP migration 2022-08-29 22:29:28 +02:00
Grégoire Paris
4dcaa2c23b Improve PHPDoc for WhereClause::$conditionalExpression 2022-08-29 22:29:28 +02:00
Grégoire Paris
21e142b9a5 Revert changes that cause test failures 2022-08-29 22:29:28 +02:00
Grégoire Paris
3cd2562626 Upgrade to doctrine/coding-standard 10.0 2022-08-29 22:29:28 +02:00
Grégoire Paris
8dfe8b8782 Merge pull request #10010 from doctrine/2.13.x
Merge 2.13.x up into 2.14.x
2022-08-27 21:07:59 +02:00
Grégoire Paris
b2a4fac40b Merge pull request #10009 from greg0ire/cs-update
Upgrade to doctrine/coding-standard 10.0.0
2022-08-27 20:53:59 +02:00
Grégoire Paris
beeba93a53 Upgrade to doctrine/coding-standard 10.0.0 2022-08-27 19:04:47 +02:00
Alexander M. Turek
28b5dfdb84 Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Bump coding standard to 9.0.2
  Fix tests for doctrine/common 3.4
  Fix static analysis errors for Collections 1.7
  Fix type in docs (#9994)
  Improve orphan removal documentation - recommend using cascade=persist  (#9848)
2022-08-26 13:12:51 +02:00
Alexander M. Turek
4c253f2403 Merge pull request #10006 from derrabus/fix/build
Fix build
2022-08-26 13:07:34 +02:00
Alexander M. Turek
46ec86557e Bump coding standard to 9.0.2 2022-08-26 12:27:20 +02:00
Alexander M. Turek
f287b74470 Fix tests for doctrine/common 3.4 2022-08-26 00:34:50 +02:00
Alexander M. Turek
12d086551e Fix static analysis errors for Collections 1.7 2022-08-26 00:09:37 +02:00
Alberto Acha
5283e1441c Fix type in docs (#9994) 2022-08-16 20:40:01 +02:00
Michael Olšavský
18be6d2218 Improve orphan removal documentation - recommend using cascade=persist (#9848)
* Improve orphanRemoval documentation

* Wording improvement

* Update docs/en/reference/working-with-associations.rst

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>
2022-08-09 21:39:43 +02:00
Vincent Langlet
2fda625dba Add phpdoc for discriminatorColumn 2022-08-08 22:34:18 +02:00
Alexander M. Turek
41bca04103 Add types to EntityListenerResolver (#9976) 2022-08-08 22:02:40 +02:00
Alexander M. Turek
7abeb9bf00 Merge branch '2.14.x' into 3.0.x
* 2.14.x:
  Backport type fixes for EntityListenerResolver (#9977)
  Undeprecate LifecycleEventArgs (#9980)
  Update documentation to not use deprecated method (#9979)
2022-08-08 21:41:43 +02:00
Alexander M. Turek
7c4442561f Add types to Node::dispatch() (#9978) 2022-08-08 21:30:51 +02:00
Alexander M. Turek
35c44a5667 Backport type fixes for EntityListenerResolver (#9977) 2022-08-08 11:00:16 +02:00
Fran Moreno
0215b6b9fb Undeprecate LifecycleEventArgs (#9980)
Deprecating this class means that users using SA tools have to
update their code specifying the ObjectManager implementation.

Instead of this, dedicated classes for each event should be
created before deprecating this class.
2022-08-08 10:59:03 +02:00
Fran Moreno
cc9272f53f Update documentation to not use deprecated method (#9979) 2022-08-08 07:46:05 +00:00
Alexander M. Turek
7e45006300 Update Psalm config (#9974) 2022-08-07 22:35:19 +02:00
Alexander M. Turek
c39cbf15be Add types to ProxyFactory (#9962) 2022-08-07 21:37:36 +02:00
Alexander M. Turek
9e304fbe69 Merge 2.14.x into 3.0.x (#9973) 2022-08-07 20:13:52 +02:00
Alexander M. Turek
e3e7f3c209 Update branch metadata (#9971) 2022-08-07 19:56:19 +02:00
Alexander M. Turek
c9870a3d82 Remove calls to deprecated Type::getName() (#9972) 2022-08-07 19:55:23 +02:00
Alexander M. Turek
f9257cdf78 Flag QueryType as internal (#9963) 2022-08-07 19:22:03 +02:00
Alexander M. Turek
0e074e407a Stabilize the DBAL dependency (#9968) 2022-08-07 18:42:52 +02:00
Alexander M. Turek
71cba3d1fe Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  Address DBAL 3.4 deprecations (#9969)
  Improve phpdoc for ClassMetadataInfo (#9965)
  Fix build (#9964)
  fix: class normalisation test (#9966)
  Support native enum hydration when using `NEW` operator (#9936)
2022-08-07 18:22:43 +02:00
Alexander M. Turek
827cb0c10b Address DBAL 3.4 deprecations (#9969) 2022-08-07 18:11:43 +02:00
Vincent Langlet
4d19c0ea71 Improve phpdoc for ClassMetadataInfo (#9965) 2022-08-07 16:00:01 +00:00
Alexander M. Turek
17cfb944f2 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Fix build (#9964)
  fix: class normalisation test (#9966)
2022-08-07 17:39:22 +02:00
Alexander M. Turek
78d08584f1 Fix build (#9964) 2022-08-07 17:31:32 +02:00
Adrien Foulon
f7e202f3ed fix: class normalisation test (#9966) 2022-08-07 17:07:36 +02:00
Alexander M. Turek
23f5c016cf Resolve QueryBuilder deprecations (#9953) 2022-08-04 22:51:21 +02:00
Alexander M. Turek
1a82e4a294 Drop unmaintained Symfony versions (#9957) 2022-08-04 08:29:29 +02:00
Alexander M. Turek
a0be22b65f Use intersection types in tests (#9959) 2022-08-04 08:28:50 +02:00
Alexander M. Turek
6e5626bbff Flag properties as readonly if possible (#9956) 2022-08-04 08:27:02 +02:00
Romain Canon
33f4db8405 Support native enum hydration when using NEW operator (#9936)
Using the `NEW` operator with the query builder now properly converts
scalar values to native enums inside data transfer objects.
2022-08-04 00:33:46 +02:00
Alexander M. Turek
6e6b81dcdf Remove obsolete PHP version checks (#9954) 2022-08-04 00:12:00 +02:00
Alexander M. Turek
3c19eb6de2 Require PHP 8.1 (#9925) 2022-08-03 23:01:41 +02:00
Alexander M. Turek
309e48ad54 Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  Deprecate QueryBuilder APIs exposing its internal state (#9945)
  Update branch info in README and .doctrine-project.json (#9943)
  Psalm 4.25.0, PHPStan 1.8.2 (#9941)
  Stop passing event manager to constructor (#9938)
  Use a more precise phpdoc for ClassMetadataInfo::versionField than mixed (#9937)
  Make EntityManager `@final` and its constructor public
2022-08-03 22:48:03 +02:00
Alexander M. Turek
ef82567730 Fix DBAL 4 compatibility (#9950) 2022-08-03 17:05:42 +02:00
Alexander M. Turek
fa63a395cc Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Update branch info in README and .doctrine-project.json (#9943)
2022-08-02 22:35:33 +02:00
Alexander M. Turek
2ec2c585b0 Deprecate QueryBuilder APIs exposing its internal state (#9945)
Co-authored-by: Sergei Morozov <morozov@tut.by>
2022-08-01 11:42:24 +02:00
Alexander M. Turek
c8025dc4f8 Update branch info in README and .doctrine-project.json (#9943) 2022-07-31 14:53:31 +02:00
Alexander M. Turek
cd95b2a9e5 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Psalm 4.25.0, PHPStan 1.8.2 (#9941)
  Use a more precise phpdoc for ClassMetadataInfo::versionField than mixed (#9937)
2022-07-28 19:38:58 +02:00
Alexander M. Turek
8bfe20073b Psalm 4.25.0, PHPStan 1.8.2 (#9941) 2022-07-28 19:35:26 +02:00
Grégoire Paris
38a9a1c795 Stop passing event manager to constructor (#9938)
Co-authored-by: Alexander M. Turek <me@derrabus.de>
2022-07-28 16:47:04 +00:00
Grégoire Paris
61cc67e4b7 Merge pull request #9940 from greg0ire/php8-migration
Migrate UnitOfWork to PHP 8
2022-07-28 18:40:56 +02:00
Grégoire Paris
0c2d1df424 Migrate Configuration class to PHP 8 again 2022-07-28 17:06:29 +02:00
Grégoire Paris
35afdb1c84 Migrate UnitOfWork to PHP 8 2022-07-28 16:16:49 +02:00
Grégoire Paris
2ebe18a822 Merge pull request #9915 from nicolas-grekas/pub-em 2022-07-28 14:55:34 +02:00
Vincent Langlet
9b37541b3b Use a more precise phpdoc for ClassMetadataInfo::versionField than mixed (#9937) 2022-07-27 23:23:43 +02:00
Nicolas Grekas
518d7f2ef1 Make EntityManager @final and its constructor public 2022-07-27 17:15:40 +02:00
Alexander M. Turek
a3a8caae51 Split TreeWalker and SqlWalker (#9551) 2022-07-25 22:27:45 +02:00
Alexander M. Turek
5830736537 Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  Add helper function TreeWalkerAdapter::getMetadataForDqlAlias() (#9932)
  Simplify LanguageRecognitionTest (#9930)
  test/added test for foreign keys with custom id object types
  Widen types for DiscriminatorMap (#9922)
  schema tool: remove useless text from --dump-sql output
  Update IdentifierFlattener.php
  Update IdentifierFlattener.php
2022-07-25 20:59:42 +02:00
Alexander M. Turek
7684cea8ef Add helper function TreeWalkerAdapter::getMetadataForDqlAlias() (#9932) 2022-07-25 20:54:31 +02:00
Alexander M. Turek
5085dbe94b Merge 2.12.x into 2.13.x (#9931) 2022-07-25 18:49:29 +02:00
Alexander M. Turek
6c64bc6067 Simplify LanguageRecognitionTest (#9930) 2022-07-25 16:14:07 +02:00
Grégoire Paris
f5246bdedd Merge pull request #9927 from rdey/patch-1
GH9335: Fix for bug with objects as foreign keys
2022-07-24 15:21:28 +02:00
Louise Zetterlund
705dc6fbda test/added test for foreign keys with custom id object types 2022-07-22 18:41:35 +02:00
Alexander M. Turek
faedb90ffa Widen types for DiscriminatorMap (#9922)
* Allow integers as keys for DiscriminatorMap

* Widen types for DiscriminatorMap
2022-07-21 10:19:42 +02:00
Alexander M. Turek
0bfdbe1e2c Add native types to QuoteStrategy classes (#9923) 2022-07-21 10:16:31 +02:00
Alexander M. Turek
d41c4c6cc6 Adjust casing of SQLitePlatform for DBAL 4 (#9924) 2022-07-20 22:14:27 +00:00
Grégoire Paris
2da28703e3 Merge pull request #9903 from glaszig/fix/dump-sql
schema tool: remove useless text from --dump-sql output
2022-07-19 23:13:51 +02:00
glaszig
20cec8ed79 schema tool: remove useless text from --dump-sql output
the description and semantics of the `--dump-sql` switch
indicate and sql dump. without that useless line

  The following SQL statements will be executed:

the output can actually be used to generate a plain
dump.sql file that can be fed into sql command-
consuming programs.

resolves #8263 and #7186.
2022-07-19 19:33:48 +00:00
Grégoire Paris
2550417804 Merge pull request #9900 from greg0ire/php8-migration
Migrate part of the tools namespace to PHP8 syntax
2022-07-19 20:17:46 +02:00
Grégoire Paris
c44db2cc35 Fulfill ReturnTypeWillChange prophecy 2022-07-19 08:45:48 +02:00
Grégoire Paris
660cb3b6ac Migrate part of the tools namespace to PHP 8 syntax 2022-07-19 08:43:30 +02:00
Grégoire Paris
ad12df8fcc Remove unused exception 2022-07-19 08:43:30 +02:00
Grégoire Paris
b7ff742f84 Throw on error
That way we have some level of error handling, and don't muddy the
return type.
2022-07-19 08:43:29 +02:00
Grégoire Paris
220bfa1da5 Merge pull request #9911 from craigfrancis/3.0.x
Show Expr::countDistinct() and Expr::concat() use variable-length argument lists
2022-07-18 23:36:00 +02:00
Grégoire Paris
80188edbdd Merge remote-tracking branch 'origin/2.13.x' into 3.0.x 2022-07-18 23:06:06 +02:00
Grégoire Paris
c125a856d0 Merge pull request #9914 from greg0ire/fix-build
Avoid supportsCreateDropDatabase()
2022-07-18 23:00:38 +02:00
Grégoire Paris
d7db596cb4 Avoid supportsCreateDropDatabase()
It has been deprecated.
2022-07-18 22:42:13 +02:00
Craig Francis
0f98b3d9f2 Update Expr::countDistinct() and Expr::concat() to variable-length argument lists 2022-07-18 21:05:20 +01:00
Grégoire Paris
3a9aa5b8c6 Merge pull request #9910 from doctrine/2.12.x
Merge 2.12.x up into 2.13.x
2022-07-18 21:31:50 +02:00
Grégoire Paris
99d9c46bde Add tests for SQL output feature (#9907)
It is not covered yet, and that makes contributions to these commands
hard.
2022-07-18 21:28:17 +02:00
Grégoire Paris
61d405162f Merge pull request #9906 from franmomu/deprecate_lifecycleevent
Deprecate `LifecycleEventArgs`
2022-07-17 17:35:37 +02:00
Fran Moreno
b0f15e070d Deprecate LifecycleEventArgs
Use LifecycleEventArgs from doctrine/persistence instead.
2022-07-17 12:06:10 +02:00
Grégoire Paris
0b9fb97557 Merge pull request #9851 from greg0ire/php8-migration
Migrate more code to PHP8
2022-07-14 19:49:14 +02:00
Grégoire Paris
214a912b37 Migrate more code to PHP8 2022-07-14 19:26:22 +02:00
Grégoire Paris
fbb7e24594 Merge pull request #9895 from greg0ire/avoid-sql-assertions
Avoid SQL assertions
2022-07-14 19:09:32 +02:00
Grégoire Paris
990a1fe952 Merge pull request #9885 from greg0ire/fix-build 2022-07-13 12:10:19 +02:00
Grégoire Paris
1ac9d52332 Ignore errors caused by nullable assets filter 2022-07-12 20:24:19 +02:00
Grégoire Paris
1fa1e7072b Address removal/deprecation of ArrayType/ObjectType 2022-07-12 20:24:19 +02:00
Grégoire Paris
68dc5fe901 Rely on platform options
Custom schema options have been removed in doctrine/dbal 4
2022-07-12 20:24:19 +02:00
Grégoire Paris
db9c43feea Merge remote-tracking branch 'origin/2.13.x' into fix-build 2022-07-12 20:24:16 +02:00
Grégoire Paris
888a4a8eff Avoid SQL assertions
doctrine/dbal is the component responsible for generating the queries.
Let us make the test suite more robust by asserting that things work
from a functional point of view.
2022-07-12 08:01:19 +02:00
Grégoire Paris
48b4f63f61 Merge pull request #9893 from greg0ire/2.13.x
Merge 2.12.x up into 2.13.x
2022-07-10 23:18:39 +02:00
Grégoire Paris
4a62b661a5 Merge remote-tracking branch 'origin/2.12.x' into 2.13.x 2022-07-10 23:07:44 +02:00
Grégoire Paris
ab4844b82a Merge pull request #9892 from greg0ire/address-array-object-type-deprecation
Address array object type deprecation
2022-07-10 23:05:34 +02:00
Grégoire Paris
00989d6671 Remove SerializationModel from generic model set
It contains fields with deprecated types.
2022-07-10 12:23:05 +02:00
Grégoire Paris
7ed0db0621 Document what we test in test method name 2022-07-10 11:23:22 +02:00
Grégoire Paris
d6dcfbd6f7 Use ::class notation 2022-07-10 11:23:21 +02:00
Grégoire Paris
baf6a394a1 Test invalid mapping file with boolean model
SerializationModel has a field with type array, and another with type
object. Both types are deprecated.
2022-07-10 11:22:46 +02:00
Alexander M. Turek
1538d70bb9 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  PHPStan 1.8.0 (#9887)
  Fix typo in AbstractQuery
  ObjectHydrator: defer initialization of potentially empty collections
  Migrate more usages of SchemaTool::createSchema()
  preUpdate: Add restriction that changed field needs to be in computed changeset (#9871)
2022-07-08 13:54:43 +02:00
Alexander M. Turek
291765e879 PHPStan 1.8.0 (#9887) 2022-07-08 13:53:03 +02:00
Grégoire Paris
f79ec43e70 Merge pull request #9880 from CarlSchwan/patch-1
Fix typo in AbstractQuery
2022-07-06 21:07:32 +02:00
Carl Schwan
306b5f9812 Fix typo in AbstractQuery 2022-07-06 14:06:42 +02:00
Grégoire Paris
68405f3e5b Merge pull request #9876 from franmomu/extend_event_manager_args
Change parent classes in some events
2022-07-04 19:21:56 +02:00
Grégoire Paris
83c1ad2f57 Merge pull request #9870 from popov-a-e/GH-9807
[GH-9807] Fix: initialize potentially empty collections at the hydration complete
2022-07-03 22:25:18 +02:00
Alex Popov
79447cbb18 ObjectHydrator: defer initialization of potentially empty collections
If ObjectHydrator faces an empty row to an uninitialized collection,
it initializes it, to prevent it from querying again (DDC-1526).
However, if that row is the first but not the only in the collection,
the next rows will be ignored, as the collection will be considered
"existing", and "existing" collections are only replaced if REFRESH hint
is present. To prevent it, we defer initialization to the end of the
hydration.

Fixes GH-9807
2022-07-03 13:25:34 +04:00
Fran Moreno
eea53397c5 Change parent classes
*FlushEventArgs classes should extend ManagerEventArgs from
doctrine/persistence to be able to use ManagerEventArgs for any
persistance implementation.

OnClearEventArgs should extend from OnClearEventArgs from
doctrine/persistence.
2022-07-02 14:27:36 +02:00
Grégoire Paris
3295ccfa25 Merge pull request #9874 from greg0ire/migrate-to-csfm
Migrate more usages of SchemaTool::createSchema()
2022-07-02 00:11:41 +02:00
Grégoire Paris
b1419ddc6c Migrate more usages of SchemaTool::createSchema()
When I introduced OrmFunctionalTestCase::createSchemaForModels(), I made
several wrong assumptions:
- the call is always wrapped in a try / catch;
- that try / catch is always typed with "Exception".

Because of that, I missed, many, many occurrences of
SchemaTool::createSchema().

I recently noticed that contributors kept using the
SchemaTool::createSchema() and figured not everything had been
migrated.

Migrating some of them did not result in something far better until I
also introduced similar methods for
SchemaTool::getUpdateSchemaSql() and SchemaTool::getSchemaFromMetadata().
2022-07-01 21:45:45 +02:00
Thomas Landauer
0ef08c5dfb preUpdate: Add restriction that changed field needs to be in computed changeset (#9871) 2022-06-28 23:44:23 +02:00
Alexander M. Turek
9e0c7de24e Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  Psalm 4.24.0, PHPStan 1.7.15 (#9865)
  PHP CodeSniffer 3.7.1, PHPStan 1.7.14 (#9858)
2022-06-28 15:42:44 +02:00
Alexander M. Turek
07fa660a47 Fix broken mocks due to removal of Driver::getSchemaManager() (#9869) 2022-06-28 15:30:59 +02:00
Alexander M. Turek
dc8ddfd3e6 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Psalm 4.24.0, PHPStan 1.7.15 (#9865)
  PHP CodeSniffer 3.7.1, PHPStan 1.7.14 (#9858)
2022-06-28 13:35:26 +02:00
Alexander M. Turek
278bf194ca Psalm 4.24.0, PHPStan 1.7.15 (#9865) 2022-06-28 10:41:20 +02:00
Alexander M. Turek
b9f2488c6c PHP CodeSniffer 3.7.1, PHPStan 1.7.14 (#9858) 2022-06-19 14:48:36 +02:00
Grégoire Paris
734a1c63a2 Merge pull request #9852 from MarcBrillault/internal-php8
Migrate Internal namespace to PHP8
2022-06-18 21:40:27 +02:00
Marc Brillault
e22f02f198 Migrate Internal namespace to PHP8 2022-06-17 19:20:57 +02:00
Alexander M. Turek
318e6ec067 Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  Deprecate omitting the alias in QueryBuilder (#9765)
  Run tests on PHP 8.2 (#9840)
  PHPStan 1.7.13 (#9844)
  Flip conditional extension of legacy AnnotationDriver class (#9843)
  PHP CodeSniffer 3.7 (#9842)
  Make Reflection available to ConvertMappingCommand (#9619)
  Add missing property declaration
  Use proper API for introspection of tables
2022-06-17 10:42:13 +02:00
Hans Mackowiak
b931a59ebc Deprecate omitting the alias in QueryBuilder (#9765)
… methods update() and delete()

Co-authored-by: Alexander M. Turek <me@derrabus.de>
2022-06-17 10:33:11 +02:00
Alexander M. Turek
d15eef9051 Merge release 2.12.3 into 2.13.x (#9853) 2022-06-17 10:22:16 +02:00
Alexander M. Turek
c05e1709e9 Run tests on PHP 8.2 (#9840) 2022-06-16 15:42:23 +02:00
Alexander M. Turek
6e31758c7b PHPStan 1.7.13 (#9844) 2022-06-15 11:11:24 +02:00
Grégoire Paris
af1303ec96 Merge pull request #9835 from greg0ire/php8-configuration
Migrate Configuration to PHP 8 syntax
2022-06-15 07:33:19 +02:00
Grégoire Paris
5ecf9e9202 update psalm baseline 2022-06-14 15:03:06 +02:00
Grégoire Paris
d52f9ee87e Migrate Configuration to PHP 8 syntax 2022-06-14 15:01:25 +02:00
Alexander M. Turek
eff540a996 Flip conditional extension of legacy AnnotationDriver class (#9843) 2022-06-13 20:10:37 +02:00
Alexander M. Turek
33d74e2e48 PHP CodeSniffer 3.7 (#9842) 2022-06-13 19:19:15 +02:00
bartholdbos
09ff36cda0 Make Reflection available to ConvertMappingCommand (#9619) 2022-06-13 17:30:08 +02:00
Grégoire Paris
e30426cbc0 Merge pull request #9841 from derrabus/bugfix/dynamic-property
Add missing property declaration
2022-06-12 16:55:59 +02:00
Alexander M. Turek
e9135b86e0 Add missing property declaration 2022-06-12 14:25:39 +02:00
Grégoire Paris
5ccb59fa02 Merge pull request #9839 from morozov/list-tables
Use proper API for introspection of tables
2022-06-11 22:41:41 +02:00
Sergei Morozov
2e927970ca Use proper API for introspection of tables 2022-06-11 12:13:25 -07:00
Grégoire Paris
78c9490212 Merge pull request #9838 from greg0ire/remove-identity-columns-emulation
Stop allowing identity columns emulation
2022-06-11 18:10:45 +02:00
Grégoire Paris
2d230ce033 Stop allowing identity columns emulation
That feature has been deprecated.
2022-06-10 21:14:10 +02:00
Grégoire Paris
894dc4fc8f Merge pull request #9836 from greg0ire/3.0.x
Merge 2.13.x up into 3.0.x
2022-06-10 21:00:51 +02:00
Grégoire Paris
ec6ada4935 Merge remote-tracking branch 'origin/2.13.x' into 3.0.x 2022-06-10 20:14:33 +02:00
Grégoire Paris
0366a5796f Merge pull request #9837 from greg0ire/address-getdbplatform-deprecation
Address deprecation of getDatabasePlatform()
2022-06-10 20:14:06 +02:00
Grégoire Paris
93f7e78a14 Address deprecation of getDatabasePlatform() 2022-06-10 19:57:50 +02:00
Grégoire Paris
d99e64c05e Merge pull request #9833 from greg0ire/deprecate-sequence-based-ig 2022-06-10 10:09:33 +02:00
Grégoire Paris
646cbf6d30 Merge pull request #9828 from MarcBrillault/schema-validator-php8
migrate Tools/Schema* to php8.0
2022-06-10 09:12:06 +02:00
Grégoire Paris
47d9d46304 Merge pull request #9834 from doctrine/2.13.x
Merge 2.13.x up into 3.0.x
2022-06-10 00:01:53 +02:00
Grégoire Paris
9efeefb913 Merge pull request #9826 from greg0ire/improve-phpdoc-configuration
Improve phpdoc for Configuration
2022-06-09 23:53:12 +02:00
Grégoire Paris
3f8430459c Deprecate reliance on sequence-emulated identity columns
Sequence-based identity values have been deprecated.
2022-06-09 23:46:50 +02:00
Grégoire Paris
2f16062f78 Merge pull request #9832 from greg0ire/enable-test-dbal-4
Run test with DBAL 4
2022-06-09 21:32:32 +02:00
Marc Brillault
e22bfec6b6 migrate Tools/Schema* to php8.0
refs #9772
2022-06-09 21:19:18 +02:00
Grégoire Paris
bf24177bfd Run test with DBAL 4 2022-06-09 21:16:36 +02:00
Grégoire Paris
62eb3bd96c Merge pull request #9829 from MarcBrillault/fix-build
Address removals of doctrine-dbal
2022-06-09 21:12:23 +02:00
Grégoire Paris
e1ebd77811 Run test only with DBAL 3
With DBAL 4, there is no longer a filtering of assets.
2022-06-09 19:40:41 +02:00
Grégoire Paris
69253bc083 Use a better check for the DBAL version
It seems AbstractPlatform::getGuidExpression() cannot do the trick, as
it is missing from both branches.
2022-06-09 19:40:41 +02:00
Grégoire Paris
36b35f99a4 Run foreign key tests on all platforms
SQLite now supports foreign keys.
2022-06-09 17:14:36 +02:00
Marc Brillault
a91d208d10 Address removals of doctrine-dbal
- Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets
- Doctrine\DBAL\Schema\Schema::visit
- Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand
2022-06-09 17:14:14 +02:00
Grégoire Paris
5f12b8f7de Remove uneeded rule form baseline 2022-06-09 08:13:54 +02:00
Grégoire Paris
f949b9d212 Improve phpdoc for Configuration 2022-06-09 08:09:41 +02:00
Grégoire Paris
2bc0be6fa9 Merge remote-tracking branch 'origin/2.12.x' into 2.13.x 2022-06-09 07:47:32 +02:00
Grégoire Paris
3dc5581294 Merge pull request #9818 from greg0ire/fix-wrong-type-config
Document missing possible types
2022-06-09 07:23:43 +02:00
Grégoire Paris
7bf2c4c8d1 Merge pull request #9823 from greg0ire/fix-build 2022-06-08 14:39:31 +02:00
Grégoire Paris
c81776ad12 Backport fixes from upstream branch
Not all of 01fb82b497 was ported, only
what is necessary to fix the build.
2022-06-08 13:26:35 +02:00
Grégoire Paris
d9c6f86627 Document missing possible types 2022-06-04 18:16:35 +02:00
Grégoire Paris
89dd9dd9ed Merge pull request #9815 from greg0ire/fix-deprecation-fk
Address deprecation of supportsForeignKeyConstraints()
2022-06-03 21:43:15 +02:00
Grégoire Paris
068da9d89f Address deprecation of supportsForeignKeyConstraints()
All platforms are supposed to support foreign key constraints now.
2022-06-03 21:24:19 +02:00
Grégoire Paris
53661fefc9 Merge pull request #9776 from greg0ire/native-types-abstract-query
Migrate to PHP 8: AbstractQuery and child classes
2022-06-03 20:53:45 +02:00
Grégoire Paris
d462ed3b4d Update baseline 2022-06-03 20:51:21 +02:00
Grégoire Paris
4a02a79abb Remove unneeded checks
Both array and ArrayCollection are countable.
2022-06-03 20:51:15 +02:00
Grégoire Paris
2ee4482d00 Remove deprecation when wrong fetch mode is used 2022-06-03 20:51:10 +02:00
Grégoire Paris
9f4339e7dc Run rector 2022-06-03 20:06:39 +02:00
Alexander M. Turek
7e20e97ee0 Remove MockBuilderCompatibilityTools (#9814) 2022-06-03 19:57:49 +02:00
Grégoire Paris
86d23f42db Add native types to AbstractQuery 2022-06-03 19:57:23 +02:00
Alexander M. Turek
b8299feae0 Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  PHPStan 1.7.9 (#9812)
  Remove empty test file (#9805)
  Remove calls to deprecated MockBuilder::setMethods() (#9808)
  Deprecate passing null to Query::setFirstResult()
  Rename Abstract*Test to *TestCase (#9806)
  Add primary key on temp table (#9770)
  Fix wrong types (#9802)
  Widen return type
  Update baseline
  Fix
  Add type for AssociationMapping
2022-06-03 13:36:16 +02:00
Alexander M. Turek
ddede4064c Merge 2.12.x into 2.13.x (#9811) 2022-06-03 13:22:41 +02:00
Alexander M. Turek
67d82cdf72 PHPStan 1.7.9 (#9812) 2022-06-03 13:11:19 +02:00
Alexander M. Turek
744f0b5983 Remove empty test file (#9805) 2022-06-03 07:53:13 +02:00
Grégoire Paris
1d02289481 Merge pull request #9809 from greg0ire/disallow-null-setFirstResult
Deprecate passing null to Query::setFirstResult()
2022-06-03 07:51:04 +02:00
Alexander M. Turek
4bd0f974ab Remove calls to deprecated MockBuilder::setMethods() (#9808) 2022-06-02 23:48:47 +02:00
Grégoire Paris
d0c582ca48 Deprecate passing null to Query::setFirstResult()
The argument is cast to an integer, so the user might as well pass 0
instead, and we can require an integer.
2022-06-02 22:29:01 +02:00
Alexander M. Turek
cc6cc26f18 Rename Abstract*Test to *TestCase (#9806) 2022-06-02 16:33:33 +02:00
wiseguy1394
768e2f3816 Add primary key on temp table (#9770)
* add primary key on temp table;fixes doctrine/orm#9768

* use all ID Columns in primary key
2022-06-02 16:08:22 +02:00
Grégoire Paris
ec03eb3451 Merge pull request #9800 from greg0ire/rector-tests
Migrate tests to PHP8 syntax
2022-06-02 08:36:34 +02:00
Grégoire Paris
4117209b69 Revert to normal properties
The order is not the same as in the constructor, and that seems to
matter.
2022-06-02 07:24:48 +02:00
Grégoire Paris
a870290575 Add test to exclude rule 2022-06-02 07:24:48 +02:00
Grégoire Paris
e7a466b708 fix cs 2022-06-02 07:24:48 +02:00
Grégoire Paris
deb5f49413 Merge pull request #9804 from greg0ire/2.13.x
Merge 2.12.x up into 2.13.x
2022-06-02 07:14:42 +02:00
Grégoire Paris
52ce39f595 Merge pull request #9801 from greg0ire/widen-types
Widen types
2022-06-02 07:13:58 +02:00
Grégoire Paris
f84ecb2842 Merge pull request #9794 from VincentLanglet/associationMapping
Add type for AssociationMapping
2022-06-01 23:37:00 +02:00
Grégoire Paris
66ae30085b Adjust expectations 2022-06-01 22:51:13 +02:00
Grégoire Paris
c49636c923 Revert to untyped property
This causes "Cannot assign string to property
Doctrine\Tests\Models\Cache\ComplexAction::$action2 of type
Doctrine\Tests\Models\Cache\Action" for some reason.
2022-06-01 22:51:13 +02:00
Grégoire Paris
2f6303faef Revert to untyped property
This causes the following error for some reason:
Typed property Doctrine\Tests\ORM\Functional\TrainOrder::$train must not
be accessed before initialization
2022-06-01 22:51:13 +02:00
Grégoire Paris
8d4c3d3a34 Fix wrong types 2022-06-01 22:51:13 +02:00
Grégoire Paris
d212e52a20 Migrate tests to PHP 8 2022-06-01 22:51:11 +02:00
Grégoire Paris
b2fedaef9e Merge remote-tracking branch 'origin/2.12.x' into 2.13.x 2022-06-01 22:49:10 +02:00
Grégoire Paris
301892bcff Merge remote-tracking branch 'origin/2.13.x' into 3.0.x 2022-06-01 22:44:52 +02:00
Grégoire Paris
21976471a3 Fix wrong types (#9802) 2022-06-01 22:42:51 +02:00
Grégoire Paris
6fb88e1496 Widen return type
This type is so complex that it is not going to bring much value to the
consumer of this method. Let us widen it to mixed.
2022-06-01 19:56:25 +02:00
Sergei Morozov
3ac5f119aa Merge pull request #9799 from morozov/sqlite-fk
Prep work for enabling support for foreign keys on SQLite
2022-06-01 06:19:47 -07:00
Alexander M. Turek
62892dc4e4 Made setters parameters mandatory (#9798) 2022-05-31 07:58:35 +02:00
Sergei Morozov
01fb82b497 Prep work for enabling support for foreign keys on SQLite 2022-05-30 18:45:43 -07:00
Alexander M. Turek
f08aa92da0 Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  Add missing import (#9796)
  Deprecate calling setters without arguments (#9791)
  Move duplicate fixture into dedicated file (#9789)
  MockTreeWalker should be an SqlWalker (#9790)
2022-05-31 00:43:58 +02:00
Alexander M. Turek
4f1072e1ac Add missing import (#9796) 2022-05-31 00:42:03 +02:00
Vincent Langlet
e5fe46a051 Precise phpdoc of getRootEntities (#9778)
* Precise phpdoc of getRootEntities

* Restrict from param

* Prefer phpdoc
2022-05-30 20:43:24 +02:00
Alexander M. Turek
a559563682 Deprecate calling setters without arguments (#9791) 2022-05-30 20:39:06 +02:00
Vincent Langlet
0f9cc194ae Update baseline 2022-05-29 20:27:26 +02:00
Vincent Langlet
2513a1e2b1 Fix 2022-05-29 20:16:12 +02:00
Vincent Langlet
4230214ced Add type for AssociationMapping 2022-05-29 13:17:04 +02:00
Alexander M. Turek
fb1f258736 Move duplicate fixture into dedicated file (#9789) 2022-05-27 15:08:21 +02:00
olegsuvorkov
aae8b43622 Update IdentifierFlattener.php
Fix for coding-standards / Coding Standards (8.1)
2022-05-27 15:35:23 +03:00
Alexander M. Turek
e66fbc434d MockTreeWalker should be an SqlWalker (#9790) 2022-05-27 00:15:30 +02:00
olegsuvorkov
3f4e9e397a Update IdentifierFlattener.php
Hello, I would like to make a small change.
The need arose when using \Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator in "symfony/doctrine-bridge" composite foreign keys
I'm sure these changes will not hurt performance
and allow other objects to be used as identifiers
2022-05-26 10:46:14 +03:00
Alexander M. Turek
0c8808a57a Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  Make phpdoc more precise
  Deprecate setting fetch mode to random integers
  Prepare split of output walkers and tree walkers (#9786)
  PHPStan 1.7.0 (#9785)
  Deprecate passing null to Query::setDQL()
  Kill call_user_func(_array) (#9780)
  Fix wrong types for AbstractQuery and child classes (#9774)
  Document callable as possible
  Remove override phpdoc tag
  Add use statement (#9769)
2022-05-24 21:16:11 +02:00
Grégoire Paris
0f6f752887 Merge pull request #9777 from greg0ire/improve-phpdoc-abstract-query
Make phpdoc more precise for AbstractQuery
2022-05-24 20:42:40 +02:00
Grégoire Paris
c1dd1cfc2c Make phpdoc more precise 2022-05-24 20:42:10 +02:00
Grégoire Paris
3684d236f6 Deprecate setting fetch mode to random integers 2022-05-24 20:42:08 +02:00
Alexander M. Turek
bba6c696f5 Prepare split of output walkers and tree walkers (#9786) 2022-05-24 18:34:40 +00:00
Alexander M. Turek
e02e6f481b Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  PHPStan 1.7.0 (#9785)
2022-05-24 00:43:35 +02:00
Alexander M. Turek
48e4e333c7 PHPStan 1.7.0 (#9785) 2022-05-24 00:41:57 +02:00
Grégoire Paris
507bc514ce Merge pull request #9784 from greg0ire/deprecate-no-op
Deprecate passing null to Query::setDQL()
2022-05-23 22:31:50 +02:00
Grégoire Paris
1ae5de5409 Deprecate passing null to Query::setDQL()
It is a no-op.
2022-05-23 22:11:16 +02:00
Alexander M. Turek
82508956fe Kill call_user_func(_array) (#9780) 2022-05-23 16:28:32 +02:00
Alexander M. Turek
a131878814 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Fix wrong types for AbstractQuery and child classes (#9774)
  Document callable as possible
  Add use statement (#9769)
2022-05-23 11:29:26 +02:00
Grégoire Paris
1f63389065 Fix wrong types for AbstractQuery and child classes (#9774)
* Remove comment about BC

I do not think we actually want to force our users to build an array
collection when they want to use setParameters().

* Make phpdoc more accurate
2022-05-23 11:26:19 +02:00
Grégoire Paris
359dd4ecfb Merge pull request #9779 from greg0ire/fix-config-phpdoc 2022-05-23 11:18:58 +02:00
Grégoire Paris
a0697c9aff Document callable as possible
Custom string functions can either be a class string or a callable
returning the function.
2022-05-23 11:05:16 +02:00
Grégoire Paris
5601c2ce4b Merge pull request #9775 from greg0ire/no-override
Remove override phpdoc tag
2022-05-23 07:48:01 +02:00
Grégoire Paris
1141fe106f Remove override phpdoc tag
Given how little occurrences there are, signalling method overrides with
this tag is probably not something we do everywhere. Besides, it does
not seem to be standard.

See https://docs.phpdoc.org/3.0/guide/references/phpdoc/tags/index.html#tag-reference
2022-05-22 16:28:41 +02:00
Grégoire Paris
9384ca8e20 Merge pull request #9755 from greg0ire/mandatory-class-name-arg
Require new argument to joinColumnName()
2022-05-20 22:00:16 +02:00
Grégoire Paris
5e536ed412 Require new argument to joinColumnName() 2022-05-20 21:53:02 +02:00
Grégoire Paris
8f7701279d Add use statement (#9769)
We are supposed to use the driver from doctrine/persistence, and not the
deprecated one from this package.
2022-05-19 13:16:51 +02:00
Grégoire Paris
bb1fdcfa77 Merge pull request #9767 from greg0ire/3.0.x
Merge 2.13.x up into 3.0.x
2022-05-18 21:05:11 +02:00
Grégoire Paris
b91825bc73 Remove static PHP driver
It is deprecated in favor of its parent class.
2022-05-18 20:58:46 +02:00
Grégoire Paris
e879ce0b12 Merge remote-tracking branch 'origin/2.13.x' into 3.0.x 2022-05-18 08:02:06 +02:00
Grégoire Paris
779f9c36fa Merge pull request #9766 from greg0ire/non-nullable-arg-ns
Document future argument better
2022-05-18 08:00:17 +02:00
Grégoire Paris
0908f92629 Document future argument better
That argument is always provided, so the tests should provide it and the
commented out argument should reflect the future.
2022-05-17 12:09:31 +02:00
Grégoire Paris
c8735de2c1 Merge pull request #9758 from greg0ire/native-types-ns 2022-05-17 11:47:06 +02:00
Grégoire Paris
98cf5836fd Use native type declarations for naming strategies 2022-05-17 09:16:50 +02:00
Grégoire Paris
72810e9c05 Use createSchemaForModels()
This allows to get rid of tearDown(), which contained a special handling
that is no longer necessary since we switched away from explicitely
managed sequences, and caused the test suite to fail.
2022-05-16 22:38:59 +02:00
Grégoire Paris
3404ac174e Merge remote-tracking branch 'origin/2.13.x' into 3.0.x 2022-05-16 22:02:37 +02:00
Grégoire Paris
24badd60fb Merge pull request #9761 from greg0ire/fix-phpdoc-ns
Fix phpdoc and tests for NamingStrategy
2022-05-16 22:00:41 +02:00
Sergei Morozov
f2d794f8bc Merge pull request #9762 from morozov/schema-manager-database-platform
Do not call AbstractSchemaManager::getDatabasePlatform()
2022-05-16 08:31:45 -07:00
Sergei Morozov
7311f77dfe Do not call AbstractSchemaManager::getDatabasePlatform() 2022-05-15 19:25:51 -07:00
Grégoire Paris
16afa45abf Make tests more realistic
These tests were using the fact that some arguments of some methods of
the naming strategy interface are optional or nullable for now to avoid
providing some. In practice, these arguments are always provided, and
that should also be the case in tests.
2022-05-14 17:31:45 +02:00
Grégoire Paris
8b4d25e94f Handle self-refencing entities
When computing a foreign key column name, the referenced column name
may be null in the case of a self referencing entity with join columns
defined in the mapping.
2022-05-14 16:56:19 +02:00
Grégoire Paris
60f59b29ed Merge pull request #9757 from greg0ire/3.0.x
3.0.x
2022-05-12 09:24:53 +02:00
Grégoire Paris
0f7ae0a660 Merge remote-tracking branch 'origin/2.13.x' into 3.0.x 2022-05-12 09:06:58 +02:00
Grégoire Paris
70087782e8 Merge pull request #9756 from greg0ire/more-precise-phpdoc-ns
Document types as they are passed
2022-05-12 09:05:51 +02:00
Grégoire Paris
dbc5a818e0 Document types as they are passed
Some arguments have been added afterwards which was a BC break for
implementing classes. I do not think they should have been introduced as
optional.
2022-05-11 21:36:44 +02:00
Alexander M. Turek
d294e1d453 Add native types to reflection property classes (#9631) 2022-05-11 20:34:49 +02:00
Grégoire Paris
1c97f970eb Merge pull request #9741 from greg0ire/number-aware-only
Make UnderscoreNamingStrategy number-aware only
2022-05-11 20:33:36 +02:00
Grégoire Paris
8117f42634 Make UnderscoreNamingStrategy number-aware only 2022-05-11 20:12:16 +02:00
Alexander M. Turek
e83404e57d Update Psalm baseline 2022-05-11 12:31:17 +02:00
Alexander M. Turek
499409dbc1 Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  Update Psalm baseline (#9751)
  Omit version number in README (#9749)
2022-05-11 12:30:18 +02:00
Alexander M. Turek
31a9c9c49b Update Psalm baseline (#9751) 2022-05-10 16:00:54 +02:00
Alexander M. Turek
125afb8e39 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Omit version number in README (#9749)
2022-05-10 15:08:24 +02:00
Grégoire Paris
3da3becc24 Merge pull request #9750 from doctrine/2.13.x 2022-05-10 11:52:23 +02:00
Grégoire Paris
45e196eb57 Omit version number in README (#9749) 2022-05-10 09:09:20 +02:00
Grégoire Paris
2c30fe6e5b Merge pull request #9748 from doctrine/2.12.x
Merge 2.12.x up into 2.13.x
2022-05-10 08:21:34 +02:00
Grégoire Paris
6757bdf8c6 Deprecate omitting second argument to joinColumnName() (#9747)
* fix headings

* Deprecate omitting second argument to joinColumnName()
2022-05-10 00:37:44 +02:00
Grégoire Paris
eed20ff4dd Better phpdoc tests (#9746)
* Fix inaccurate and imprecise phpdoc

* Remove extra argument

The method signature does not specify it, and it's always set to null.
It looks like this test and its data provider were copy/pasted from the
previous one.

* Specify what concrete class is passed

This is important as the signature of the concrete classes don't
necessarily match the one of the interface. Here, an extra argument that
is only defined in the classes is used.
2022-05-10 00:32:30 +02:00
Sergei Morozov
a711fad058 Merge pull request #9742 from morozov/dbal-4@dev-static-analysis
Run static analysis with DBAL 4@dev
2022-05-08 12:49:49 -07:00
Sergei Morozov
2e856599b3 Run static analysis with DBAL 4@dev 2022-05-08 12:23:35 -07:00
Sergei Morozov
0119d8cbbc Accommodate API changes in the Column class
See https://github.com/doctrine/dbal/pull/3511
2022-05-08 11:54:22 -07:00
Sergei Morozov
d8159b8be2 Suppress known issues related to sequence-based identity generation
See https://github.com/doctrine/orm/issues/8850
2022-05-08 11:50:55 -07:00
Sergei Morozov
10442a7b4e Assert that date interval expressions are numeric strings
See https://github.com/doctrine/dbal/pull/3498
2022-05-08 11:50:55 -07:00
Sergei Morozov
413e2a79fb Separate PHPStan configuration for DBAL 4
See https://github.com/doctrine/dbal/pull/3480
2022-05-08 11:50:24 -07:00
Grégoire Paris
cfb0f7ffa7 Merge pull request #9738 from greg0ire/uuid-traces
Address some deprecations
2022-05-08 11:11:31 +02:00
Sergei Morozov
7e9ef10f67 Merge pull request #9740 from morozov/dbal-4@dev-pgsql
Build with DBAL 4@dev on PostgreSQL
2022-05-07 13:54:52 -07:00
Sergei Morozov
38f3d71a2f Merge pull request #9735 from morozov/dbal-4@dev-mysql
Build with DBAL 4@dev on MySQL and MariaDB
2022-05-07 13:54:37 -07:00
Sergei Morozov
9eba533f7c Build with DBAL 4@dev on PostgreSQL 2022-05-07 12:47:26 -07:00
Sergei Morozov
9acdac02cf Account for DBAL 4 no longer reordering table columns
See https://github.com/doctrine/dbal/pull/4777
2022-05-07 12:45:15 -07:00
Sergei Morozov
dfb7c1cc38 Build with DBAL 4@dev on MySQL and MariaDB 2022-05-07 08:11:56 -07:00
Sergei Morozov
702b491981 Account for DBAL 4 no longer reordering table columns
See https://github.com/doctrine/dbal/pull/4777
2022-05-07 08:11:56 -07:00
Sergei Morozov
44207c1628 Cast port in PHPUnit configuration to int
See https://github.com/doctrine/dbal/pull/2854
2022-05-07 08:11:01 -07:00
Sergei Morozov
85cfd10cae Merge branch '2.13.x' into 3.0.x 2022-05-07 07:59:50 -07:00
Sergei Morozov
636712a928 Merge pull request #9737 from morozov/dbal-4-compatibility
Improve compatibility with DBAL 4 for MySQL, MariaDB and PostgreSQL
2022-05-07 07:42:14 -07:00
Grégoire Paris
6ead3a5cbb Make targetEntity mandatory 2022-05-07 15:47:05 +02:00
Grégoire Paris
e1586ea6cb Remove deprecated class 2022-05-07 15:45:56 +02:00
Grégoire Paris
72d88a2d69 Address deprecations 2022-05-07 15:41:11 +02:00
Grégoire Paris
3f5a1054a8 Remove remnants of UuidGeneratorStrategy 2022-05-07 15:38:41 +02:00
Sergei Morozov
0aa91c7140 Pass sequence name to AbstractPlatform::getDropSequenceSQL()
See https://github.com/doctrine/dbal/pull/4797
2022-05-06 19:15:06 -07:00
Sergei Morozov
c2f3831b85 Specify length for string columns
See https://github.com/doctrine/dbal/pull/3586
2022-05-06 19:15:06 -07:00
Sergei Morozov
2af52f6a18 Inherit parent column length regardless of the type
See https://github.com/doctrine/dbal/pull/3586
2022-05-06 19:15:05 -07:00
Sergei Morozov
0a79ddf344 Cast column length to int in XML annotation driver
See https://github.com/doctrine/dbal/pull/3511
2022-05-06 19:15:05 -07:00
Sergei Morozov
165c8bd6dd Do not use AbstractSchemaManager::dropAndCreateTable()
See https://github.com/doctrine/dbal/pull/4933
2022-05-06 19:15:03 -07:00
Sergei Morozov
134f12f419 Merge pull request #9734 from morozov/dbal-4.0.x-dev
Build with DBAL 4@dev on SQLite
2022-05-06 06:51:16 -07:00
Sergei Morozov
f3113f1a2f Build with DBAL 4@dev on SQLite 2022-05-06 06:36:23 -07:00
Alexander M. Turek
07ee555279 Exclude /ci from distribution packages (#9732) 2022-05-06 13:07:36 +02:00
Alexander M. Turek
5d860bfc9b Merge pull request #9727 from morozov/dbal-4.0.x-dev
Run builds with DBAL 4.0.x-dev
2022-05-06 08:25:43 +02:00
Sergei Morozov
aa8c2937d7 Catch exception from Connection::commit() 2022-05-05 22:14:02 -07:00
Sergei Morozov
38e954248c Improve mocks 2022-05-05 22:14:02 -07:00
Sergei Morozov
6c64f7db34 Quote only strings
See https://github.com/doctrine/dbal/pull/3488
2022-05-05 22:14:01 -07:00
Sergei Morozov
d4a9015c2b Look up only string parameter types
See https://github.com/doctrine/dbal/pull/3569
2022-05-05 22:14:01 -07:00
Sergei Morozov
0c745d9021 Pass column name as part of the definition
See https://github.com/doctrine/dbal/pull/3583
2022-05-05 22:14:00 -07:00
Sergei Morozov
6ef4b5f396 Merge branch '2.13.x' into 3.0.x 2022-05-05 15:54:14 -07:00
Sergei Morozov
e6bda4afda Merge pull request #9730 from morozov/dbal-4-compatibility
Forward compatibility with DBAL 4
2022-05-05 14:06:25 -07:00
Sergei Morozov
51b4e02873 Obtain database platform from the connection, not from the driver
See https://github.com/doctrine/dbal/pull/4764
2022-05-05 11:30:36 -07:00
Sergei Morozov
1915dcd1e8 Use zero as the default query offset
See https://github.com/doctrine/dbal/pull/3574
2022-05-05 11:30:35 -07:00
Sergei Morozov
480d99b107 Use getStringTypeDeclarationSQL() instead of getVarcharTypeDeclarationSQL()
See https://github.com/doctrine/dbal/pull/3586
2022-05-05 11:30:35 -07:00
Sergei Morozov
c6661caaed Do not extend a type with a different PHP return type
See https://github.com/doctrine/dbal/pull/5043
2022-05-05 11:30:34 -07:00
Sergei Morozov
9e27370f15 Drop and create test database manually
See https://github.com/doctrine/dbal/pull/4933
2022-05-05 11:30:32 -07:00
Sergei Morozov
1a3fbcb145 Lookup type name in the registry
See https://github.com/doctrine/dbal/pull/5208
2022-05-05 09:32:38 -07:00
Sergei Morozov
c950e72628 Do not use null column definition 2022-05-05 09:32:37 -07:00
Alexander M. Turek
ee83302751 Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  Allow doctrine/deprecations 1.0 (#9723)
  Allow setting column options like `charset` and `collation` everywhere (#9655)
  Fix psalm annotation
2022-05-05 18:09:05 +02:00
Sergei Morozov
7e83c9231d Merge pull request #9728 from morozov/phpunit-mysql-table-options
Test MySQL DDL using explicit table options
2022-05-04 12:23:54 -07:00
Sergei Morozov
f5e922ed92 Test MySQL DDL using explicit table options 2022-05-04 09:23:13 -07:00
Alexander M. Turek
05560f260c Merge release 2.12.2 into 2.13.x (#9725) 2022-05-03 02:15:35 +02:00
Sergei Morozov
3c41e421de Remove ConnectionMock (#9724)
* Remove ConnectionMock::getExecuteStatements()

* Remove ConnectionMock::quote()

* Remove ConnectionMock
2022-05-02 21:30:40 +00:00
Alexander M. Turek
8291a7f09b Allow doctrine/deprecations 1.0 (#9723) 2022-05-02 21:10:07 +02:00
Grégoire Paris
4c2950a9da Remove last references to ClassMetadataInfo (#9713)
* Remove disconnected class metadata factory

It is unused apart from a tests where it is easily replaced.

* Remove ClassMetadataInfo

It has been deprecated for a long, long time.
2022-05-02 19:55:42 +02:00
Ruud Kamphuis
d7d6b9d2c7 Allow setting column options like charset and collation everywhere (#9655)
This makes it possible to set custom options on the following:
* `JoinTable`
* `JoinColumn`
* `InverseJoinColumn`
2022-05-02 19:01:24 +02:00
Sergei Morozov
b8d3929dce Remove DriverResultMock (#9722) 2022-05-02 18:31:33 +02:00
Sergei Morozov
a8b4f05418 Remove ConnectionMock::delete() (#9717) 2022-05-02 17:14:18 +02:00
Sergei Morozov
f671fa8477 Remove DatabasePlatformMock (#9716) 2022-05-02 16:56:16 +02:00
Grégoire Paris
26e274e373 Merge pull request #9708 from michnovka/2.12.x-fix-psalm-repository 2022-05-02 15:26:47 +02:00
Alexander M. Turek
53e8674899 Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  Psalm 4.23, PHPStan 1.6.3 (#9718)
2022-05-02 11:18:49 +02:00
Alexander M. Turek
a02642e3e6 Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  Psalm 4.23, PHPStan 1.6.3 (#9718)
2022-05-02 11:09:12 +02:00
Alexander M. Turek
5209184a60 Psalm 4.23, PHPStan 1.6.3 (#9718) 2022-05-02 11:07:33 +02:00
Sergei Morozov
11049b441e Remove some mock classes (#9715) 2022-05-01 21:28:30 +00:00
Sergei Morozov
6fe69f16e2 Remove non-API DriverConnectionMock methods (#9709) 2022-05-01 22:37:32 +02:00
Grégoire Paris
8353e981be Merge remote-tracking branch 'origin/2.13.x' into 3.0.x 2022-05-01 22:24:36 +02:00
Grégoire Paris
b4da0ece41 Merge pull request #9704 from greg0ire/reference-cmi-less-and-less
Reference ClassMetadataInfo less and less
2022-05-01 22:06:19 +02:00
Sergei Morozov
3980d58b80 Merge pull request #9710 from morozov/2.13.x
Merge 2.12.x into 2.13.x
2022-05-01 12:46:13 -07:00
Sergei Morozov
ae76d91437 Merge branch '2.13.x' into 3.0.x 2022-05-01 12:27:51 -07:00
Sergei Morozov
10cbb24649 Merge branch '2.12.x' into 2.13.x 2022-05-01 12:24:28 -07:00
Sergei Morozov
23f54885bc Merge pull request #9706 from morozov/cleanup-test-entity-manager
Remove unused OrmTestCase::getTestEntityManager() parameters
2022-05-01 11:43:07 -07:00
Sergei Morozov
04830b787c Merge pull request #9705 from morozov/remove-require-conversion
Remove support for Type::canRequireSQLConversion()
2022-05-01 11:42:42 -07:00
Sergei Morozov
7f29b576d8 Remove some ConnectionMock methods (#9707) 2022-05-01 17:52:10 +02:00
Tomas
a8425a5248 Fix psalm annotation 2022-05-01 16:40:44 +02:00
Pierre B
86ce0e5e35 Update ClassMetadataInfo::table definition (#9703)
Everything except the name key might be undefined when accessing to this public property, for instance in a LoadMetadataEvent

Co-authored-by: Pierre Bourdet <pbourdet@worldia.com>
2022-05-01 09:40:00 +02:00
Sergei Morozov
39fd5f4d46 Remove unused OrmTestCase::getTestEntityManager() parameters 2022-04-30 12:35:05 -07:00
Sergei Morozov
fa844b1274 Remove support for Type::canRequireSQLConversion() 2022-04-30 12:07:31 -07:00
Grégoire Paris
476a02075f Deprecate classes and methods removed in 3.0 2022-04-30 19:47:20 +02:00
Grégoire Paris
98e10906f8 Change class metadata type declarations
There is a guarantee in the call sites that we are only passing
ClassMetadata instances.
2022-04-30 19:47:20 +02:00
Grégoire Paris
7241b4d2e0 Reference constants from ClassMetadata 2022-04-30 19:47:20 +02:00
Grégoire Paris
b8db858784 Deprecate not passing ClassMetadata instances 2022-04-30 19:47:20 +02:00
Thomas Landauer
a9309d748b Add missing use statement (#9699) 2022-04-30 08:04:44 +02:00
Grégoire Paris
fe09af6df1 Merge pull request #9701 from doctrine/2.11.x
2.11.x
2022-04-29 22:45:58 +02:00
Grégoire Paris
ed50e3d967 Merge pull request #9698 from ThomasLandauer/patch-8 2022-04-29 16:33:49 +02:00
Thomas Landauer
1d59e46245 use valid link syntax 2022-04-29 16:25:10 +02:00
Grégoire Paris
3043dcc823 Merge remote-tracking branch 'origin/2.13.x' into 3.0.x 2022-04-29 08:57:20 +02:00
Grégoire Paris
d8f3198ef8 Merge pull request #9693 from doctrine/2.12.x
Merge 2.12.x up into 2.13.x
2022-04-29 08:13:20 +02:00
Grégoire Paris
a0a0b0e476 Merge pull request #9692 from greg0ire/reference-cmi-even-less
Use ClassMetadata over ClassMetadataInfo in tests
2022-04-28 23:07:56 +02:00
Grégoire Paris
0078a67786 Use ClassMetadata over ClassMetadataInfo in tests
ClassMetadataInfo is deprecated in favor of ClassMetadata.
2022-04-28 21:40:23 +02:00
Grégoire Paris
38d1124be9 Merge pull request #9691 from greg0ire/reference-cmi-less
Reference ClassMetadaInfo less
2022-04-28 07:58:51 +02:00
Grégoire Paris
e9d3c218ef Remove explanation about inexistent distinction
ClassMetadataInfo used to be useful during entity generation, because it
allowed the entity not to exist. We no longer do entity generation, and
even if we did, the reflection methods have been moved to
ClassMetadataInfo as of 76e4f5a80b .
2022-04-27 23:28:58 +02:00
Grégoire Paris
6d2ca8fe40 Address mapping driver extraction
This documentation must be very old because this is no longer valid as
of e9e36dcf32 . The interface and abstract
file driver have since then been moved to doctrine/common, and the to
doctrine/persistence.
2022-04-27 23:28:43 +02:00
Grégoire Paris
a06011daf3 Refer to ClassMetadata instead of ClassMetadataInfo
Although properties and methods are currently located in
ClassMetadataInfo, it is better to refer to ClassMetadata as the former
is deprecated in favor of the latter.
2022-04-27 23:28:40 +02:00
Grégoire Paris
7f2dd9bea1 Remove invalid mapping
The named queries feature has been removed in 3.0
2022-04-27 11:47:51 +02:00
Alexander M. Turek
01edf115db Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  PHPStan 1.6.1 (#9688)
  Drop SymfonyStyle[listing] for sqls (#9679)
  Remove dynamic property declarations (#9683)
  PHPStan 1.6.0 (#9682)
  Validate XML mapping against XSD file
  Document ORM drivers only really load ORM metadata
  Fix HydrationException::invalidDiscriminatorValue parameter type (#9676)
  Fix type on ClassMetadata discriminatorMap (#9675)
2022-04-27 10:30:29 +02:00
Alexander M. Turek
825e9641fd Merge branch '2.12.x' into 2.13.x
* 2.12.x:
  PHPStan 1.6.1 (#9688)
  Drop SymfonyStyle[listing] for sqls (#9679)
2022-04-27 09:53:50 +02:00
Alexander M. Turek
0846b8b102 PHPStan 1.6.1 (#9688) 2022-04-26 23:52:07 +02:00
Simon Podlipsky
1dd2b44982 Drop SymfonyStyle[listing] for sqls (#9679)
This was super annoying as UpdateCommand printed sqls prefixed with `*` so it was not possible to copy statements anymore without manually removing those asterisks.

This removes prefixing sqls and makes it consistent with Create and Drop commands.
2022-04-26 15:33:18 +02:00
Alexander M. Turek
5fbe5ebef4 Merge 2.12.x into 2.13.x (#9684) 2022-04-26 11:32:14 +02:00
Alexander M. Turek
d9508e97df Remove dynamic property declarations (#9683) 2022-04-26 11:10:50 +02:00
Alexander M. Turek
534ed9c3c2 PHPStan 1.6.0 (#9682) 2022-04-26 11:01:11 +02:00
Grégoire Paris
f4585b954f Merge pull request #6728 from greg0ire/validate_xml_against_xsd
Validate XML mapping against XSD file
2022-04-25 23:04:26 +02:00
Grégoire Paris
ab3a255440 Validate XML mapping against XSD file
Co-Authored-By: Axel Venet <avenet@wamiz.com>
Co-authored-by: Luís Cobucci <lcobucci@gmail.com>
2022-04-25 22:55:00 +02:00
Grégoire Paris
a552df66a9 Merge pull request #9677 from greg0ire/assert-drivers-are-orm-specific
Document ORM drivers only really load ORM metadata
2022-04-24 20:55:13 +02:00
Grégoire Paris
85238d4d98 Document ORM drivers only really load ORM metadata 2022-04-24 20:05:37 +02:00
Fran Moreno
b7e9dd023c Fix HydrationException::invalidDiscriminatorValue parameter type (#9676) 2022-04-24 19:32:57 +02:00
Fran Moreno
1ac05f5e4e Fix type on ClassMetadata discriminatorMap (#9675) 2022-04-24 17:52:28 +02:00
Alexander M. Turek
aebd3f30cb Remove the doctrine binary (#9662) 2022-04-22 22:46:50 +02:00
Alexander M. Turek
801a7504a6 Merge branch '2.13.x' into 3.0.x
* 2.13.x:
  Conditionally extend the old AnnotationDriver class (#9671)
2022-04-22 20:12:06 +02:00
Alexander M. Turek
a5ad24c0fd Drop support for persistence 2 (#9665)
* Drop support for persistence 2

* Switch to the common static analysis job
2022-04-22 20:09:39 +02:00
Alexander M. Turek
2e4a872272 Conditionally extend the old AnnotationDriver class (#9671) 2022-04-22 19:46:03 +02:00
Alexander M. Turek
682b4e39fb Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Deprecate the doctrine binary (#9661)
  ScalarColumnHydrator: prevent early-bail on falsy values (#9663)
  Fix enum hydration when fetching partial results (#9657)
2022-04-19 21:34:02 +02:00
Alexander M. Turek
d550364431 Deprecate the doctrine binary (#9661) 2022-04-19 20:34:28 +02:00
Alexander M. Turek
5b2bf9d74c Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  ScalarColumnHydrator: prevent early-bail on falsy values (#9663)
2022-04-19 11:27:11 +02:00
Mitch
4af1aa3177 ScalarColumnHydrator: prevent early-bail on falsy values (#9663)
* add failing test for issue #9230

* ScalarColumnHydrator: prevent early-bail on falsy values, fix #9230

Co-authored-by: Mickael GOETZ <contact@mickael-goetz.com>
2022-04-19 09:01:33 +00:00
michnovka
2fe40679f4 Fix enum hydration when fetching partial results (#9657) 2022-04-16 20:49:28 +02:00
Alexander M. Turek
046683ab60 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Indicate support for doctrine/persistence 3 (#9656)
  Fix tests for enum ID hydration (#9658)
  Revert "Use charset/collation from column or table default when creating relations (#9636)"
  Fix test file/class names (#9649)
2022-04-15 13:22:31 +02:00
Alexander M. Turek
7029965d3a Indicate support for doctrine/persistence 3 (#9656) 2022-04-15 13:00:03 +02:00
michnovka
7e49c70320 Fix tests for enum ID hydration (#9658) 2022-04-13 12:58:20 +02:00
Grégoire Paris
f7fe5ad1bb Merge pull request #9654 from greg0ire/revert-9636
Revert "Use charset/collation from column or table default when creatng relations (#9636)"
2022-04-12 07:19:51 +02:00
Grégoire Paris
035c52ce3c Revert "Use charset/collation from column or table default when creating relations (#9636)"
This reverts commit 03f4468be2.
The inferring process seems fragile and MySQL-specific. The ORM might
not be the correct place to fix this issue (if it needs to be fixed at
all).
2022-04-11 20:26:17 +02:00
Alexander M. Turek
29a3495c8b Remove console helper (#9640) 2022-04-11 12:43:41 +02:00
michnovka
7e7e38b60e Fix test file/class names (#9649) 2022-04-11 12:15:45 +02:00
Alexander M. Turek
b2ca75e074 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Leverage generic persistence event classes (#9633)
  Fix static analysis for Persistence 2.5 (#9648)
  Improve exception message (#9646)
  Deprecate console helper (#9641)
  Use charset/collation from column or table default when creating relations (#9636)
  Support Enum IDs and search by Enum fields (#9629)
  Fix composer install in contributing readme
2022-04-11 12:07:29 +02:00
Alexander M. Turek
36ab133e62 Leverage generic persistence event classes (#9633) 2022-04-11 11:58:42 +02:00
Alexander M. Turek
e13422ab5e Merge 2.11.x into 2.12.x (#9650)
* Fix composer install in contributing readme

People that contribute know how to use composer.

* Fix static analysis for Persistence 2.5 (#9648)

Co-authored-by: Ruud Kamphuis <ruudk@users.noreply.github.com>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2022-04-10 23:45:04 +02:00
Alexander M. Turek
f4d5283f70 Fix static analysis for Persistence 2.5 (#9648) 2022-04-10 23:31:12 +02:00
Grégoire Paris
fda79b8e21 Improve exception message (#9646)
In setups where you have many parameters, or do not even realise you are
using an entity, that additional piece of context can be helpful. The
parameter name is not always available where the old exception was
called though.
2022-04-10 23:08:52 +02:00
Alexander M. Turek
5a345b01dc Deprecate console helper (#9641) 2022-04-10 20:59:10 +02:00
Ruud Kamphuis
03f4468be2 Use charset/collation from column or table default when creating relations (#9636)
Fixes #6823
2022-04-10 14:34:21 +02:00
Grégoire Paris
16748bdee9 Merge pull request #7196 from greg0ire/document_exception_split_bc_breaks
Document exception-splitting-related BC-breaks
2022-04-10 12:12:29 +02:00
michnovka
a3d82f8e2f Support Enum IDs and search by Enum fields (#9629) 2022-04-09 23:40:41 +02:00
Grégoire Paris
976fe5bc0d Merge pull request #9639 from ruudk/patch-1
Fix composer install in contributing readme
2022-04-09 16:41:21 +02:00
Ruud Kamphuis
582b222b00 Fix composer install in contributing readme
People that contribute know how to use composer.
2022-04-09 15:29:45 +02:00
Grégoire Paris
7ef5f7004d Document exception-splitting-related BC-breaks
Closes #7194
2022-04-09 11:10:59 +02:00
Alexander M. Turek
b7ff9db6e7 Remove deprecated handling of custom ObjectRepository implementations (#9634) 2022-04-08 01:25:27 +02:00
Alexander M. Turek
953c63392c Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Deprecate custom ObjectRepository implementations (#9533)
  Fix types on walkLiteral() and walkLikeExpression() (#9566)
2022-04-06 13:59:44 +02:00
Alexander M. Turek
d9e8e839fe Deprecate custom ObjectRepository implementations (#9533) 2022-04-06 13:51:12 +02:00
Alexander M. Turek
e8472c8f1a Fix types on walkLiteral() and walkLikeExpression() (#9566) 2022-04-06 10:48:54 +02:00
Alexander M. Turek
476a6ba935 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Add support for array of enums (#9497)
  explicitly use the non-deprecated ORMException
2022-04-05 13:05:28 +02:00
Alexander M. Turek
deaab5133e Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  explicitly use the non-deprecated ORMException
2022-04-05 13:02:01 +02:00
Sander
cffe31fc9d Add support for array of enums (#9497)
* Add support for array of enums

This allows the use of 'array' and 'simple_array' in combination
with the enumType parameter.

* Reference is_array and array_map through a use statement nstead of global fallback

* Return the value of an array of enums correctly

* Add enum array mapping test

* Fix order of use parameters

* Fix return type docblock

* Apply phpcs feedback

* Fix static closure

* Add missing return type to static closure

* Add helper method for enum initialization to reduce code duplication

* Fix CS

* Replace mixed typehints with more specific ones

* Update docblock type hint to allow for array of string/int

* Fix types

* Fix types

Co-authored-by: Alexander M. Turek <me@derrabus.de>
2022-04-05 01:29:40 +02:00
Alexander M. Turek
6e65db5d2d Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Fix types on ResultSetMapping (#9621)
2022-04-04 22:14:14 +02:00
Alexander M. Turek
0e9c7533fb Fix types on ResultSetMapping (#9621) 2022-04-04 21:58:25 +02:00
Alexander M. Turek
30591eaf56 Add native types to ResultSetMapping (#9620) 2022-04-04 17:36:54 +02:00
Grégoire Paris
1ffb9152f7 Merge pull request #9623 from BenoitDuffez/dont-use-depecated-ormexception
explicitly use the non-deprecated ORMException
2022-04-02 11:52:48 +02:00
Benoit Duffez
51faa6ddb7 explicitly use the non-deprecated ORMException 2022-04-01 13:23:05 -07:00
Alexander M. Turek
435587c260 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Support enums as default values (#9616)
  Skip tests requiring ObjectManagerAware (#9612)
  Remove "Description of" PHPDoc (#9611)
2022-03-31 00:19:16 +02:00
Alexander M. Turek
18d6bc3757 Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  Remove "Description of" PHPDoc (#9611)
2022-03-31 00:14:34 +02:00
Alexander M. Turek
7c4ae58517 Support enums as default values (#9616) 2022-03-28 22:36:45 +02:00
Alexander M. Turek
6a15af599c Remove support for ObjectManagerAware (#9614) 2022-03-28 21:07:55 +02:00
Alexander M. Turek
05f8fcf836 Skip tests requiring ObjectManagerAware (#9612) 2022-03-28 13:50:45 +00:00
Alexander M. Turek
692c3e1b45 Remove "Description of" PHPDoc (#9611) 2022-03-28 13:47:30 +02:00
Alexander M. Turek
6ba0455129 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Update psalm.xml
  PHPStan 1.5.0 (#9607)
  Remove Sphinx config
  Indicate what feature is deprecated
  Implement int-mask-of where appropriate
  Use correct syntax for external links
  Update XmlExporter.php - Type problem in php8.x (#9589)
  Ignore deprecation from Persistence
  Stands with Ukraine (#9567)
  Use internal links when self-referencing
  Link to docs for the stable version
2022-03-28 10:51:09 +02:00
Alexander M. Turek
acff29fddd Update psalm.xml 2022-03-28 10:48:23 +02:00
Alexander M. Turek
58659f6c4f Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  PHPStan 1.5.0 (#9607)
  Remove Sphinx config
  Use correct syntax for external links
  Update XmlExporter.php - Type problem in php8.x (#9589)
  Ignore deprecation from Persistence
  Stands with Ukraine (#9567)
  Use internal links when self-referencing
  Link to docs for the stable version
2022-03-28 10:46:50 +02:00
Alexander M. Turek
e410180c6e PHPStan 1.5.0 (#9607) 2022-03-28 10:37:03 +02:00
Grégoire Paris
4476b05d59 Merge pull request #9608 from greg0ire/remove-python-config
Remove Sphinx config
2022-03-26 17:15:36 +01:00
Grégoire Paris
343b0ae576 Remove Sphinx config
I do not think this file is still useful, since AFAIK we are not using
Sphinx anymore. Besides, this is the only Doctrine project I could find
that still has that file. It was last updated 6 years ago.
2022-03-26 12:07:22 +01:00
Grégoire Paris
9952350c64 Merge pull request #9604 from greg0ire/improve-exception-message
Indicate what feature is deprecated
2022-03-24 08:46:03 +01:00
Grégoire Paris
3bc78caba9 Indicate what feature is deprecated 2022-03-23 18:39:33 +01:00
Grégoire Paris
0f1c9ec72a Merge pull request #9603 from greg0ire/int-mask-of 2022-03-22 14:18:14 +01:00
Grégoire Paris
80f65d6f77 Implement int-mask-of where appropriate
With Psalm, you can specify that an integer should be a bitmask of
constants. Doing so allows to make some types more precise.
2022-03-22 14:02:31 +01:00
Grégoire Paris
de69f60c6a Merge pull request #9598 from greg0ire/fix-event-table
Use correct syntax for external links
2022-03-20 19:32:10 +01:00
Grégoire Paris
793a3e3b75 Merge pull request #9597 from greg0ire/drop-ns-aliases
Remove support for entity namespace aliases
2022-03-20 19:15:30 +01:00
Grégoire Paris
2a653b05a0 Use correct syntax for external links
There is no leading underscore, and the trailing underscore should not
be forgotten.
2022-03-20 19:13:19 +01:00
Grégoire Paris
a02dad303c Remove support for entity namespace aliases 2022-03-20 15:38:36 +01:00
Grégoire Paris
fc7e1c4e39 Merge remote-tracking branch 'origin/2.12.x' into 3.0.x 2022-03-20 14:38:53 +01:00
Grégoire Paris
0f04a82857 Merge pull request #9595 from greg0ire/deprecate-more-ns-aliases
Deprecate more occurrences of namespace aliases
2022-03-20 14:34:16 +01:00
Grégoire Paris
17903346cf Deprecate more occurrences of namespace aliases 2022-03-20 14:26:13 +01:00
Alexander M. Turek
98b468da57 Fix type on SqlWalker::walkPathExpression() (#9565) 2022-03-20 13:42:41 +01:00
Grégoire Paris
032dd3289a Merge remote-tracking branch 'origin/2.12.x' into 3.0.x 2022-03-20 12:37:58 +01:00
Grégoire Paris
bccb4c7bd9 Merge pull request #9592 from greg0ire/fix-persistence-compat
Deprecate or throw on namespace alias usage
2022-03-20 12:26:28 +01:00
Grégoire Paris
dc53628faf Deprecate or throw on namespace alias usage
This feature has been deprecated and removed in doctrine/persistence.
It was already deprecated in doctrine/orm for other APIs.
2022-03-20 11:44:42 +01:00
Grégoire Paris
ab991de8a2 Merge remote-tracking branch 'origin/2.12.x' into 3.0.x 2022-03-19 13:47:54 +01:00
Grégoire Paris
21f339e6eb Merge pull request #9528 from greg0ire/get-rid-of-persistent-object
Implement forward compatibility with Persistence 3
2022-03-19 13:18:06 +01:00
Jan Záruba
c6831c6b07 Update XmlExporter.php - Type problem in php8.x (#9589)
Please see PHP interface SimpleXMLElement::addAttribute(string $name, string $value = null, string $namespace = null): void .... 
The $value must be string or null.
2022-03-19 13:03:28 +01:00
Grégoire Paris
33da4d84eb Merge pull request #9590 from greg0ire/fix-build
Ignore deprecation from Persistence
2022-03-18 22:56:08 +01:00
Grégoire Paris
08de12e962 Merge pull request #9580 from klammbueddel/bug/duplicate-object-in-nested-collections
Add test to reproduce #9579
2022-03-18 22:54:19 +01:00
Grégoire Paris
7c83373f1e Add specific CI jobs for Persistence 3 2022-03-18 22:25:47 +01:00
Grégoire Paris
021164fbe5 throw when attempting to use partial clearing 2022-03-18 22:21:59 +01:00
Grégoire Paris
b2d0c21fe0 Workaround the impossibility of unsetting metadata 2022-03-18 21:49:08 +01:00
Grégoire Paris
7391e2586a Mock ClassMetadata::getName()
It is supposed to return a string.
2022-03-18 21:49:08 +01:00
Grégoire Paris
3532ce9a25 Remove useless calls 2022-03-18 21:49:08 +01:00
Grégoire Paris
2c769acf8c Implement forward compatbility with Persistence 3 2022-03-18 21:49:08 +01:00
Grégoire Paris
c1b373b931 Ignore deprecation from Persistence
The deprecation is already addressed in the next minor branch.
2022-03-18 19:19:15 +01:00
Christian Bartels
61cb557b18 Check if association already contains object (#9579) 2022-03-18 11:00:33 +01:00
Maxime Veber
b6cff1aa1c Stands with Ukraine (#9567) 2022-03-18 10:32:03 +01:00
Grégoire Paris
4471ad9f6b Merge pull request #9587 from greg0ire/implement-colocated-driver 2022-03-16 10:54:06 +01:00
Grégoire Paris
cd57768b08 Implement colocated mapping driver
This allows us to decouple further from doctrine/annotations, and to fix
some static analysis issues.

The assumption being made here is that the abstract class we are no
longer extending is not used in type declarations and instanceof checks.
2022-03-15 12:42:27 +01:00
Grégoire Paris
d2206152bb Merge pull request #9585 from greg0ire/hunt-down-latest 2022-03-13 17:11:29 +01:00
Grégoire Paris
a34dc0a0e3 Use internal links when self-referencing
This should result in links with the current version of the docs.
2022-03-13 14:36:37 +01:00
Grégoire Paris
881a7b3b69 Link to docs for the stable version
When we do not know what version people intend to browse, it seems more
sensible to assume they want to see the docs for the stable version.
2022-03-13 14:35:15 +01:00
Alexander M. Turek
f14f5dc72c Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Leverage MemcachedAdapter::isSupported() (#9578)
  Baseline Psalm errors caused by DBAL 3.3.3 (#9577)
  Make sure MemcachedAdapter is supported before tring to use it (#9574)
  Fixing `:doc:` link (#9569)
  Adding PHP attributes (#9555)
  Remove reference to removed class
2022-03-11 00:06:20 +01:00
Alexander M. Turek
b64824addb Leverage MemcachedAdapter::isSupported() (#9578) 2022-03-10 23:37:36 +01:00
Alexander M. Turek
c7104c9471 Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  Baseline Psalm errors caused by DBAL 3.3.3 (#9577)
  Make sure MemcachedAdapter is supported before tring to use it (#9574)
  Fixing `:doc:` link (#9569)
  Adding PHP attributes (#9555)
  Remove reference to removed class
2022-03-09 17:20:17 +01:00
Alexander M. Turek
82bbb1dc4a Baseline Psalm errors caused by DBAL 3.3.3 (#9577) 2022-03-09 17:18:11 +01:00
flack
9c351e0444 Make sure MemcachedAdapter is supported before tring to use it (#9574) 2022-03-09 16:23:58 +01:00
Thomas Landauer
5ed5383338 Fixing :doc: link (#9569) 2022-03-08 22:31:56 +01:00
Thomas Landauer
eb1d54871b Adding PHP attributes (#9555)
Co-authored-by: Alexander M. Turek <me@derrabus.de>
Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>
2022-03-08 01:40:01 +01:00
Grégoire Paris
e148c838b0 Merge pull request #9563 from greg0ire/address-sqllogger-deprecation
Remove reference to removed class
2022-03-03 22:27:51 +01:00
Grégoire Paris
c73df2a7b4 Remove reference to removed class
EchoSQLLogger is deprecated in DBAL 2, and removed in DBAL 3.
2022-03-03 22:12:04 +01:00
Alexander M. Turek
35615ef60e Merge pull request #9559 from doctrine/2.12.x 2022-03-03 20:30:55 +01:00
Alexander M. Turek
bc6c6c9f0c Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  Parser: SimpleArithmeticExpression should return ArithmeticTerm (#9557)
2022-03-03 19:55:19 +01:00
Loïc Vernet
89d0a6a67c validate schema command: allow to debug missing schema updates list (#9019) 2022-03-03 18:35:32 +00:00
Jan Barášek
38682e93db Parser: SimpleArithmeticExpression should return ArithmeticTerm (#9557) 2022-03-03 00:25:27 +01:00
Alexander M. Turek
1febeaca7f Document tree walker class strings (#9553) 2022-03-01 20:14:46 +01:00
Alexander M. Turek
229dcb082b Use literal types for JOIN_TYPE_* constants (#9552) 2022-03-01 15:10:51 +01:00
Alexander M. Turek
7f51f6d6ad Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Leverage Lexer's Token type
2022-03-01 00:12:27 +01:00
Grégoire Paris
3849aed6fb Merge pull request #9549 from derrabus/improvement/leverage-token-type
Leverage Lexer's Token type
2022-02-28 20:56:19 +01:00
Alexander M. Turek
f82db6a894 Leverage Lexer's Token type 2022-02-28 20:27:19 +01:00
Alexander M. Turek
9ddd82bc3c Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Update baselines for Lexer 1.2.3 (#9546)
2022-02-28 14:13:43 +01:00
Alexander M. Turek
a8a859cf5e Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  Update baselines for Lexer 1.2.3 (#9546)
2022-02-28 14:11:53 +01:00
Alexander M. Turek
84df37de97 Update baselines for Lexer 1.2.3 (#9546) 2022-02-28 14:06:31 +01:00
Alexander M. Turek
4292d8e0e6 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Document QueryComponent array shape (#9527)
  Improve templating
  Un-deprecate the current proxy mechanism (#9532)
  Remove unused methods
  Fix bug-#9536
2022-02-25 15:05:03 +01:00
Alexander M. Turek
7be96f64ab Document QueryComponent array shape (#9527) 2022-02-25 00:21:29 +01:00
Grégoire Paris
947935e4c9 Merge pull request #9541 from greg0ire/improve-templating 2022-02-24 20:25:13 +01:00
Grégoire Paris
40af1fcfc6 Improve templating
This is helpful for static analysis
2022-02-24 18:19:30 +01:00
Alexander M. Turek
021444b322 Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  Fix bug-#9536
2022-02-24 11:24:13 +01:00
Alexander M. Turek
ec7c637cf2 Un-deprecate the current proxy mechanism (#9532) 2022-02-24 11:17:05 +01:00
Alexander M. Turek
5ebe984194 Add native types to SQLFilter (#9524) 2022-02-24 11:15:21 +01:00
Grégoire Paris
0a0779c4a9 Remove unused methods 2022-02-22 20:26:18 +01:00
Grégoire Paris
856c3143f8 Merge pull request #9537 from kiler129/fix-bug-9536
Make error message suggestion accurate
2022-02-22 20:08:49 +01:00
kiler129
79f73a23f3 Fix bug-#9536
Wrong validation message is displayed when an incorrect bidirectional
bi-directional mapping is set up. When the owning side is configured
correctly and the target side is missing the back reference, the ORM
suggests adding inverseBy instead of mappedBy, with the field name
missing. This commit fixes this problem.
2022-02-22 12:05:35 -06:00
Grégoire Paris
1712e3cbd0 Merge remote-tracking branch 'origin/2.12.x' into 3.0.x 2022-02-22 18:14:53 +01:00
Grégoire Paris
a52d9880cc Merge pull request #9542 from doctrine/2.11.x
Merge 2.11.x up into 2.12.x
2022-02-22 18:11:25 +01:00
Grégoire Paris
4af912f712 Merge pull request #9539 from greg0ire/use-stable-dbal
Drop minor version number
2022-02-22 18:01:26 +01:00
Grégoire Paris
65f48e0ecd Drop minor version number
We should make it explicit that we mean to test with whatever is the
latest 3.x
2022-02-22 17:25:21 +01:00
Alexander M. Turek
87b894ea22 Leverage the Stringable interface (#9535) 2022-02-22 00:47:51 +01:00
Alexander M. Turek
597460d5ea Add native types to caches (#9508) 2022-02-22 00:47:00 +01:00
Alexander M. Turek
08eaba44ca Fix more types on EntityRepository and FilterCollection (#9525) 2022-02-20 21:09:41 +01:00
Alexander M. Turek
05c35c398f Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  Bring `FilterCollection` to a "clean" state after hash computation (#9523)
2022-02-20 14:19:47 +01:00
Matthias Pigulla
193c3abf0e Bring FilterCollection to a "clean" state after hash computation (#9523)
Co-authored-by: Alexander M. Turek <me@derrabus.de>
2022-02-20 13:09:05 +00:00
Alexander M. Turek
d739e44ee6 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Make creating test models more straightforward
  Trigger the desired code path
  Fix syntax typo in attributes reference (#9513)
  Constructor-Argument "options" has the same type as the associated property. (#9501)
2022-02-20 12:23:23 +01:00
Alexander M. Turek
dac1875a79 Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  Make creating test models more straightforward
  Trigger the desired code path
  Fix syntax typo in attributes reference (#9513)
  Constructor-Argument "options" has the same type as the associated property. (#9501)
2022-02-20 11:52:36 +01:00
Grégoire Paris
5b8263e8fb Merge pull request #9526 from greg0ire/better-model-setup
Make creating test models more straightforward and revert to swallowing exceptions
2022-02-20 09:35:21 +01:00
Grégoire Paris
26e85b8c88 Make creating test models more straightforward
In https://github.com/doctrine/orm/pull/8962, I established that
swallowing exceptions while creating model was bad because it could hide
other helpful exceptions.
As it turns out however, swallowing exceptions is really the way to go
here, because of the performance implication of calling dropSchema(). It
is possible to catch a more precise exception as well, which should
preserve the benefits of not swallowing them.

It looks like I based my grep on the comment inside the catch and today,
I found many other occurrences of this pattern, without the easy to grep
comment.

I decided to fix them as well, but in a lazier way: one no longer has to
remember to call dropSchema in tearDown() now, it is automated.
2022-02-20 09:26:57 +01:00
Alexander M. Turek
6b33fa6ddd Add native types to EntityRepository (#9515) 2022-02-17 23:38:31 +01:00
Grégoire Paris
152c04c03d Merge pull request #9519 from lcobucci/fix-pagination-test
Trigger the desired code path
2022-02-16 09:24:32 +01:00
Alexander M. Turek
3a9cc3d258 Remove TreeWalkerChainIterator (#9520) 2022-02-16 09:19:54 +01:00
Alexander M. Turek
dd4a38ce9f Merge 2.12.x into 3.0.x (#9518) 2022-02-15 23:11:54 +01:00
Luís Cobucci
12ab6fa43f Trigger the desired code path
Since v2.7.0 the ORM avoids using extra queries via the paginator
component when maximum results isn't set on the original query. With
that change, this test was not executing the code path that it was
expected to run.

This makes sure we trigger the forcing of custom DBAL types when
hydrating the identifiers, making sure we don't introduce bugs.

More info:
- Forcing DBAL type conversion: https://github.com/doctrine/orm/pull/7905
- Issue on optimisation: https://github.com/doctrine/orm/issues/7829
- PR on optimisation: https://github.com/doctrine/orm/pull/7863
- Minor BC-break docs: https://github.com/doctrine/orm/blob/2.11.x/UPGRADE.md#minor-bc-break-paginator-output-walkers-arent-be-called-anymore-on-sub-queries-for-queries-without-max-results
2022-02-15 22:59:09 +01:00
Alexander M. Turek
5a55772559 Document deprecation of AbstractCollectionPersister helpers (#9512) 2022-02-15 22:54:30 +01:00
Yann Rabiller
e8e61cbbd5 Fix syntax typo in attributes reference (#9513)
Curly brackets are the annotation way of declaring array. Probably a
mistake while copy pasting some examples from annotations.
2022-02-15 14:32:33 +00:00
Alexander M. Turek
d78fa52ad7 Replace TreeWalkerChainIterator with a generator (#9511) 2022-02-15 13:00:15 +01:00
Alexander M. Turek
4158915af3 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Fix types on caches (#9507)
  Fix AbstractQuery::setParameter phpdoc (#9504)
  Added "false" value to $columnPrefix type declaration. (#9493)
2022-02-14 09:48:56 +01:00
Alexander M. Turek
4ddaa5fc20 Fix types on caches (#9507) 2022-02-13 22:50:21 +01:00
Tony Lemke
8f847cb5aa Constructor-Argument "options" has the same type as the associated property. (#9501) 2022-02-13 21:42:15 +01:00
Alexander M. Turek
d7abcb01bc Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  Fix AbstractQuery::setParameter phpdoc (#9504)
2022-02-13 11:02:56 +01:00
David Maicher
599832cb81 Fix AbstractQuery::setParameter phpdoc (#9504)
* Fix AbstractQuery::setParameter phpdoc

* Fix AbstractQuery::setParameter phpdoc
2022-02-12 21:49:30 +01:00
Alexander M. Turek
954439af64 Remove quoting methods from ClassMetadata (#9500) 2022-02-11 21:09:32 +01:00
Alexander M. Turek
a74807aa86 Add native types to persisters (#9469) 2022-02-11 02:13:58 +01:00
Alexander M. Turek
0d4281ddfa Add native types to QueryBuilder (#9490) 2022-02-10 23:34:28 +01:00
Alexander M. Turek
32214ddaa6 Remove various deprecated methods and properties (#9498) 2022-02-10 09:33:11 +01:00
Alexander M. Turek
8cff7dcdaf Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  Added "false" value to $columnPrefix type declaration. (#9493)
2022-02-09 14:56:45 +01:00
Dmytro Hordinskyi
530f515556 Added "false" value to $columnPrefix type declaration. (#9493) 2022-02-09 09:40:16 +01:00
Alexander M. Turek
3a43f924c6 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Fix types on QueryBuilder (#9492)
  Fix types on EntityRepository (#9474)
  Avoid calling merge() (#9489)
  PHPStan 1.4.6, Psalm 4.20.0 (#9491)
  Fix `#[DiscriminatorMap]` params (#9487)
  Run tests with stricter error handling (#9482)
2022-02-09 01:05:25 +01:00
Alexander M. Turek
601728045c Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  PHPStan 1.4.6, Psalm 4.20.0 (#9491)
  Fix `#[DiscriminatorMap]` params (#9487)
  Run tests with stricter error handling (#9482)
2022-02-09 00:51:01 +01:00
Alexander M. Turek
b18cd893be Fix types on QueryBuilder (#9492) 2022-02-09 00:48:36 +01:00
Alexander M. Turek
21390a12b9 Fix types on EntityRepository (#9474) 2022-02-09 00:44:30 +01:00
Alexander M. Turek
d13d0f5848 Remove ability to merge detached entities (#9488) 2022-02-09 00:43:44 +01:00
Alexander M. Turek
182bcbae23 Avoid calling merge() (#9489) 2022-02-09 00:42:49 +01:00
Alexander M. Turek
1c55025b12 PHPStan 1.4.6, Psalm 4.20.0 (#9491) 2022-02-09 00:42:34 +01:00
Steve
0900d4bc97 Fix #[DiscriminatorMap] params (#9487)
Fix `#[DiscriminatorMap]` params
2022-02-08 08:35:46 +00:00
Alexander M. Turek
be2518d784 Run tests with stricter error handling (#9482) 2022-02-07 22:08:34 +00:00
Alexander M. Turek
fd83543026 Remove ability to flush the EM partially (#9485) 2022-02-07 22:29:51 +01:00
Alexander M. Turek
607911ff27 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Modernize strpos() calls (#9480)
  Fix types on persisters (#9466)
  Rename DoctrineSetup to ORMSetup (#9481)
  Remove useless catches
2022-02-07 09:41:12 +01:00
Alexander M. Turek
978f687df9 Modernize strpos() calls (#9480) 2022-02-07 09:34:45 +01:00
Alexander M. Turek
fd1690431f Fix types on persisters (#9466) 2022-02-07 09:26:15 +01:00
Grégoire Paris
3cfcd4ad13 Merge pull request #9479 from derrabus/improvement/useless-catch
Remove useless catches
2022-02-06 16:07:47 +01:00
Alexander M. Turek
69b0b764e3 Rename DoctrineSetup to ORMSetup (#9481) 2022-02-06 15:22:58 +01:00
Alexander M. Turek
e11cef5fca Remove useless catches 2022-02-06 00:20:25 +01:00
Alexander M. Turek
e6f07fa0b1 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Deprecate methods removed in 3.0 (#9475)
  Skip tests related to PersistentObject if that class is missing (#9472)
  Run Postgres 14 and MariaDB 10.6 in CI (#9470)
2022-02-05 23:00:32 +01:00
Alexander M. Turek
395c02caf4 Deprecate methods removed in 3.0 (#9475) 2022-02-05 22:41:33 +01:00
Alexander M. Turek
0c4e739e94 Merge 2.11.x into 2.12.x (#9473) 2022-02-05 20:15:38 +01:00
Alexander M. Turek
7a72526e47 Skip tests related to PersistentObject if that class is missing (#9472) 2022-02-05 19:31:42 +01:00
Alexander M. Turek
bdd8883d12 Run Postgres 14 and MariaDB 10.6 in CI (#9470) 2022-02-05 19:28:13 +01:00
Alexander M. Turek
1c67f4274b Remove ability to clear the UoW partially (#9471) 2022-02-05 18:00:37 +01:00
Alexander M. Turek
5efdff2a4f Remove PHP 7 code (#9462) 2022-02-02 22:53:48 +01:00
Alexander M. Turek
b15b95ee8f Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Check requirements for metadata drivers (#9459)
  PDO is not a required extension (#9457)
  Check requirements for metadata drivers (#9452)
  Remove trailing underscore (#9446)
2022-02-01 22:15:51 +01:00
Alexander M. Turek
5f882b1cdd Check requirements for metadata drivers (#9459) 2022-02-01 19:19:40 +01:00
Alexander M. Turek
b3d849dd38 Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  PDO is not a required extension (#9457)
  Check requirements for metadata drivers (#9452)
  Remove trailing underscore (#9446)
2022-02-01 14:16:15 +01:00
Alexander M. Turek
536b65f02b PDO is not a required extension (#9457) 2022-02-01 14:13:50 +01:00
Alexander M. Turek
103c42cdb7 Check requirements for metadata drivers (#9452) 2022-02-01 13:48:03 +01:00
Alexander M. Turek
b0a351f55a Remove support for Doctrine Cache (#9456) 2022-02-01 13:47:39 +01:00
Alexander M. Turek
1ea83e5774 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Support enums in findBy() calls (#9453)
  Streamline cache creation in tests (#9451)
2022-01-31 23:13:42 +01:00
Alexander M. Turek
aa1dd881d8 Support enums in findBy() calls (#9453) 2022-01-31 23:02:58 +01:00
Alexander M. Turek
4244dfe0a2 Add more native types to entity manager implementations (#9450) 2022-01-31 22:42:21 +01:00
Alexander M. Turek
92d27f2fea Streamline cache creation in tests (#9451) 2022-01-31 21:55:39 +01:00
Alexander M. Turek
e7e9db8cee Remove deprecated Setup class (#9447) 2022-01-31 09:11:39 +01:00
Alexander M. Turek
6b53ac6790 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Document the new DoctrineSetup class (#9448)
2022-01-31 09:09:23 +01:00
Alexander M. Turek
f8de44c35f Document the new DoctrineSetup class (#9448) 2022-01-31 08:13:10 +01:00
Alexander M. Turek
9872d1c997 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Introduce DoctrineSetup as a replacement for Setup (#9443)
  Introduce __unserialize behaviour in docs (#9390)
  Adapt test logic to PHP and SQLite II (#9442)
  Use the identify generator strategy
  Added php 8.1 to CI
  Psalm 4.19.0, PHPStan 1.4.3 (#9438)
  Ignore PHPUnit result cache everywhere (#9425)
2022-01-31 00:02:14 +01:00
Grégoire Paris
cdaf7b5308 Remove trailing underscore (#9446)
It looks like there was confusion between the syntax for external links
and the syntax for internal links, which does not mention underscores.
See https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-doc
versus https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#external-links
2022-01-30 23:01:35 +00:00
Alexander M. Turek
f81980e1fa Introduce DoctrineSetup as a replacement for Setup (#9443) 2022-01-30 22:38:57 +00:00
Alexander M. Turek
e9e54d8f65 Merge release 2.11.1 into 2.12.x (#9444) 2022-01-30 23:04:07 +01:00
Claudio Zizza
4b88ce787d Introduce __unserialize behaviour in docs (#9390)
* Introduce __unserialize behaviour in docs

* Mention deprecation of Serializable interface

* Add link to __unserialize method
2022-01-30 22:47:06 +01:00
Alexander M. Turek
04bfdf85de Merge 2.11.x up into 2.12.x (#9441) 2022-01-30 18:06:16 +01:00
Grégoire Paris
f9c3470a8d Adapt test logic to PHP and SQLite II (#9442)
In a88242ee6c, testDateSub() was modified
in order to satisfy different opinions to the question "What is now
minus one month", that has different answers for different pieces of
software on March 30th.

Today, we are January 30th, we need to do the same for testDateAdd().
Hopefully this is the last time we hear about this.
2022-01-30 17:48:10 +01:00
Ahmadou Waly NDIAYE
31b7d78516 Removing the deprecated Named (Native) Queries in Metadata/EntityRepository (#9428)
This feature has been deprecated.
2022-01-30 15:57:12 +01:00
Grégoire Paris
c1b131b67e Merge pull request #9440 from sir-kain/php-8.1-ci
Added php 8.1 to CI
2022-01-30 09:55:04 +01:00
Grégoire Paris
16b82ea061 Use the identify generator strategy
It is a better default, and should fix tests for PostgreSQL
2022-01-29 11:33:13 +01:00
Waly
f8f370ace6 Added php 8.1 to CI 2022-01-28 22:55:25 +00:00
Alexander M. Turek
43f67c6164 Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  Psalm 4.19.0, PHPStan 1.4.3 (#9438)
  Ignore PHPUnit result cache everywhere (#9425)
2022-01-28 23:08:59 +01:00
Alexander M. Turek
d5c69fb73f Psalm 4.19.0, PHPStan 1.4.3 (#9438) 2022-01-28 21:54:10 +00:00
Alexander M. Turek
93f9eb7af2 Ignore PHPUnit result cache everywhere (#9425) 2022-01-24 12:35:44 +01:00
Alexander M. Turek
36dcf15ebc Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Introduce assertQueryCount (#9423)
2022-01-24 11:44:27 +01:00
Alexander M. Turek
f5be4183ce Introduce assertQueryCount (#9423) 2022-01-24 09:39:48 +01:00
Alexander M. Turek
56021c1af9 Remove DBAL 2 compatible SQL logging (#9422) 2022-01-24 08:09:53 +01:00
Alexander M. Turek
1d8dd53995 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Add support for PHP 8.1 enums in embedded classes (#9419)
  Switch tests to the middleware logging system (#9418)
  Added class-string typehint on $targetEntity (#9415)
  Allow DiscriminatorColumn with length=0 (#9410)
  Move UnderscoreNamingStrategyTest to correct namespace (#9414)
2022-01-24 00:13:13 +01:00
Alexander M. Turek
eed031fab0 Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  Add support for PHP 8.1 enums in embedded classes (#9419)
  Added class-string typehint on $targetEntity (#9415)
  Allow DiscriminatorColumn with length=0 (#9410)
  Move UnderscoreNamingStrategyTest to correct namespace (#9414)
2022-01-24 00:05:44 +01:00
HypeMC
6d5da83c68 Add support for PHP 8.1 enums in embedded classes (#9419) 2022-01-23 23:56:36 +01:00
Alexander M. Turek
328f36846e Switch tests to the middleware logging system (#9418) 2022-01-23 23:55:07 +01:00
Alexander M. Turek
7375c8a058 Remove old cache accessors and mutators from query classes (#9392) 2022-01-23 21:29:47 +01:00
jworman
5f01dd8d09 Added class-string typehint on $targetEntity (#9415) 2022-01-23 20:09:41 +01:00
Benjamin Cremer
b596e6a665 Allow DiscriminatorColumn with length=0 (#9410) 2022-01-21 10:27:29 +01:00
Alexander M. Turek
79d3cf5880 Move UnderscoreNamingStrategyTest to correct namespace (#9414) 2022-01-20 20:49:11 +01:00
Alexander M. Turek
f61d5c24ac Remove check for getSQLResultCasing() (#9413) 2022-01-20 16:46:37 +01:00
Alexander M. Turek
7c17c11a04 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Fix types on CacheLogger implementations (#9401)
  Rework some tests that use hardcoded DBAL mocks (#9404)
2022-01-20 15:32:29 +01:00
Alexander M. Turek
d4f5db4b8a Add native types to CacheLogger implementations (#9400) 2022-01-20 10:27:21 +01:00
Alexander M. Turek
f7822c775d Fix types on CacheLogger implementations (#9401) 2022-01-20 00:29:39 +01:00
Alexander M. Turek
be4f88c811 Add native types to EntityHydrator (#9396) 2022-01-19 23:41:57 +01:00
Alexander M. Turek
6f150a343b Remove MultiGetRegion and add native types to Region implementations (#9403) 2022-01-19 23:41:26 +01:00
Sergei Morozov
8c08792f0e Rework some tests that use hardcoded DBAL mocks (#9404) 2022-01-19 17:11:57 +01:00
Sergei Morozov
30ea3a26d0 Merge pull request #9402 from morozov/dbal-4.0.x-types
Make test types compatible with Doctrine DBAL 4.0.x-dev
2022-01-18 15:53:20 -08:00
Sergei Morozov
cb3f554e38 Make test types compatible with Doctrine DBAL 4.0.x-dev 2022-01-18 15:33:48 -08:00
Alexander M. Turek
3999837279 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Deprecate MultiGetRegion (#9397)
  Fix type on loadCacheEntry (#9398)
  Update baselines for DBAL 3.3 (#9393)
  Accessing private properties and methods from the same class is forbidden (#9311)
  Expose enumType to DBAL to make native DB Enum possible (#9382)
2022-01-18 23:38:49 +01:00
Alexander M. Turek
026bba23f1 Merge branch '2.11.x' into 2.12.x
* 2.11.x:
  Fix type on loadCacheEntry (#9398)
2022-01-18 23:35:01 +01:00
Alexander M. Turek
4305cb9230 Deprecate MultiGetRegion (#9397) 2022-01-18 22:50:26 +01:00
Alexander M. Turek
d7b7c28ae5 Fix type on loadCacheEntry (#9398) 2022-01-18 22:49:52 +01:00
Alexander M. Turek
9d3ad08a82 Stabilize DBAL dependency (#9395) 2022-01-18 10:39:40 +01:00
Alexander M. Turek
2886d0dc92 Merge 2.11.x into 2.12.x (#9394)
* Expose enumType to DBAL to make native DB Enum possible (#9382)

* Accessing private properties and methods from the same class is forbidden (#9311)

Resolves issue https://github.com/doctrine/common/issues/934

Update docs/en/cookbook/accessing-private-properties-of-the-same-class-from-different-instance.rst

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>

Update docs/en/cookbook/accessing-private-properties-of-the-same-class-from-different-instance.rst

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>

Fix review issues

* Update baselines for DBAL 3.3 (#9393)

Co-authored-by: Vadim Borodavko <vadim.borodavko@gmail.com>
Co-authored-by: olsavmic <molsavsky1@gmail.com>
2022-01-18 09:45:05 +01:00
Alexander M. Turek
d6fd510c49 Update baselines for DBAL 3.3 (#9393) 2022-01-18 09:13:14 +01:00
Alexander M. Turek
a21843f974 Remove AbstractIdGenerator::generate() (#9367)
… and add native types to ID generators
2022-01-17 23:19:58 +01:00
olsavmic
a2a7d5bb01 Accessing private properties and methods from the same class is forbidden (#9311)
Resolves issue https://github.com/doctrine/common/issues/934

Update docs/en/cookbook/accessing-private-properties-of-the-same-class-from-different-instance.rst

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>

Update docs/en/cookbook/accessing-private-properties-of-the-same-class-from-different-instance.rst

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>

Fix review issues
2022-01-17 23:15:31 +01:00
Alexander M. Turek
fd2bab9b11 Merge branch '2.12.x' into 3.0.x
* 2.12.x:
  Allow using Enum from different namespace than Entity (#9384)
  Corrected ORM version and added missing dependency (#9386)
  PHPStan 1.4.0 (#9385)
  [GH-9380] Bugfix: Delegate ReflectionEnumProperty::getAttributes(). (#9381)
  Support enum cases as parameters (#9373)
  Add detach as of list cascade-all operations (#9357)
2022-01-17 11:58:21 +01:00
Vadim Borodavko
223b2650c4 Expose enumType to DBAL to make native DB Enum possible (#9382) 2022-01-17 10:39:16 +01:00
Alexander M. Turek
07f1c4e8f8 Merge pull request #9387 from doctrine/2.11.x 2022-01-16 21:39:56 +01:00
Vadim Borodavko
01c1644d9c Allow using Enum from different namespace than Entity (#9384) 2022-01-16 13:08:30 +01:00
Sukhdev Mohan
3eff2d4b3f Corrected ORM version and added missing dependency (#9386)
* Corrected ORM version and added missing dependency

Noticed that the version wasn't updated, pointing to 2.11.0 instead of 2.10.2. 
Also when following this tutotial ran into missing dependency for "doctrine/annotation" so added that too.

* Tutorial: Bump DBAL, YAML and Cache

Co-authored-by: Alexander M. Turek <me@derrabus.de>
2022-01-16 02:28:30 +01:00
Alexander M. Turek
9ddf8b96f8 PHPStan 1.4.0 (#9385) 2022-01-16 01:22:41 +01:00
Benjamin Eberlei
3d00fa817a [GH-9380] Bugfix: Delegate ReflectionEnumProperty::getAttributes(). (#9381)
* [GH-9380] Bugfix: Delegate ReflectionEnumProperty::getAttributes().

* [GH-9380] Add test for retrieving attributes via enum property.

* [GH-9380] Add test for retrieving attributes via enum property.

* [GH-9380] Call parent ReflectionProperty ctor for best behavior.

* Update tests/Doctrine/Tests/ORM/Functional/EnumTest.php

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2022-01-16 00:06:59 +01:00
Alexander M. Turek
0809a2b671 Support enum cases as parameters (#9373) 2022-01-13 13:11:13 +01:00
Andrii Dembitskyi
c0a1404e4c Add detach as of list cascade-all operations (#9357) 2022-01-12 22:33:11 +01:00
Alexander M. Turek
7d8134ca36 Merge release 2.11.0 into 3.0.x (#9369) 2022-01-12 14:38:36 +01:00
Alexander M. Turek
fc287b2943 Merge branch '3.0.x' into 2.11.x-merge-up-into-3.0.x_gaayDumb 2022-01-12 14:31:05 +01:00
Alexander M. Turek
4b1a419883 Remove Configuration::ensureProductionSettings() (#9358) 2022-01-12 14:29:07 +01:00
Alexander M. Turek
bfed8cb6ed Update branch metadata for 2.11 (#9364) 2022-01-12 14:20:33 +01:00
Alexander M. Turek
09a2648f7e Fix doc blocks on ID generators (#9368) 2022-01-12 12:10:23 +01:00
Alexander M. Turek
002587824e Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  Use EntityManagerInterface in type declarations (#9325)
  Add errors caused by the lexer update to the baselines (#9360)
  Generated/Virtual Columns: Insertable / Updateable (#9118)
  Remove the composer/package-versions-deprecated package
  Relax assertion to include null as possible outcome (#9355)
2022-01-12 11:10:49 +01:00
Alexander M. Turek
ee591195cf Use EntityManagerInterface in type declarations (#9325) 2022-01-12 11:00:07 +01:00
Alexander M. Turek
96241294bb Add native types to AbstractHydrator and child classes (#9353) 2022-01-12 10:57:33 +01:00
Alexander M. Turek
e974313523 Merge branch '2.10.x' into 2.11.x
* 2.10.x:
  Add errors caused by the lexer update to the baselines (#9360)
2022-01-12 10:11:19 +01:00
Alexander M. Turek
1e972b6e0e Add errors caused by the lexer update to the baselines (#9360) 2022-01-12 10:06:40 +01:00
Christian Mehldau
e369cb6e73 Generated/Virtual Columns: Insertable / Updateable (#9118)
* Generated/Virtual Columns: Insertable / Updateable

Defines whether a column is included in an SQL INSERT and/or UPDATE statement.
Throws an exception for UPDATE statements attempting to update this field/column.

Closes #5728

* Apply suggestions from code review

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>

* Add example for virtual column usage in attributes to docs.

Co-authored-by: Benjamin Eberlei <kontakt@beberlei.de>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2022-01-12 08:06:11 +01:00
Grégoire Paris
ec391be4f2 Merge pull request #9356 from derrabus/remove/package-versions
Remove the `composer/package-versions-deprecated` package
2022-01-11 21:03:59 +01:00
Alexander M. Turek
697e23422f Remove the composer/package-versions-deprecated package 2022-01-11 10:42:42 +01:00
Alexander M. Turek
9f85e2769c Add native types to command classes (#9359) 2022-01-11 08:53:17 +01:00
Alexander M. Turek
e487b6fe2b Relax assertion to include null as possible outcome (#9355) 2022-01-10 23:09:02 +01:00
Alexander M. Turek
cf62f931d9 Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  Leverage generic ObjectManagerDecorator (#9312)
  Fix WhereInWalker description to better describe the behaviour of this class (#9268)
  Regenerate Psalm baseline
  Update Psalm baseline for Persistence 2.3 (#9349)
  Support readonly properties for read operations (#9316)
2022-01-10 00:02:21 +01:00
Alexander M. Turek
656f881756 Merge branch '2.10.x' into 2.11.x
* 2.10.x:
  Fix WhereInWalker description to better describe the behaviour of this class (#9268)
2022-01-09 23:48:22 +01:00
Alexander M. Turek
cd2aa487a5 Leverage generic ObjectManagerDecorator (#9312) 2022-01-09 23:10:05 +01:00
LuigiCardamone
b7d822972e Fix WhereInWalker description to better describe the behaviour of this class (#9268)
* Fix WhereInWalker description:
- change the verb "replace" with "append" to better describe the behaviour of this class

* Rephrase comment in WhereInWalker as suggested from reviewer

Co-authored-by: Alexander M. Turek <me@derrabus.de>

* Rephrase comment in WhereInWalker as suggested from reviewer

Co-authored-by: Alexander M. Turek <me@derrabus.de>

Co-authored-by: Alexander M. Turek <me@derrabus.de>
2022-01-09 23:09:28 +01:00
Alexander M. Turek
ec63f5d32a Regenerate Psalm baseline 2022-01-09 22:35:05 +01:00
Alexander M. Turek
952ccc5fc8 Merge branch '2.10.x' into 2.11.x
* 2.10.x:
  Update Psalm baseline for Persistence 2.3 (#9349)
2022-01-09 22:33:24 +01:00
Alexander M. Turek
9a2f1f380d Update Psalm baseline for Persistence 2.3 (#9349) 2022-01-09 20:11:12 +00:00
Alexander M. Turek
580b9196e6 Support readonly properties for read operations (#9316)
* Provide failing test for readonly properties

* Skip writing readonly properties if the value did not change
2022-01-09 20:15:56 +01:00
Alexander M. Turek
1af202bf10 Remove support for Doctrine Cache in second level cache (#9348) 2022-01-09 18:25:51 +01:00
Alexander M. Turek
98331a662f Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  PHPStan 1.3.3, Psalm 4.18.1
  Remove Psalm job for analyzing DBAL 2
  Use the readonly annotation (#9340)
  Add support for custom types with requireSQLConversion and ResultSetMappingBuilder::generateSelectClause()
  PSR-6 second level cache
  Fix type errors in AbstractQuery and QueryBuilder (#9275)
  Mark columnName as always set
  Add support for PHP 8.1 enums.
  Remove ignore rules for issues fixed upstream (#9336)
  [GH-9277] deprecate php driver (#9309)
2022-01-09 17:30:10 +01:00
Grégoire Paris
0d911b9381 Merge pull request #9322 from derrabus/feature/psr-region-cache
PSR-6 second level cache
2022-01-09 16:23:04 +01:00
Grégoire Paris
c6d8aecc0f Merge pull request #9326 from kimhemsoe/rsm-custom-type
Add support for custom types with requireSQLConversion and ResultSetMappingBuilder::generateSelectClause()
2022-01-09 16:17:31 +01:00
Grégoire Paris
fdd3d112b0 Merge remote-tracking branch 'origin/2.10.x' into 2.11.x 2022-01-09 15:50:52 +01:00
Grégoire Paris
2fecb3cb1a Merge pull request #9341 from derrabus/bump/phpstan-psalm
PHPStan 1.3.3, Psalm 4.18.1
2022-01-09 15:48:49 +01:00
Alexander M. Turek
f3630ea16b PHPStan 1.3.3, Psalm 4.18.1 2022-01-09 15:39:44 +01:00
Grégoire Paris
fd19444761 Merge pull request #9344 from greg0ire/remove-dbal2-psalm-job
Remove Psalm job for analyzing DBAL 2
2022-01-09 15:38:56 +01:00
Grégoire Paris
4b1afb41b3 Remove Psalm job for analyzing DBAL 2
As of now, we cannot have specific config files for each DBAL version
and avoid repetition. We already have PHPStan performing checks with
DBAL 2, which could be considered enough.
2022-01-09 13:57:00 +01:00
Alexander M. Turek
f9f453f4d7 Use the readonly annotation (#9340) 2022-01-09 12:25:04 +01:00
Kim Hemsø Rasmussen
f508a4bb71 Add support for custom types with requireSQLConversion and ResultSetMappingBuilder::generateSelectClause() 2022-01-09 10:02:30 +01:00
Alexander M. Turek
5d0fbc47d0 PSR-6 second level cache 2022-01-09 02:02:50 +01:00
Alexander M. Turek
1e977426eb Fix type errors in AbstractQuery and QueryBuilder (#9275) 2022-01-09 00:26:58 +01:00
Grégoire Paris
2640f88f8a Merge pull request #9339 from greg0ire/fix-field-mapping-typing
Fix field mapping typing
2022-01-08 23:57:48 +01:00
Grégoire Paris
fa731b10ec Mark columnName as always set
This is enforced before writing to the property that holds FieldMapping
arrays.
As shown by the static analysis baselines reduction, this existence is
relied on throughout the codebase.
2022-01-08 14:12:04 +01:00
Grégoire Paris
4117ca349f Merge pull request #9304 from beberlei/EnumSupport
Add support for PHP 8.1 enums.
2022-01-08 11:49:08 +01:00
Benjamin Eberlei
2d475c9bb3 Add support for PHP 8.1 enums. 2022-01-08 09:53:11 +01:00
Grégoire Paris
6f54011e7b Merge remote-tracking branch 'origin/2.10.x' into 2.11.x 2022-01-07 20:28:54 +01:00
Grégoire Paris
760397c429 Remove ignore rules for issues fixed upstream (#9336)
The rules still should apply when using DBAL v2
2022-01-07 20:25:00 +01:00
Benjamin Eberlei
2dce2d0d63 [GH-9277] remove deprecated PHPDriver (#9308)
* Remove deprecated PHPDriver mapping driver, use StaticPHPDriver instead.

* Update docs

* Housekeeping

* Update UPGRADE.md
2022-01-06 10:24:05 +01:00
Benjamin Eberlei
7190ac5127 [GH-9277] deprecate php driver (#9309)
* [GH-9277] Deprecate PHPDriver

* Update UPGRADE.md, fix wrong parameter

* Copy docblock to appease confused Psalm

* Talk about alternatives more
2022-01-06 10:19:42 +01:00
Alexander M. Turek
80bca72915 Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  Added runtime deprecation to `UnitOfWork::commit()` and `clear()` (#9327)
  Document return type of getEntityState() (#9328)
  Fix broken type declaration (#9330)
  Enable some previously disabled PHPCS rules (#9324)
2022-01-05 10:06:28 +01:00
Alexander M. Turek
ceaefcb18d Merge 2.10.x into 2.11.x (#9331)
* Enable some previously disabled PHPCS rules (#9324)

* Fix broken type declaration (#9330)
2022-01-05 10:03:45 +01:00
Alexander M. Turek
844ce77cae Added runtime deprecation to UnitOfWork::commit() and clear() (#9327) 2022-01-05 08:14:46 +01:00
Alexander M. Turek
cf3a185b62 Document return type of getEntityState() (#9328) 2022-01-05 07:58:21 +01:00
Alexander M. Turek
2a0c73d0e5 Add types to UnitOfWork (#9329) 2022-01-05 07:57:09 +01:00
Alexander M. Turek
efc982a48d Fix broken type declaration (#9330) 2022-01-05 07:55:33 +01:00
Alexander M. Turek
ea97ea4c47 Add types to entity manager (#9292) 2022-01-05 00:29:22 +01:00
Alexander M. Turek
96bc214acd Enable some previously disabled PHPCS rules (#9324) 2022-01-03 23:25:34 +01:00
Alexander M. Turek
081f3e43c0 Enable PHPCS rules for PHP 8.0 (#9293) 2022-01-02 21:29:38 +01:00
Alexander M. Turek
9b3d89db04 Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  Run static analysis with language level PHP 8.1 (#9314)
  Document LockMode enums (#9319)
  Document PHPUnit mocks with intersection types (#9318)
  Run PHP CodeSniffer on PHP 8.1 (#9317)
  Psalm 4.17.0 (#9315)
  Run static analysis on PHP 8.1 (#9310)
2022-01-02 20:18:23 +01:00
Alexander M. Turek
15999758a7 Merge branch '2.10.x' into 2.11.x
* 2.10.x:
  Run static analysis with language level PHP 8.1 (#9314)
  Document PHPUnit mocks with intersection types (#9318)
2022-01-02 19:36:10 +01:00
Alexander M. Turek
44aa8c2c5b Run static analysis with language level PHP 8.1 (#9314) 2022-01-02 18:01:31 +01:00
Alexander M. Turek
8c6fc5ae52 Document LockMode enums (#9319) 2022-01-02 18:01:00 +01:00
Alexander M. Turek
c4561571aa Document PHPUnit mocks with intersection types (#9318) 2022-01-02 18:00:17 +01:00
Alexander M. Turek
40a203843d Merge branch '2.10.x' into 2.11.x
* 2.10.x:
  Run PHP CodeSniffer on PHP 8.1 (#9317)
  Psalm 4.17.0 (#9315)
2022-01-02 14:16:56 +01:00
Alexander M. Turek
8b5ee54c6a Run PHP CodeSniffer on PHP 8.1 (#9317) 2022-01-02 14:15:30 +01:00
Alexander M. Turek
f151daa2f9 Replace mocks with middlewares. (#9291) 2022-01-02 13:04:19 +01:00
Alexander M. Turek
03fa495fbc Psalm 4.17.0 (#9315) 2022-01-01 23:41:05 +01:00
Alexander M. Turek
5901848944 Merge 2.10.x into 2.11.x (#9313) 2022-01-01 23:40:19 +01:00
Grégoire Paris
d40f9e57ff Run static analysis on PHP 8.1 (#9310)
This will make it easier to add code that leverages features only
defined since that version of PHP.
2022-01-01 20:28:17 +01:00
Alexander M. Turek
4b062a4010 Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  Bump PHPStan & Psalm (#9303)
  Removing list "Lifecycle Events" (#9243)
  Drop unneeded backslashes
  Fix Hidden fields triggering error when using getSingleScalarResult() (#8340)
  Findby joined lookup (#8285)
2021-12-31 03:09:21 +01:00
Alexander M. Turek
133cc95f33 Merge branch '2.10.x' into 2.11.x
* 2.10.x:
  Bump PHPStan & Psalm (#9303)
  Removing list "Lifecycle Events" (#9243)
  Drop unneeded backslashes
  Fix Hidden fields triggering error when using getSingleScalarResult() (#8340)
  Findby joined lookup (#8285)
2021-12-31 02:59:55 +01:00
Alexander M. Turek
d30e748e64 Bump PHPStan & Psalm (#9303) 2021-12-31 02:21:15 +01:00
Alexander M. Turek
d7817793c3 Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  Fix type errors in AnnotationDriver (#9274)
2021-12-30 01:06:24 +01:00
Alexander M. Turek
98d77043d8 Fix type errors in AnnotationDriver (#9274) 2021-12-29 16:03:10 +01:00
Grégoire Paris
40d1e7bbfc Merge pull request #9214 from doctrine/2.7
Merge 2.7 into 2.10.x
2021-12-28 23:41:38 +01:00
Thomas Landauer
e8275f6e4d Removing list "Lifecycle Events" (#9243)
As announced in https://github.com/doctrine/orm/pull/9184#issuecomment-965837780
2021-12-28 14:04:58 +01:00
Alexander M. Turek
3f2cc10bfe Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  Leverage get_debug_type() (#9297)
  Fix return type (#9295)
  Synchronize Psalm baseline (#9296)
  Fix union type on QueryExpressionVisitorTest::testWalkComparison() (#9294)
  Allow arithmetic expressions within IN operator (#9242)
  Bump reusable workflows
2021-12-28 10:29:29 +01:00
Alexander M. Turek
70dcffa025 Leverage get_debug_type() (#9297) 2021-12-28 08:02:16 +01:00
Alexander M. Turek
c94a9b1d8b Merge 2.10.x into 2.11.x (#9298)
* Bump reusable workflows

* Fix union type on QueryExpressionVisitorTest::testWalkComparison() (#9294)

* Synchronize Psalm baseline (#9296)

* Fix return type (#9295)

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-12-28 01:25:01 +01:00
Alexander M. Turek
6a9393e8ed Fix return type (#9295) 2021-12-28 00:49:50 +01:00
Alexander M. Turek
ab98d0ffc6 Synchronize Psalm baseline (#9296) 2021-12-28 00:49:32 +01:00
Alexander M. Turek
2ddeb79431 Fix union type on QueryExpressionVisitorTest::testWalkComparison() (#9294) 2021-12-27 23:43:09 +01:00
Alexander M. Turek
9c07649287 Drop support for PHP 7.4 (#9290) 2021-12-27 19:57:51 +01:00
David ALLIX
92ff9c9108 Allow arithmetic expressions within IN operator (#9242)
* allow arithmetic expressions within IN operator

Co-authored-by: Artem Stepin <stepin.artem@gmail.com>
2021-12-27 19:03:47 +01:00
Grégoire Paris
7c58dc89c3 Merge pull request #9289 from derrabus/bump/workflows
Bump reusable workflows
2021-12-27 18:36:35 +01:00
Alexander M. Turek
b513f7c935 Bump reusable workflows 2021-12-27 13:05:20 +01:00
Alexander M. Turek
47f931c8b2 Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  Enable UnusedUse sniff again (#9267)
  Whitelist composer plugins used by this repository (#9286)
  Fix XML export for `change-tracking-policy` (#9285)
  Allow symfony/cache 6 (#9283)
  Put actual value instead of index inside $originalEntityData. (#9244)
  Fix return types of cache interfaces (#9271)
  Better explain limitations of DQL "DELETE" (#9281)
  Fix docblocks on nullable EM properties (#9273)
  Docs: use canonical order for phpdoc tags, add missed semicolon (#9190)
  Make PrimaryReadReplicaConnection enforcement explicit (#9239)
  Regenerate Psalm baseline (#9272)
  Improve compatibility with Doctrine DBAL 4 (#9266)
  [docs] Fix wording for attributes=>parameters. (#9265)
  Support for nesting attributes with PHP 8.1 (#9241)
  Revert "Fix SchemaValidator with abstract child class in discriminator map (#9096)" (#9262)
  Docs: consistency for FQCN, spacing, etc (#9232)
2021-12-26 01:31:31 +01:00
Alexander M. Turek
f1483f848c Merge 2.10.x into 2.11.x (#9287)
* Better explain limitations of DQL "DELETE" (#9281)

We think the current documentation does not stress these details enough, so that they are easily overlooked.

Co-authored-by: Malte Wunsch <mw@webfactory.de>

Co-authored-by: Malte Wunsch <mw@webfactory.de>

* Put actual value instead of index inside $originalEntityData. (#9244)

This fixes a bug with redundant UPDATE queries, that are executed when some entity uses foreign index of other entity as a primary key. This happens when after inserting related entities with $em->flush() call, you do the second $em->flush() without changing any data inside entities.
Fixes GH8217.

Co-authored-by: ivan <ivan.strygin@managinglife.com>

* Allow symfony/cache 6 (#9283)

* Fix XML export for `change-tracking-policy` (#9285)

* Whitelist composer plugins used by this repository (#9286)

Co-authored-by: Matthias Pigulla <mp@webfactory.de>
Co-authored-by: Malte Wunsch <mw@webfactory.de>
Co-authored-by: Ivan Strygin <feolius@gmail.com>
Co-authored-by: ivan <ivan.strygin@managinglife.com>
Co-authored-by: Fedir Zinchuk <getthesite@gmail.com>
2021-12-26 01:06:54 +01:00
Alexander M. Turek
ea4c9b21b7 Enable UnusedUse sniff again (#9267) 2021-12-25 23:06:50 +01:00
Alexander M. Turek
61e2caf818 Remove EntityManager::transactional() (#9278) 2021-12-25 23:06:29 +01:00
Alexander M. Turek
72edfbc270 Whitelist composer plugins used by this repository (#9286) 2021-12-25 13:04:42 +01:00
Fedir Zinchuk
5ccf2eac40 Fix XML export for change-tracking-policy (#9285) 2021-12-24 00:22:42 +01:00
Alexander M. Turek
6696b0dfbf Allow symfony/cache 6 (#9283) 2021-12-24 00:12:11 +01:00
Ivan Strygin
aead77d597 Put actual value instead of index inside $originalEntityData. (#9244)
This fixes a bug with redundant UPDATE queries, that are executed when some entity uses foreign index of other entity as a primary key. This happens when after inserting related entities with $em->flush() call, you do the second $em->flush() without changing any data inside entities.
Fixes GH8217.

Co-authored-by: ivan <ivan.strygin@managinglife.com>
2021-12-24 00:10:42 +01:00
Alexander M. Turek
130c27c1da Fix return types of cache interfaces (#9271) 2021-12-22 01:04:07 +01:00
Matthias Pigulla
f6e1dd44f0 Better explain limitations of DQL "DELETE" (#9281)
We think the current documentation does not stress these details enough, so that they are easily overlooked.

Co-authored-by: Malte Wunsch <mw@webfactory.de>

Co-authored-by: Malte Wunsch <mw@webfactory.de>
2021-12-22 00:44:25 +01:00
Alexander M. Turek
1e9973a0c0 Merge release 2.10.4 into 2.11.x (#9280) 2021-12-21 11:01:59 +01:00
Alexander M. Turek
91761738fd Fix docblocks on nullable EM properties (#9273) 2021-12-20 22:31:57 +01:00
Andrii Dembitskyi
cccb2e2fdf Docs: use canonical order for phpdoc tags, add missed semicolon (#9190) 2021-12-20 22:23:47 +01:00
Benjamin Eberlei
18138d895e Make PrimaryReadReplicaConnection enforcement explicit (#9239)
* Move primary replica connection logic into ORM explicitly.

* Housekeeping: Use full named variables

* Housekeeping: phpcs
2021-12-20 13:50:25 +01:00
Alexander M. Turek
95d434d003 Merge 2.10.x into 2.11.x (#9276)
* Docs: consistency for FQCN, spacing, etc (#9232)

* Docs: consistent spacing, consistent array-style, consistent FQCN, avoid double escaped slashes, avoid double quotes if not necessary

* Docs: use special note block instead of markdown-based style

* Docs: Quote FQCN in table with backticks to be compatible with all render engines

* Drop all mentions API doc - it is not available anymore

* Add missed FQCN for code snippets

* Revert "Fix SchemaValidator with abstract child class in discriminator map (#9096)" (#9262)

This reverts commit bbb68d0072.

* [docs] Fix wording for attributes=>parameters. (#9265)

Co-authored-by: Andrii Dembitskyi <andrew.dembitskiy@gmail.com>
Co-authored-by: olsavmic <molsavsky1@gmail.com>
Co-authored-by: Benjamin Eberlei <kontakt@beberlei.de>
2021-12-20 04:11:33 +01:00
Alexander M. Turek
70c651ebb7 Regenerate Psalm baseline (#9272) 2021-12-19 17:06:20 +01:00
Sergei Morozov
8cb62a616a Improve compatibility with Doctrine DBAL 4 (#9266)
* Improve compatibility with AbstractPlatform::getLocateExpression() in DBAL 4

* Improve compatibility with AbstractPlatform::getTrimExpression() in DBAL 4

* Improve compatibility with Connection::quote() in DBAL 4
2021-12-19 13:19:30 +01:00
Sergei Morozov
ad97969e93 Remove the orm:ensure-production-settings console command (#9263) 2021-12-18 11:17:37 +01:00
Benjamin Eberlei
fa2b52c974 [docs] Fix wording for attributes=>parameters. (#9265) 2021-12-18 11:16:35 +01:00
Benjamin Eberlei
6d306c1946 Support for nesting attributes with PHP 8.1 (#9241)
* [GH-9240] Refactor Association/AttributeOverrides to use @NamedConstructorArguments with AnnotationDriver.

* [GH-9240] Add support for PHP 8.1 nested attributes.

Supported/new attributes are #[AttributeOverrides], #[AssociationOverrides], #[JoinTable] with nested joinColumns, inverseJoinColumns.

* [GH-9240] Add support for nesting Index, UniqueCosntraint into #[Table] on PHP 8.1

* Apply review comments by gregooire.

* Add documentation for new attributes.

* Add docs for new nested #[JoinTable] support of join columns

* Add docs for new nested #[Table] support of index, uniqueConstraints

* Rename "Required/Optional atttributes" to "Required/Optional parameters"

* Remove nesting for JoinTable#joinColumns and Table#indexes/uniqueConstraints again.

* Hosuekeeping: phpcs/psalm

* housekeeping

* Remove unused function imports.
2021-12-18 11:03:12 +01:00
olsavmic
5bf814032f Revert "Fix SchemaValidator with abstract child class in discriminator map (#9096)" (#9262)
This reverts commit bbb68d0072.
2021-12-18 11:01:30 +01:00
Sergei Morozov
25ca8dc835 Merge pull request #9259 from morozov/dbal-3.2-deprecations
Do not use AbstractPlatform::canEmulateSchemas()
2021-12-17 07:41:24 -08:00
Sergei Morozov
a41c6d32c3 Do not use AbstractPlatform::canEmulateSchemas() 2021-12-16 22:21:38 -08:00
Alexander M. Turek
f2e34bd172 Remove DBAL 2 compat code 2021-12-16 23:35:09 +01:00
Alexander M. Turek
5bbd1d20cf Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  Address more DBAL 3.2 deprecations (#9256)
2021-12-16 23:28:03 +01:00
Sergei Morozov
bea5e7166c Address more DBAL 3.2 deprecations (#9256)
* Instantiate comparator via the schema manager, if possible

* Do not use AbstractPlatform::getName()
2021-12-16 23:18:18 +01:00
Alexander M. Turek
ff44938f9f Remove Setup::registerAutoloadDirectory() (#9251) 2021-12-14 10:06:46 +01:00
Alexander M. Turek
414aae50c2 Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  Deprecate Setup::registerAutoloadDirectory() (#9249)
  PHPCS 3.6.2, Psalm 4.15.0 (#9247)
  Add SchemaIgnoreClasses property for #8195. (#9202)
  Remove fallbacks for old doctrine/annotations version (#9235)
  Update docs/en/reference/events.rst
  Added psalm param to abstract addFilterConstraint (#9229)
  Merge pull request #9210 from alexander-schranz/patch-2
  Fix typo assumptio--> assumption
  Update events.rst
  Completing links to `EventArgs` classes in overview table
  Using `const` for `type`
  [Documentation] Events Overview Table: Adding "Passed Argument" column
2021-12-14 00:12:10 +01:00
Alexander M. Turek
003090b70c Deprecate Setup::registerAutoloadDirectory() (#9249) 2021-12-13 23:36:10 +01:00
Andrii Dembitskyi
02a4e4099d Docs: consistency for FQCN, spacing, etc (#9232)
* Docs: consistent spacing, consistent array-style, consistent FQCN, avoid double escaped slashes, avoid double quotes if not necessary

* Docs: use special note block instead of markdown-based style

* Docs: Quote FQCN in table with backticks to be compatible with all render engines

* Drop all mentions API doc - it is not available anymore

* Add missed FQCN for code snippets
2021-12-13 23:10:01 +01:00
Alexander M. Turek
56e0ac02af Merge 2.10.x into 2.11.x (#9248) 2021-12-13 22:21:00 +01:00
Alexander M. Turek
12a70bbefb PHPCS 3.6.2, Psalm 4.15.0 (#9247) 2021-12-13 21:28:56 +01:00
Alexander M. Turek
36160a81fb Remove YAML metadata mapping (#9237) 2021-12-13 19:43:11 +01:00
Grégoire Paris
5a4ddb2870 Merge pull request #9184 from ThomasLandauer/patch-1
[Documentation] Events Overview Table: Adding "Passed Argument" column
2021-12-12 16:21:13 +01:00
Simon Podlipsky
42195060e6 Add SchemaIgnoreClasses property for #8195. (#9202)
Co-authored-by: Simon Podlipsky <simon@podlipsky.net>

Co-authored-by: Iab Foulds <ianfoulds@x-act.co.uk>
2021-12-12 13:42:07 +01:00
Alexander M. Turek
68fa55f310 Remove fallbacks for old doctrine/annotations version (#9235) 2021-12-11 17:11:34 +01:00
Alexander M. Turek
36a4f662b2 Remove code generators (#9226) 2021-12-11 13:31:40 +01:00
Thomas Landauer
0b0c3e7e58 Update docs/en/reference/events.rst
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-12-09 12:00:30 +01:00
Kevin van Sonsbeek
92434f91c7 Added psalm param to abstract addFilterConstraint (#9229) 2021-12-08 22:31:52 +00:00
Alexander M. Turek
3d406e5213 Remove the Version class (#9227) 2021-12-06 13:27:13 +01:00
Alexander Schranz
6414ad4cbb Merge pull request #9210 from alexander-schranz/patch-2
Fix making columns  optional in indexes xml schema as they can be defined via fields now
2021-12-06 00:55:01 +01:00
Alexander M. Turek
ac5aea1c81 Merge release 2.10.3 into 2.11.x (#9224) 2021-12-03 22:40:00 +01:00
Alexander M. Turek
61237d4c08 Merge 2.11.x into 3.0.x (#9220) 2021-12-03 18:59:43 +01:00
Alexander M. Turek
a75605b8c3 Merge pull request #9211 from derrabus/deprecate/convert-mapping
Add deprecation hints to `orm:convert-mapping` command
2021-12-03 15:50:09 +01:00
Grégoire Paris
7b24275346 Merge pull request #9218 from Florian-Varrin/patch-1
Fix typo assumptio--> assumption
2021-12-03 13:27:05 +01:00
Florian Varrin
ed1a576305 Fix typo assumptio--> assumption 2021-12-03 11:39:59 +01:00
Grégoire Paris
66c95a65c5 Drop unneeded backslashes 2021-12-01 21:53:36 +01:00
Bruce
62a0d7359b Fix Hidden fields triggering error when using getSingleScalarResult() (#8340)
* Fix Hidden fields triggering error when using getSingleScalarResult()

Fixes #4257
HIDDEN fields was causing the "unicity" check to fail (NonUniqueResultException), because we was counting raw data instead of gathered row data.

* Fix Coding Standards (7.4)

* Fix Coding Standards (7.4) #2

* Fix Coding Standards (7.4) - Fix whitespaces

* Fix Coding Standards (7.4) - Fix whitespaces in tests

* Fix Coding Standards (7.4) - Fix more things

* Refactor tests into separate methods

* Fix Coding Standards (7.4) - Equals sign not aligned with surrounding assignments
2021-12-01 21:52:31 +01:00
Benjamin Eberlei
2c7d7ebb48 Findby joined lookup (#8285)
* [GH-7512] Bugfix: Load metadata on object-typed  value in EntityPersisters

* [GH-7512] Refactor double check for object/entity and flatten code.

Co-authored-by: Joe Mizzi <themizzi@me.com>
2021-12-01 21:52:29 +01:00
Thomas Landauer
8b6fe52f74 Update events.rst 2021-12-01 01:01:04 +01:00
Alexander M. Turek
eabb7f84e9 Add deprecation hints to orm:convert-mapping command 2021-11-30 23:04:44 +01:00
Alexander M. Turek
f0a20dbc9c Merge 2.10.x into 2.11.x (#9213) 2021-11-30 22:37:08 +01:00
Alexander M. Turek
15ec77fa79 Suppress Psalm's ReservedWord errors (#9212) 2021-11-30 20:20:27 +01:00
Thomas Landauer
32cd2106d0 Completing links to EventArgs classes in overview table
Questions:
1. Is https://github.com/doctrine/persistence/blob/master/lib/Doctrine/Persistence/Event/LifecycleEventArgs.php correct at all? Shouldn't this be https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/LifecycleEventArgs.php, like all the others?

2. Which one is correct for `preUpdate`? https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/events.html#entity-listeners-class says `PreUpdateEventArgs`, but https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/events.html#listening-and-subscribing-to-lifecycle-events says `LifecycleEventArgs`

For the two links to `doctrine/persistence`, I'm linking to `/master/` now, which is being forwarded to `/2.2.x/`.
2021-11-30 15:51:20 +01:00
Alexander M. Turek
341c6b2929 Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  Add missing deprecations for YAML metadata mapping (#9206)
  Drop support for DBAL 3.1
  Psalm 4.13.1, PHPStan 1.2.0 (#9204)
  Add a psalm type for field mapping
  Use `equal to` instead of `equal of` in `assertSqlGeneration()` (#9195)
  Adding Attributes code block (#9161)
2021-11-29 17:28:44 +01:00
Alexander M. Turek
6857a2e8d4 Add missing deprecations for YAML metadata mapping (#9206) 2021-11-29 16:46:05 +01:00
Alexander M. Turek
5e8b34ae30 Merge pull request #9203 from derrabus/bump/dbal-3.2
Drop support for DBAL 3.1
2021-11-29 16:45:30 +01:00
Alexander M. Turek
a9b682b7c0 Drop support for DBAL 3.1 2021-11-29 10:37:05 +01:00
Alexander M. Turek
0aadc456dc Merge 2.10.x into 2.11.x (#9205)
* Adding Attributes code block (#9161)

Just that there is some real-world example somewhere ;-) see https://github.com/doctrine/orm/issues/9020#issuecomment-955582801

* Use `equal to` instead of `equal of` in `assertSqlGeneration()` (#9195)

* Add a psalm type for field mapping

Field mapping have different definitions
in property definition and method return.
As suggested in issue and to avoid further desynchronization,
a psalm type has been created.
Fixes #9193

* Psalm 4.13.1, PHPStan 1.2.0 (#9204)

Co-authored-by: Thomas Landauer <thomas@landauer.at>
Co-authored-by: Simon Podlipsky <simon@podlipsky.net>
Co-authored-by: Julien LARY <47776596+laryjulien@users.noreply.github.com>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-11-28 01:08:49 +01:00
Alexander M. Turek
cac2acae07 Psalm 4.13.1, PHPStan 1.2.0 (#9204) 2021-11-28 00:50:56 +01:00
Grégoire Paris
146b465ec1 Merge pull request #9198 from laryjulien/fix-fieldmapping-definition
Add a psalm type for field mapping
2021-11-23 21:10:18 +01:00
Julien LARY
5aba762a33 Add a psalm type for field mapping
Field mapping have different definitions
in property definition and method return.
As suggested in issue and to avoid further desynchronization,
a psalm type has been created.
Fixes #9193
2021-11-23 18:05:47 +01:00
Thomas Landauer
77b7107d05 Using const for type 2021-11-23 01:41:01 +01:00
Simon Podlipsky
a663dda869 Use equal to instead of equal of in assertSqlGeneration() (#9195) 2021-11-20 21:27:46 +01:00
Thomas Landauer
db14f0fa89 Adding Attributes code block (#9161)
Just that there is some real-world example somewhere ;-) see https://github.com/doctrine/orm/issues/9020#issuecomment-955582801
2021-11-20 18:14:49 +01:00
Grégoire Paris
4f7a2dfb50 Merge pull request #9197 from greg0ire/3.0.x
Merge 2.11.x into 3.0.x
2021-11-20 15:56:19 +01:00
Grégoire Paris
0542c12aae Merge remote-tracking branch 'origin/2.11.x' into 3.0.x 2021-11-20 15:46:04 +01:00
Grégoire Paris
2488b4c50c Merge pull request #9196 from greg0ire/2.11.x
Merge 2.10.x up into 2.11.x
2021-11-20 15:38:36 +01:00
Grégoire Paris
ed642c72c9 Merge remote-tracking branch 'origin/2.10.x' into 2.11.x 2021-11-20 15:28:20 +01:00
Vincent Langlet
9a74ae6280 Fix discriminatorColumn phpdoc (#9168) 2021-11-11 23:01:34 +01:00
Grégoire Paris
32eb38ebd9 Merge pull request #9181 from greg0ire/fix-broken-build
Remove similar assertions for other platforms
2021-11-11 16:20:53 +01:00
Thomas Landauer
2dde65c4ba [Documentation] Events Overview Table: Adding "Passed Argument" column
As announced in https://github.com/doctrine/orm/pull/9160#issuecomment-954304588 I'm adding the passed "EventArgs" class to the overview table. Once this is complete, my further plan is to remove the entire paragraph https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/events.html#lifecycle-callbacks-event-argument, and probably also the second code block at https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/events.html#entity-listeners-class

Is there a better way to link to the source code of `LifecycleEventArgs` than https://github.com/doctrine/persistence/blob/2.2.x/lib/Doctrine/Persistence/Event/LifecycleEventArgs.php ?

Also, I changed `postLoad` to `preUpdate` in the code block, to have an example that does not receive `LifecycleEventArgs` ;-)
2021-11-11 00:22:25 +01:00
Thomas Landauer
176fbedc69 Fine-tuning codeblock (#9176)
* Deleting "Not needed for XML and YAML mapping" - this was stupid of me, since *all* annotations are obviously not needed in XML&YAML ;-)
* Shortening the @Column annotation, for consistency with the following event handlers
* Removing some blank lines from XML, for consistency with YAML
* Adding PHP Attributes
2021-11-10 22:43:09 +01:00
Grégoire Paris
1b15af44b6 Remove similar assertions for other platforms
Testing with several platforms should not increase code coverage here,
since the DBAL is responsible for providing the concat expression for
each platform.

Moreover, whenever that concat expression changes for one of the tested
platforms, this test will break.

In doctrine/dbal 3.2, that is the case for SQLServer2012Platform, which
means this test no longer passes.
2021-11-08 21:21:41 +01:00
Grégoire Paris
8336420a26 Merge pull request #9153 from armenio/2.10.x
Infer type from field instead of column
2021-11-08 07:45:07 +01:00
Thomas Landauer
1e971d85c4 Merging two ~identical lists on event types (#9160)
* Merging two ~identical lists on event types

Just noticed that what I added in https://github.com/doctrine/orm/pull/9128 was (in other words) already there ;-)

* Update docs/en/reference/events.rst

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>
2021-11-06 21:32:46 +01:00
Thomas Landauer
a6b7569d7a Fixing more links (#9154)
* Fixing more links

The first two I missed in https://github.com/doctrine/orm/pull/9151
The third is probably older.
Shouldn't the chapter name be displayed as link text by default?? Are you sure that everything is set up correctly with the parser?

* Update architecture.rst

* Update getting-started.rst

* Update events.rst
2021-11-06 20:49:54 +01:00
Rafael Armenio
9e37c788ef Infer type from field instead of column
getTypeOfColumn() relies on getTypeOfField(), and does not suffer from
mismatching issues caused by quoting, because you cannot quote a field.
Since a field can be composite, that method returns an array, hence why we
need to select the first element.
2021-11-05 13:58:53 -03:00
Grégoire Paris
ca0a6bbf71 Merge pull request #9167 from derrabus/bump/phpstan
PHPStan 1.0.1
2021-11-03 21:15:19 +01:00
Grégoire Paris
a3da3d78d4 Merge pull request #9159 from ThomasLandauer/patch-10
Merging Lifecycle Callbacks code samples for PHP + XML + YAML
2021-11-03 21:13:53 +01:00
Alexander M. Turek
e1c2d2e65d PHPStan 1.0.1
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-11-02 20:41:48 +01:00
Alexander Schranz
6f194eeabf Remove reverted bc break (#9166) 2021-11-01 13:56:12 +01:00
Grégoire Paris
16cbc16998 Document BC break (#9143)
Closes #9141
2021-10-30 19:10:25 +02:00
Thomas Landauer
5e6608b48e Update events.rst 2021-10-30 13:48:03 +02:00
Grégoire Paris
94bc137526 Merge pull request #9123 from phansys/quotes_in_column_names
Add XSD "orm:columntoken" type in order to support reserved words in column names
2021-10-29 18:19:35 +02:00
Thomas Landauer
276a0f55ee Removing paragraph on consts (#9158)
IMO, this is better shown by example, so I added it there.
2021-10-29 14:21:37 +02:00
Thomas Landauer
dbaf99f3d9 Update events.rst 2021-10-29 01:17:32 +02:00
Thomas Landauer
97411f5567 Merging Lifecycle Callbacks code samples for PHP + XML + YAML
IMO, the text I deleted just repeated things that are obvious in the example anyway.
2021-10-29 01:12:02 +02:00
Chase Noel
641330baa6 Add doctrine/dbal to project composer.json (#9152)
As discussed in https://github.com/doctrine/orm/issues/9078 when entities utilize data mappings which are provided by the dbal lib it is expected behavior that users will explicitly define their dependency on the package.

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-10-28 23:42:05 +02:00
Grégoire Paris
2074fc3ff9 Merge pull request #9133 from judahnator/2.10.x
Adding a setup helper for attribute metadata config
2021-10-28 22:23:25 +02:00
Thomas Landauer
35e680cd3f Fixing links in overview table (#9151)
I got them wrong in https://github.com/doctrine/orm/pull/9131 ;-)
2021-10-28 21:29:47 +02:00
Javier Spagnoletti
705d88eaba Add XSD "orm:columntoken" type in order to support reserved words in column names 2021-10-28 14:00:39 -03:00
Judah Wright
8fef44333b Adding a setup helper for attribute metadata config 2021-10-27 15:05:38 -07:00
Paul Waring
3271d8f6e2 Fix markup for variable names (#9150)
Three references to `$isDevMode` were marked up with a single backtick, however two backticks are required in order for the variable name to be highlighted correctly (c.f. `ArrayCache`).
2021-10-26 10:59:31 +00:00
Thomas Landauer
3622381f8c Overview table for events: Jump links (#9131)
* Overview table for events: Jump links

* Update events.rst
2021-10-25 22:34:36 +02:00
wickedOne
f2729b0610 Return 0 when there's no metadata to process (#9147) 2021-10-23 09:43:40 +00:00
chapterjason
cd44547573 Remove old use statements (#9146) 2021-10-23 11:32:44 +02:00
Grégoire Paris
3361691d0a Merge pull request #9140 from doctrine/2.10.x-merge-up-into-2.11.x_JJHD4HD8
Merge release 2.10.2 into 2.11.x
2021-10-21 20:49:48 +02:00
Grégoire Paris
81d472f6f9 Merge pull request #9139 from greg0ire/upgrade-workflows
Upgrade workflows to 1.1.1
2021-10-21 19:57:02 +02:00
Grégoire Paris
d458968cee Upgrade workflows to 1.1.1
That version fixes a bug with the release workflow. Releasing is not
possible unless we do that upgrade.
2021-10-21 19:55:57 +02:00
Alexander M. Turek
b6a2257758 Merge 2.10.x into 2.11.x (#9137) 2021-10-21 19:50:56 +02:00
Christophe Coevoet
5eb01da0a0 Fix the upgrade guide for 2.8 changes (#9138) 2021-10-21 16:44:42 +02:00
Grégoire Paris
5aaf361139 Merge pull request #9136 from greg0ire/revert-bc-break
Revert "Removing all the occurence of any"
2021-10-21 08:49:18 +02:00
Alexander M. Turek
6a8dcbc392 Regenerate Psalm baseline (#9135) 2021-10-20 23:30:57 +02:00
Grégoire Paris
12babcc1c2 Revert "Removing all the occurence of any"
This reverts commit 84afd6c937, because it
is a BC-break that seems to affect more people than we originally
thought it would.
2021-10-20 23:12:01 +02:00
Thomas Landauer
416aa1d2d7 Explaining the two major ways to register an event v2 (#9128)
Co-authored-by: Javier Spagnoletti <phansys@gmail.com>
2021-10-16 11:45:10 +02:00
Alexander M. Turek
06d9c584a3 Merge 2.10.x into 2.11.x (#9127) 2021-10-15 18:41:04 +02:00
Grégoire Paris
8e16bb4ddc Merge pull request #9126 from greg0ire/explicitly-pass-secrets
Explicitly pass secrets
2021-10-14 23:45:30 +02:00
Grégoire Paris
e1dee439bb Explicitly pass secrets
Secrets are sensitive and not passed implicitly.
2021-10-14 23:35:29 +02:00
Thomas Landauer
e313d012ae Overview table for events (#9039)
* Overview table for events

Better late than never - finally delivering what I announced at https://github.com/doctrine/orm/pull/8435#issuecomment-769940427 :-)

* Update events.rst

* Update events.rst

* Adding "Lifecycle Callback" column

* Update events.rst
2021-10-14 10:58:07 +02:00
Javier Spagnoletti
dede619b9e Add "@method" annotation for wrapInTransaction() method at EntityManagerInterface (#9091) 2021-10-13 20:18:50 +02:00
Grégoire Paris
142cfb39fc Merge pull request #9114 from greg0ire/try-out-reusable-workflows
Directly reference upstream CS workflow
2021-10-11 21:00:41 +02:00
Mariusz Soltys
203cd6ecf2 Changed EntityRepository count method $criteria parameter to optional (#9104)
Currently to get count of all items there is need to provide empty array
to count() method as $criteria parameter is required.  I believe there
shouldn't be a need to provide it if I want to count all Entities
without any criteria.
2021-10-11 17:42:13 +02:00
Alexander M. Turek
53d41a456a PHP CodeSniffer 3.6.1 (#9115) 2021-10-11 12:05:46 +02:00
Grégoire Paris
95b34ca940 Directly reference some upstream workflows 2021-10-10 21:08:57 +02:00
Paul Capron
3eaf76eebd Fix typo & minor issues in dql-custom-walkers.rst (#9113) 2021-10-09 23:29:38 +02:00
Grégoire Paris
5c12d36be3 Merge pull request #9107 from BackEndTea/patch-1
Remove the twitter #doctrine2 hashtag refference
2021-10-07 22:35:44 +02:00
Grégoire Paris
1ee68eb318 Merge pull request #9098 from ajgarlag/bugfix-indexed-iterable
Honor INDEX BY construct in Query::toIterable
2021-10-07 22:34:54 +02:00
orklah
705c7f0a4b [Psalm] always true/false conditions (#9108) 2021-10-07 20:21:58 +02:00
Gert de Pagter
8c5e49efc0 Remove the twitter #doctrine2 hashtag refference
Looking at twitter, the hashtag its hardly used. There was 1 question posted in the last year, and it went unanswered.

The `2` part has mostly been dropped everywhere, and orm is now just refered to doctrine orm instead of doctrine2
2021-10-07 16:12:06 +02:00
Antonio J. García Lagar
483e09cf1c Fix Query::toIterable to honor INDEX BY construct 2021-10-07 13:02:22 +02:00
Benjamin Morel
bbb68d0072 Fix SchemaValidator with abstract child class in discriminator map (#9096) 2021-10-06 22:35:51 +02:00
Alexander M. Turek
2adc193421 Bump required PHP version to 7.4 (#9094) 2021-10-05 20:14:12 +02:00
Alexander M. Turek
fe2ebeef25 Merge 2.11.x into 3.0.x (#9093)
Merge 2.11.x into 3.0.x
2021-10-05 15:18:53 +02:00
Grégoire Paris
e9cd90f52e Refactor ORMException into an interface (#9085) 2021-10-05 15:15:40 +02:00
Alexander M. Turek
b0381b3705 Merge release 2.10.1 into 2.11.x (#9092) 2021-10-05 15:12:04 +02:00
Knallcharge
f346379c7b Add integer cast in setFirstResult methods of Query and QueryBuilder (#9090) 2021-10-05 15:04:30 +02:00
Michael Telgmann
b1c31e1aac Add integer cast in setMaxResults methods of Query and QueryBuilder (#9079) 2021-10-04 23:00:38 +02:00
Grégoire Paris
02b6f9c335 Merge pull request #9084 from annechko/patch-1
Update phpdoc comment - association-mapping.rst
2021-10-04 21:59:30 +02:00
Anna Borzenko
d14d9919c7 Update phpdoc comment 2021-10-04 21:50:03 +02:00
Grégoire Paris
d973fa129b Merge pull request #9076 from derrabus/remove/hydrate-row 2021-10-04 12:13:52 +02:00
Alexander M. Turek
4fa65f3853 Remove AbstractHydrator::hydrateRow() 2021-10-04 10:42:14 +02:00
Alexander M. Turek
f478fee5fb Merge 2.11.x into 3.0.x 2021-10-04 10:38:52 +02:00
Alexander M. Turek
3984f74eb4 Deprecate ensureProductionSettings() (#9074) 2021-10-04 10:00:34 +02:00
Alexander M. Turek
4b4022358a Merge branch '2.11.x' into 3.0.x
* 2.11.x:
  Deprecate AbstractHydrator::hydrateRow() (#9072)
  Reflect latest minor release in metadata
  Revert "Pin laminas/automatic-releases to 1.11.1"
  Revert "Try using docker image directly"
  Revert "Explicitly disallow workflows for tags"
  Revert "Use org admin token"

Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-10-03 23:59:03 +02:00
Alexander M. Turek
ebdced6175 Deprecate AbstractHydrator::hydrateRow() (#9072) 2021-10-03 21:46:30 +00:00
Alexander M. Turek
413c33274d Remove support for DBAL 2 (#9069) 2021-10-03 23:32:44 +02:00
Alexander M. Turek
e13714e400 Remote Query::iterate() (#9070) 2021-10-03 22:59:44 +02:00
Grégoire Paris
1a702075ba Merge pull request #9071 from doctrine/2.10.x
Merge up
2021-10-03 22:49:21 +02:00
Grégoire Paris
bd79e3d383 Merge pull request #9068 from greg0ire/update-branch-metadata
Reflect latest minor release in metadata
2021-10-03 22:48:37 +02:00
Grégoire Paris
10f72417c9 Reflect latest minor release in metadata 2021-10-03 21:12:59 +02:00
Grégoire Paris
87ad869a8a Merge pull request #9067 from greg0ire/use-latest-laminas-release
Use latest laminas release
2021-10-03 21:08:55 +02:00
Grégoire Paris
bc4659b73c Revert "Pin laminas/automatic-releases to 1.11.1"
This reverts commit e800f90d7c.
2021-10-03 20:56:35 +02:00
Grégoire Paris
4eab6536c3 Revert "Try using docker image directly"
This reverts commit ddcea63d0f.
2021-10-03 20:56:27 +02:00
Grégoire Paris
1571c8a781 Revert "Explicitly disallow workflows for tags"
This reverts commit bbe4022566.
2021-10-03 20:56:12 +02:00
Grégoire Paris
20a65cbe32 Revert "Use org admin token"
This reverts commit e8a221d227.
2021-10-03 20:55:17 +02:00
Grégoire Paris
bcd6ac885d Merge pull request #9066 from doctrine/2.10.x-merge-up-into-3.0.x_6159cb4217e697.30353290
Merge release 2.10.0 into 3.0.x
2021-10-03 17:51:19 +02:00
Grégoire Paris
512dfd6aaf Merge remote-tracking branch 'origin/2.10.x' into 3.0.x 2021-10-03 17:40:24 +02:00
Grégoire Paris
07e15a0038 Merge pull request #9065 from greg0ire/2.10.x
Merge up
2021-10-03 17:14:07 +02:00
Grégoire Paris
5918cfaa20 Merge remote-tracking branch 'origin/2.9.x' into 2.10.x 2021-10-03 17:13:24 +02:00
Grégoire Paris
73fa465c26 Merge pull request #9064 from greg0ire/use-org-token
Use org admin token
2021-10-03 17:09:48 +02:00
Grégoire Paris
e8a221d227 Use org admin token
My previous attempts to disallow running a workflow when pushing a tag
failed, so let's ensure we can run said workflow. Maybe we will be able
to understand why it happened after it happens.
2021-10-03 17:08:50 +02:00
Grégoire Paris
b734a7d155 Merge pull request #9063 from greg0ire/explicitly-disallow-workflows-for-tags
Explicitly disallow workflows for tags
2021-10-03 17:02:04 +02:00
Grégoire Paris
bbe4022566 Explicitly disallow workflows for tags
Despite what is described in the docs, it seems that there is still an
attempt to run a workflow for tags.
2021-10-03 17:01:08 +02:00
Grégoire Paris
63f3abfbe8 Avoid triggering workflows for tags
To avoid recursive workflows, Github will prevent the release bot from
pushing tags because that would result in a new workflow being triggered.
2021-10-03 16:41:29 +02:00
Grégoire Paris
22added5fa Merge pull request #9062 from greg0ire/dont-run-workflows-for-tags
Avoid triggering workflows for tags
2021-10-03 16:39:43 +02:00
Grégoire Paris
3a3b53e11d Avoid triggering workflows for tags
To avoid recursive workflows, Github will prevent the release bot from
pushing tags because that would result in a new workflow being triggered.
2021-10-03 16:36:46 +02:00
Grégoire Paris
ddcea63d0f Try using docker image directly 2021-10-03 16:23:22 +02:00
Grégoire Paris
e800f90d7c Pin laminas/automatic-releases to 1.11.1
1.12.0 and up comes with a migration to azjezz/psl that makes it
impossible to troubleshoot issues with external commands such as git push
2021-10-03 15:09:18 +02:00
Grégoire Paris
6d16147d60 Merge pull request #9061 from greg0ire/revert-to-older-automatic-releases
Revert to older automatic releases
2021-10-03 15:06:41 +02:00
Grégoire Paris
9ed1fe59f2 Pin laminas/automatic-releases to 1.11.1
1.12.0 and up comes with a migration to azjezz/psl that makes it
impossible to troubleshoot issues with external commands such as git push
2021-10-03 14:49:00 +02:00
Alexander M. Turek
f805526336 Deprecate isIdGeneratorTable and isIdentifierUuid (#9046) 2021-10-03 12:18:53 +02:00
Alexander M. Turek
2e86134c0b Merge branch '2.9.x' into 2.10.x
* 2.9.x:
  Run PHP 8.1 CI with stable dependencies (#9058)
  Duplicate testTwoIterateHydrations (#9048)
  Add PHP 8.1 to CI (#9006)
  Fix locking non-existing entity (#9053)

Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-10-02 21:22:45 +02:00
Alexander M. Turek
5f768742a0 Run PHP 8.1 CI with stable dependencies (#9058) 2021-10-02 19:37:08 +02:00
Alexander M. Turek
7a8c086d44 Add PHP 8.1 to CI (#9057) 2021-10-02 18:01:18 +02:00
Alexander M. Turek
d95f304073 Remove TABLE and UUID strategies (#9045) 2021-10-02 18:00:45 +02:00
Alexander M. Turek
1d4e12bc6b Duplicate testTwoIterateHydrations (#9048) 2021-10-02 17:45:29 +02:00
Alexander M. Turek
70b0f50d13 Add PHP 8.1 to CI (#9006)
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-10-02 17:20:20 +02:00
Grégoire Paris
149c4308bb Merge pull request #9056 from derrabus/improvement/foreign-key-get-columns
Remove calls to `ForeignKeyConstraint::getColumns()`
2021-10-02 17:14:03 +02:00
Alexander M. Turek
9d4fac088c Remove calls to ForeignKeyConstraint::getColumns()
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-10-02 17:05:16 +02:00
Alexander M. Turek
eb27acaa65 Update documentation regarding caching (#9043) 2021-09-30 23:30:49 +02:00
Csupity Laszlo
2362aa1a7a Fix locking non-existing entity (#9053) 2021-09-30 23:29:34 +02:00
Kévin Dunglas
18c153ef8a Merge branch '2.10.x' into 3.0.x 2021-09-30 08:37:31 +02:00
Kévin Dunglas
f414e57d82 fix: prevent TypeError in QueryBuilder joins (#9050) 2021-09-30 06:03:33 +00:00
Alexander M. Turek
13543df649 Merge pull request #9049 from derrabus/merge/2.9.x
Merge 2.9.x into 2.10.x
2021-09-29 23:15:15 +02:00
Alexander M. Turek
bb60e06b88 Merge pull request #9044 from doctrine/2.10.x
Merge 2.10.x into 3.0.x
2021-09-29 22:45:16 +02:00
Alexander M. Turek
1d7fdde81d Merge branch '2.9.x' into merge/2.9.x
* 2.9.x:
  Minor rewording (#8435)
  Don't presume one-to-one lookup returned an entity  (#9028)
  Minor change about double The (#9038)
  Remove duplicate comment (#9036)
  Fix docblock types for some nullable properties (#9024)
  Explicitly allow to use `Comparison` and `Composite` in JOIN conditions (#9022)
  Fix some typehints in QueryBuilder
  Bump PHPStan (#9014)
  Add tests for advanced types in collection matching
  Use types in collection persister

Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-09-29 20:33:01 +02:00
Thomas Landauer
5326736571 Minor rewording (#8435)
Emphasizing the (counter-intuitive) fact that preUpdate is called inside **flush** - cause this was causing me some confusion, see https://github.com/symfony/symfony/issues/39894
2021-09-28 09:41:16 +02:00
Greg Tyler
78d07b0bd2 Don't presume one-to-one lookup returned an entity (#9028)
If `$this->em->find()` returns null, don't treat it like an object. Instead, just set the field to null and back out of the switch statement.

Fixes #9027
2021-09-27 12:43:35 +02:00
Loenix
51ff4713b3 Minor change about double The (#9038) 2021-09-27 08:50:16 +00:00
Jérémy
c0f70204d1 Remove duplicate comment (#9036) 2021-09-23 12:47:01 +00:00
Javier Spagnoletti
2575aa5120 Fix docblock types for some nullable properties (#9024) 2021-09-22 23:48:49 +02:00
Javier Spagnoletti
1f6401ee0a Explicitly allow to use Comparison and Composite in JOIN conditions (#9022) 2021-09-20 06:09:05 +02:00
Grégoire Paris
248ff82f83 Merge pull request #9017 from norkunas/fix-typehints
Fix some typehints in QueryBuilder
2021-09-16 16:44:29 +01:00
Tomas
f1db7d7fa2 Fix some typehints in QueryBuilder 2021-09-16 15:26:18 +03:00
Alexander M. Turek
0bcc3ee4e9 Bump PHPStan (#9014) 2021-09-15 15:46:59 +02:00
Grégoire Paris
0bd651abda Merge pull request #9010 from sztyup/2.9.x
Fix ignoring custom types for PersistentCollection matching()
2021-09-15 08:02:57 +01:00
Alexander M. Turek
334ca18171 Document fluent interfaces (#9009) 2021-09-13 21:25:33 +02:00
Laszlo_Csupity
ff978ce4d8 Add tests for advanced types in collection matching 2021-09-13 13:56:13 +02:00
Laszlo_Csupity
128ebe630b Use types in collection persister 2021-09-13 13:55:41 +02:00
Alexander M. Turek
6371081593 Use PSR-6 for accessing the query cache (#9004) 2021-09-13 12:39:32 +02:00
Alexander M. Turek
31d8bd7a5e Merge pull request #9008 from greg0ire/2.10.x
Merge 2.9.x up into 2.10.x
2021-09-13 12:16:40 +02:00
Grégoire Paris
dee58cfefd Merge remote-tracking branch 'origin/2.9.x' into 2.10.x 2021-09-13 12:07:43 +02:00
Grégoire Paris
71f1fdb668 Merge pull request #9007 from derrabus/test/query-get-cache
Add tests for Query::getQueryCacheDriver()
2021-09-13 11:06:04 +01:00
Alexander M. Turek
85488d69e2 Add tests for Query::getQueryCacheDriver()
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-09-13 10:08:58 +02:00
Alexander M. Turek
0ae2a2ded8 Merge pull request #9005 from doctrine/2.10.x
Merge 2.10.x into 3.0.x
2021-09-12 01:51:58 +02:00
Alexander M. Turek
5c7e6689fc Switch cache configuration to PSR-6 (#9002) 2021-09-11 23:16:31 +02:00
Grégoire Paris
5b3fb6ac56 Merge pull request #8999 from derrabus/merge/2.9.x
Merge 2.9.x into 2.10.x
2021-09-11 16:36:44 +01:00
Alexander M. Turek
65839235ce Merge branch '2.9.x' into merge/2.9.x
* 2.9.x:
  Remove Proxy from EntityManagerInterface contract
  Add extension point for the "embedded" XML node (#8992)
  Fix return type at `EntityManagerInterface::get(Partial)Reference()` (#8922)
  Fix class casing and avoid name collisions
  Remove unused performance base test class
  Drop unused test base classes
  Fix mapped superclass missing in discriminator map
2021-09-11 16:53:52 +02:00
Grégoire Paris
d1cd8047fa Merge pull request #9001 from derrabus/sa/em-get-reference
Remove Proxy from EntityManagerInterface contract
2021-09-11 15:33:26 +01:00
Alexander M. Turek
90ed9f5387 Remove Proxy from EntityManagerInterface contract
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-09-11 15:23:14 +02:00
Javier Spagnoletti
04d28a9362 Add extension point for the "embedded" XML node (#8992) 2021-09-11 14:17:37 +02:00
Grégoire Paris
fb89129fb2 Merge pull request #9000 from derrabus/bugfix/missing-imports
Fix class casing and avoid name collisions
2021-09-11 12:55:07 +01:00
Simon Podlipsky
399b69a309 Fix return type at EntityManagerInterface::get(Partial)Reference() (#8922) 2021-09-11 13:53:20 +02:00
Grégoire Paris
01ab70d204 Merge pull request #8996 from derrabus/improvement/psr6-result-cache
Support for PSR-6 result caches
2021-09-11 12:53:09 +01:00
Alexander M. Turek
45553556d5 Fix class casing and avoid name collisions 2021-09-11 13:41:46 +02:00
Alexander M. Turek
996fa777bd Support for PSR-6 result caches
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-09-11 13:20:37 +02:00
Grégoire Paris
dc1336dbc2 Include the DBAL version in coverage filenames (#8998)
Currently, files from different jobs probably overwrite each other.
2021-09-11 13:03:55 +02:00
Alexander M. Turek
b1f89a5cb8 Merge pull request #8997 from greg0ire/drop-unused-classes 2021-09-10 22:15:58 +02:00
Grégoire Paris
48f7abf697 Remove unused performance base test class
It is unused since b960170fe1
2021-09-10 21:13:32 +02:00
Grégoire Paris
2159fbee56 Drop unused test base classes
They are no longer needed since e4c7fa961e
2021-09-10 21:13:24 +02:00
Grégoire Paris
7fcab3d52e Merge pull request #8903 from olsavmic/fix-schema-validator-for-mapped-superclass-inheritance
SchemaValidator: Fix mapped superclass missing in discriminator map
2021-09-08 17:25:23 +01:00
Grégoire Paris
2d42d7835d Merge pull request #8919 from bhushan/feat/add-get-flat-array-results-by-key-for-query
feat(ScalarColumnHydrator): added ScalarColumnHydrator to get flat array results from query for single column
2021-09-08 17:02:58 +01:00
Bhushan
ed83825223 feat(ScalarColumnHydrator): get one dimensional array values for single column 2021-09-08 17:32:35 +02:00
Alexander M. Turek
beee34055a Merge pull request #8991 from derrabus/merge/2.9.x
Merge 2.9.x into 2.10.x
2021-09-08 09:07:18 +02:00
Alexander M. Turek
7abd106c8a Merge branch '2.9.x' into merge/2.9.x
* 2.9.x:
  Restore functional cache tests (#8981)
  Fix English in `note`. (#8987)
  Remove detach deprecation entry in UPGRADE.md (#8978)
  Bump to PHPStan 0.12.98 and Psalm 4.10.0 (#8979)

Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-09-08 08:57:00 +02:00
Alexander M. Turek
be2208f208 Remove unnecessary method_exists() checks (#8984) 2021-09-07 22:45:44 +02:00
Alexander M. Turek
316ba5f75e Restore functional cache tests (#8981) 2021-09-07 22:45:12 +02:00
ash-m
a08b6306d3 Fix English in note. (#8987)
Improper agreement; either:
 - Doctrine does not EVER touch ...
 - Doctrine NEVER touches ...
2021-09-07 22:44:43 +02:00
Simon Berger
21e71af13f Remove detach deprecation entry in UPGRADE.md (#8978) 2021-09-06 19:46:48 +02:00
Alexander M. Turek
f352b2a7ed Bump to PHPStan 0.12.98 and Psalm 4.10.0 (#8979) 2021-09-06 15:14:20 +02:00
Grégoire Paris
811f1b19bd Merge pull request #8967 from doctrine/2.10.x
Merge 2.10.x into 3.0.x
2021-08-31 23:08:51 +02:00
Grégoire Paris
7bf1ad1a5a Merge pull request #8964 from derrabus/feature/dbal-3
DBAL 3
2021-08-31 22:42:46 +02:00
Alexander M. Turek
9de601f377 Merge pull request #8966 from doctrine/2.9.x
Merge 2.9.x into 2.10.x
2021-08-30 00:34:08 +02:00
carnage
df5086196f Added clarification of using change tracking policy on entities with embeddables (#7495)
* Added clarification of using change tracking policy on entities with embeddables

* Apply suggestions from code review

Co-Authored-By: carnage <carnage@users.noreply.github.com>

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-08-29 23:44:14 +02:00
Grégoire Paris
a427d7d852 Merge pull request #8961 from greg0ire/drop-table
Deprecate / remove TABLE id generator strategy
2021-08-29 23:43:09 +02:00
Grégoire Paris
efbcca3cb6 Get dbname from connection params first
Getting the database name from a connection object results in a PDO
object being created, which might in turn result in an error message if
the database does not exist. For instance it does with PostgreSQL.
In some other situations, like when using sqlite, there is no database
name though, so we still have to fallback on the previous behavior.
2021-08-29 21:08:17 +02:00
Alexander M. Turek
c65cc91f5b Support for DBAL 3 2021-08-29 21:08:17 +02:00
Grégoire Paris
d5f65ba62e Merge pull request #8962 from greg0ire/dont-swallow-exceptions
Stop swallowing exceptions
2021-08-29 20:54:57 +02:00
Grégoire Paris
ef9c984bcd Merge pull request #8946 from derrabus/bugfix/dbal-3-platforms
Support for DBAL 3's platform classes
2021-08-29 16:07:49 +02:00
Grégoire Paris
3074a4b02d Merge pull request #8932 from greg0ire/drop-support-for-generating-json-array-fields
Drop support for generating json array fields
2021-08-29 15:48:17 +02:00
Alexander M. Turek
fdbc6b6c13 Support for DBAL 3's platform classes
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-29 15:27:28 +02:00
Grégoire Paris
ea584992d5 Drop support for generating JSON_ARRAY fields
JSON_ARRAY has been deprecated in favor of JSON for a while, we should
not encourage people to generate new entities with it, since it will
introduce technical debt for them.
Support for JSON is added instead.
2021-08-29 14:40:29 +02:00
Grégoire Paris
96b4c763e4 Stop swallowing exceptions
This was probably done in order to get rid of exceptions about tables
already existing, but may and does swallow other exceptions as well, for
instance exceptions about sequences failing to be created on Oracle
because the identifier is too long. This makes it unnecessarily hard to
understand what is going on.
2021-08-28 18:02:41 +02:00
Grégoire Paris
0b55275418 Deprecate / remove TABLE id generator strategy
This strategy has been marked as TODO for more than 14 years. It should
be OK to remove some things related to it since they lead to an
exception being thrown.
2021-08-28 11:02:06 +02:00
Grégoire Paris
1963733311 Merge pull request #8959 from norkunas/fix-typehint
Fix `getEntityChangeSet` return typehint
2021-08-27 08:27:04 +02:00
Grégoire Paris
a06bbafd6a Merge pull request #8957 from derrabus/remove/connection-helper
Only wire ConnectionHelper if it's available
2021-08-25 19:33:54 +02:00
Grégoire Paris
250f7acc98 Merge pull request #8960 from inarli/2.9.x
Fix typo
2021-08-25 19:32:36 +02:00
İlkay Narlı
82f8a7c56a Fix typo 2021-08-25 17:54:14 +03:00
Alexander M. Turek
b345488272 Remove calls to fixSchemaElementName() (#8941) 2021-08-25 15:06:06 +02:00
Tomas
1de4020dc9 Fix getEntityChangeSet return typehint 2021-08-25 12:38:44 +03:00
Alexander M. Turek
dc6ed8716d Only wire ConnectionHelper if it's available
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-24 16:34:00 +02:00
Grégoire Paris
a8a9b2ae75 Merge pull request #8953 from derrabus/improvement/create-schema-manager
Don't call deprecated `getSchemaManager()`
2021-08-24 08:21:25 +02:00
Grégoire Paris
e03a30bd85 Merge pull request #8954 from derrabus/bugfix/dbal-exception
Fix references to deprecated `DBALException`
2021-08-24 08:19:26 +02:00
Alexander M. Turek
16357c5666 Fix references to deprecated DBALException
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-24 04:59:12 +02:00
Alexander M. Turek
131cc17384 Don't call deprecated getSchemaManager()
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-24 04:41:36 +02:00
Grégoire Paris
c18b474bbf Merge pull request #8934 from derrabus/remove/sql-result-casing
Remove calls to `AbstractPlatform::getSQLResultCasing()`
2021-08-23 20:46:40 +02:00
Grégoire Paris
e3b1ad5591 Merge pull request #8935 from derrabus/improvement/deprecated-calls
Remove calls to deprecated Connection methods
2021-08-23 18:32:14 +02:00
Alexander M. Turek
e6f1bb7dad Remove calls to AbstractPlatform::getSQLResultCasing() 2021-08-23 16:55:33 +02:00
Alexander M. Turek
730143e39b Remove calls to deprecated Connection methods 2021-08-23 16:54:59 +02:00
Alexander M. Turek
5cd00a50b2 Remove UUID generator strategy from fixtures (#8947) 2021-08-23 16:47:19 +02:00
Alexander M. Turek
3b8b3f9034 Remove ImportCommand from console (#8948) 2021-08-23 16:41:25 +02:00
Alexander M. Turek
bbe0b17b93 Don't pass false as lock mode to appendLockHint() (#8937) 2021-08-23 16:25:49 +02:00
Alexander M. Turek
7446569cf4 Remove remaining call to prefersSequences() (#8942) 2021-08-23 16:24:35 +02:00
Alexander M. Turek
930c2e093c Remove calls to EchoSQLLogger (#8940) 2021-08-23 16:23:34 +02:00
Alexander M. Turek
2154b513af Make mock layer compatible with DBAL 3 (#8949) 2021-08-23 16:22:43 +02:00
Grégoire Paris
93508438fa Merge pull request #8945 from greg0ire/document-possible-null-variable 2021-08-23 14:22:41 +02:00
Grégoire Paris
1490b2c3bb Merge pull request #8952 from greg0ire/ditch-simple-annotation-reader-2 2021-08-23 14:20:40 +02:00
Grégoire Paris
760abfc316 Drop more usages of SimpleAnnotationReader 2021-08-23 14:05:52 +02:00
Grégoire Paris
a1c15778ae Merge pull request #8951 from doctrine/2.9.x-merge-up-into-2.10.x_Ryg07QLG 2021-08-23 13:05:04 +02:00
Grégoire Paris
4f9c104ec9 Merge tag '2.9.5' into 2.9.x-merge-up-into-2.10.x_Ryg07QLG
2.9.x bugfix release (patch)

- Total issues resolved: **0**
- Total pull requests resolved: **2**
- Total contributors: **2**

 - [8930: Introduce 2.10 to readme](https://github.com/doctrine/orm/pull/8930) thanks to @SenseException

 - [8895: Implement &#95;&#95;serialize() and &#95;&#95;unserialize()](https://github.com/doctrine/orm/pull/8895) thanks to @derrabus
2021-08-23 12:35:37 +02:00
Grégoire Paris
77cc86ed88 Merge pull request #8916 from greg0ire/failing-test-8914
Check current class' discriminator map
2021-08-23 12:20:22 +02:00
Grégoire Paris
627113dc60 Merge pull request #8950 from derrabus/bump/phpstan
PHPStan 0.12.96
2021-08-23 00:02:24 +02:00
Alexander M. Turek
234829644c PHPStan 0.12.96
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-22 23:45:59 +02:00
Grégoire Paris
af4ecbadab Document possibly-null member variables
Many of the variables in AbstractHydrator are not initialized in the
constructor, and should be documented as possibly null because of that.
Introducing accessors that perform null checks allows to to have to do
these null checks when using the accessors.
Making the member variables private would be a backwards-compatibility
break and could be considered for the next major version.

This makes Psalm's and PHPStan's baselines smaller, and should make
implementing new hydrators easier.
2021-08-22 22:12:00 +02:00
Grégoire Paris
b20743b352 Merge pull request #8943 from simPod/wrap-types
Add missing EntityManagerInterface argument to callable that is being passed to `EM::wrapInTransaction()`
2021-08-22 18:17:41 +02:00
Grégoire Paris
e546cdef51 Merge pull request #8944 from derrabus/bugfix/datetime-constant
Remove references to `Type::DATETIME`
2021-08-22 18:10:22 +02:00
Alexander M. Turek
5f3e17152b Remove references to Type::DATETIME
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-22 17:43:07 +02:00
Simon Podlipsky
0d6ff230da Add missing EntityManagerInterface argument to callable that is being passed to EM::wrapInTransaction() 2021-08-22 17:26:57 +02:00
Grégoire Paris
14da92cf6b Merge pull request #8939 from derrabus/remove/driver-get-name
Remove calls to `Driver::getName()`
2021-08-22 16:27:48 +02:00
Grégoire Paris
563f3bdd85 Merge pull request #8938 from derrabus/bump-psalm
Bump Psalm to 4.9.3
2021-08-22 16:26:56 +02:00
Marcin Czarnecki
8bed63090b Throw exception NotSupported Exception for UuidGenerator with doctrine/dbal:3.x. (#8898)
Generating `getGuidExpression` has been removed in doctrine/dbal:3.x.

Partially fixes #8884
2021-08-22 16:05:22 +02:00
Alexander M. Turek
4f28ad6ccc Remove calls to Driver::getName()
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-22 15:56:18 +02:00
Alexander M. Turek
3f98633704 Bump Psalm to 4.9.3
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-22 15:43:55 +02:00
Grégoire Paris
e7758866c9 Merge pull request #8936 from derrabus/bugfix/reset-baseline
Reset Psalm baseline
2021-08-22 14:51:30 +02:00
Alexander M. Turek
1b1d1a246f Reset Psalm baseline
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-22 14:18:08 +02:00
Grégoire Paris
db175020e0 Merge pull request #8928 from simPod/wrap-types
Add types to `EM::wrapInTransaction()`
2021-08-21 16:06:49 +02:00
Grégoire Paris
1de28c2cab Merge pull request #8930 from doctrine/2.10-readme
Introduce 2.10 to readme
2021-08-21 16:05:17 +02:00
Claudio Zizza
565987f583 Introduce 2.10 to readme 2021-08-20 21:14:25 +02:00
Simon Podlipsky
44bea09b10 Add types to EM::wrapInTransaction() 2021-08-19 16:35:22 +02:00
Grégoire Paris
ae10af0259 Check current class' discriminator map
A class can be in its own discriminator map, as described in the
documentation example at
https://www.doctrine-project.org/projects/doctrine-orm/en/2.9/reference/inheritance-mapping.html#single-table-inheritance
Checking only the current class' discriminator map should be enough,
since it is set to a copy of its parent's discriminator map earlier.

Fixes #8914
2021-08-15 11:59:11 +02:00
Grégoire Paris
d636d79686 Merge pull request #8895 from derrabus/bugfix/serializable
Implement __serialize() and __unserialize()
2021-08-15 11:56:49 +02:00
Grégoire Paris
aee197f027 Merge pull request #8904 from carnage/refactoring-tests-backport
Refactoring more tests
2021-08-14 21:22:49 +02:00
Carnage
38c0f2b205 Change assertion order to ensure query count is tested correctly 2021-08-14 14:14:11 +01:00
Carnage
3dfbce1f40 Tidy up CS errors 2021-08-14 13:57:39 +01:00
Carnage
ad2cbd6afe Fix PHP Unit deprecations and removed methods 2021-08-14 13:31:55 +01:00
Gabriel Caruso
f34215d56a Refactoring more tests 2021-08-14 11:46:47 +01:00
Grégoire Paris
163aef158b Merge pull request #8915 from basseta/address-type-deprecation
Address Type deprecation messages
2021-08-12 23:13:56 +02:00
Antoine BASSET
40f613199a Address Type deprecation messages
This makes us more compatible with DBAL v3.
We didn't address Type::JSON_ARRAY because it has been removed
2021-08-12 17:11:41 +02:00
Grégoire Paris
ed230264fb Merge pull request #8913 from doctrine/2.9.x-merge-up-into-2.10.x_GK8LNgB8
Merge release 2.9.4 into 2.10.x
2021-08-11 23:32:36 +02:00
Vincent Langlet
b19a13f4ed Override getAssociationTargetClass phpdoc (#8907)
The upstream interface now allows null to be returned, but this
implementation never returns null, and consumers are expecting it not
to.
2021-08-11 22:53:03 +02:00
Grégoire Paris
a0b739c259 Merge pull request #8912 from greg0ire/3.0.x
Merge 2.10.x into 3.0.x
2021-08-11 22:45:58 +02:00
Grégoire Paris
cbda203f23 Merge remote-tracking branch 'origin/2.10.x' into 3.0.x 2021-08-11 22:31:29 +02:00
Grégoire Paris
03948f891e Merge pull request #8911 from greg0ire/2.10.x
Merge 2.9.x up into 2.10.x
2021-08-11 22:23:44 +02:00
Grégoire Paris
7dfa140542 Remove uneeded assertion 2021-08-11 22:14:33 +02:00
Grégoire Paris
01e7e45744 Merge remote-tracking branch 'origin/2.9.x' into 2.10.x 2021-08-11 22:11:32 +02:00
Grégoire Paris
1e2c0ce72d Merge pull request #8909 from greg0ire/fix-build
Fix build
2021-08-11 22:08:05 +02:00
Grégoire Paris
6a6bcc1e2b Ignore error caused by upstream package
See https://github.com/doctrine/collections/pull/282
2021-08-11 21:48:09 +02:00
Grégoire Paris
e2f54f6fa6 Remove phpstan-specific annotation
This is a direct consequence of https://github.com/doctrine/collections/pull/274
2021-08-11 21:48:09 +02:00
Grégoire Paris
e16a768916 Adapt baseline to new error message
The signature has become more precise, and so has the error message.
2021-08-11 21:48:03 +02:00
Benjamin Eberlei
25135d429f Merge 2.9.x into 2.10.x 2021-08-11 20:21:39 +02:00
Grégoire Paris
3b9e04e971 Merge pull request #8905 from nicolas-grekas/ret-types
Add explicit `@return` type next to `#[ReturnTypeWillChange]`
2021-08-11 00:13:16 +02:00
Grégoire Paris
7c1593742c Merge pull request #8870 from derrabus/improvement/prefers-sequences
Remove calls to prefersSequences()
2021-08-10 23:24:26 +02:00
Nicolas Grekas
fca1f5240d Add explicit @return type next to #[ReturnTypeWillChange] 2021-08-10 18:51:46 +02:00
Michael Olšavský
5685dc05f6 Fix mapped superclass missing in discriminator map 2021-08-09 16:24:37 +02:00
Grégoire Paris
4fa2f6baa4 Merge pull request #8896 from derrabus/bugfix/dont-pass-null
Don't pass null as parameter
2021-08-09 08:19:12 +02:00
Grégoire Paris
245563e1cf Merge pull request #8894 from derrabus/bugfix/return-type-will-change
Fix return types for PHP 8.1
2021-08-09 08:18:46 +02:00
Grégoire Paris
f980682829 Merge pull request #8897 from scyzoryck/dbal-3-fix-connection-params
Redeclare `$_attributes` property in `Configuration` class.
2021-08-09 08:18:10 +02:00
Grégoire Paris
b600c01bca Merge pull request #8419 from simPod/more-tests
Introduce `EntityManagerInterface#wrapInTransaction()`
2021-08-08 22:45:14 +02:00
Grégoire Paris
ad43cc04ff Merge pull request #8900 from simPod/psalm-10
Regenerate psalm baseline
2021-08-08 18:01:39 +02:00
Simon Podlipsky
c45402c1eb Regenerate psalm baseline 2021-08-08 17:48:07 +02:00
Grégoire Paris
a35ce43a61 Merge pull request #8902 from greg0ire/2.10.x
Merge 2.9.x into 2.10.x
2021-08-08 17:47:08 +02:00
Grégoire Paris
ed32b4c812 Merge remote-tracking branch 'origin/2.9.x' into 2.10.x 2021-08-08 17:38:45 +02:00
Grégoire Paris
a5436be939 Merge pull request #8899 from simPod/psalm
Regenerate psalm baseline
2021-08-08 17:13:19 +02:00
Simon Podlipsky
1246b3b5c3 Regenerate psalm baseline 2021-08-08 16:24:49 +02:00
Simon Podlipsky
4ad5d3edbd Introduce Doctrine\ORM\EntityManagerInterface#wrapInTransaction() 2021-08-08 16:22:53 +02:00
scyzoryck
355a4a126b Redeclare $_attributes property in Configuration class that has been removed in doctrine/dbal:3.x
To keep backward compatibility we need to redeclare this property to keep using it.
Partially fixes #8884
2021-08-08 12:22:16 +02:00
Alexander M. Turek
3464591763 Don't pass null as parameter
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-08 01:39:43 +02:00
Alexander M. Turek
ae4bcd61ee Implement __serialize() and __unserialize()
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-08 01:24:06 +02:00
Alexander M. Turek
dc960d7d96 Fix return types for PHP 8.1
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-08 01:10:58 +02:00
Grégoire Paris
7736429e9b Merge pull request #8892 from derrabus/bump/phpstan
Bump PHPStan to 0.12.94
2021-08-08 00:08:21 +02:00
Alexander M. Turek
edaa05a217 Remove calls to prefersSequences()
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-07 23:47:55 +02:00
Alexander M. Turek
7c6bea1307 Bump PHPStan to 0.12.94
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-07 22:12:21 +02:00
Grégoire Paris
c4456a2863 Merge pull request #8889 from scyzoryck/dbal-3-fix-possibly-null-argument
doctrine/dbal v3 - Make sure that values passed to are not null
2021-08-05 23:58:20 +02:00
scyzoryck
2bf0f64295 Make sure that passed values (offset and lock mode) will not be a null to meet changes in doctrine/dbal v3.
Fix psalm issues with type: `PossiblyNullArgument`, found after updating doctrine/dbal to v3. Override `null` passed as offset with `0` in calls to `Doctrine\DBAL\Platforms\AbstractPlatform::modifyLimitQuery`. Override `null` passed as lockMode with `LockMode::NONE` in calls to `Doctrine\DBAL\Platforms\AbstractPlatform::appendLockHint`.
Partialy fixes #8884
2021-08-05 22:30:58 +02:00
Grégoire Paris
12705b5c3e Merge pull request #8820 from beberlei/GH-8818-EntityNamespaceAliasDeprecation
[GH-8818] Deprecate entity namespace short aliases.
2021-08-05 19:49:39 +02:00
Benjamin Eberlei
913700b116 Remove alias in docs 2021-08-05 00:48:28 +02:00
Grégoire Paris
106ed8009a Merge pull request #8883 from dopeh/patch-1
Fix getting-started example by including cache
2021-08-05 00:20:07 +02:00
Pep
b2e00f6086 Fix getting-started example by including cache
The getting started example does not work without a valid cache library, this adds symfony/cache.
2021-08-04 23:04:46 +02:00
Benjamin Eberlei
0540485b14 Update UPGRADE.md 2021-08-04 22:29:12 +02:00
Benjamin Eberlei
e5228ba66f [GH-8818] Deprecate entity namespace short aliases. 2021-08-04 22:17:09 +02:00
Grégoire Paris
e09f126abf Merge pull request #8852 from greg0ire/backport-6943
Remove possibility to extend the doctrine mapping xml schema with anything
2021-08-04 07:43:13 +02:00
Grégoire Paris
055b646d9a Merge pull request #8769 from greg0ire/remove-unhelpful-template
Make templating Psalm-specific
2021-08-04 07:42:29 +02:00
Grégoire Paris
acdbbdacab Merge pull request #8874 from greg0ire/build-with-dbal-3
Build with DBAL 3
2021-08-03 23:52:55 +02:00
Grégoire Paris
6a267f588c Build with DBAL 3
Making these jobs green will not result in a comprehensive result of the
features, but it is a good start, and having them should give a good
overview of what is left to do.
2021-08-03 19:47:30 +02:00
Grégoire Paris
d7a5eab7d5 Merge pull request #8877 from greg0ire/3.0.x 2021-08-03 13:06:16 +02:00
Grégoire Paris
e51f0cec94 Merge remote-tracking branch 'origin/2.10.x' into 3.0.x 2021-08-03 12:42:16 +02:00
Grégoire Paris
c6f8dc2482 Change ->assert* to self::assert* 2021-08-03 12:41:53 +02:00
Grégoire Paris
c1c3c89836 Merge pull request #8855 from piowin/GH8443-failing-test
Failing test for GH8443
2021-08-03 07:53:38 +02:00
Grégoire Paris
692277e72c Merge pull request #8862 from carnage/this-to-self
Change $this->assert* to self::assert* in unit tests
2021-08-03 07:53:00 +02:00
Grégoire Paris
e3387386e0 Merge pull request #8876 from doctrine/2.10.x
Merge 2.10.x up into 3.0.x
2021-08-03 07:46:06 +02:00
Grégoire Paris
47267b0da5 Merge pull request #8875 from doctrine/2.9.x
Merge 2.9.x up into 2.10.x
2021-08-02 23:57:34 +02:00
Grégoire Paris
6fc0176f87 Merge pull request #8872 from simPod/fix-build
Fix CI SA failures
2021-08-02 23:48:02 +02:00
Grégoire Paris
8bb1454d5d Merge pull request #8859 from greg0ire/backport-7110
Drop tools/sandbox
2021-08-02 19:13:22 +02:00
Simon Podlipsky
42126dc1bd Fix CI SA failures 2021-08-02 18:30:31 +02:00
Grégoire Paris
5861b0575d Merge pull request #8861 from carnage/dbal-compat
Fix compatibility with DBAL develop
2021-07-25 20:12:15 +02:00
Carnage
afe0d1c810 Change ->assert* to self::assert* 2021-07-24 19:10:38 +01:00
Grégoire Paris
bc9e0b3d2c Merge pull request #8860 from t-richard/patch-1
Fix typo in "Working with Objects"
2021-07-24 14:55:58 +02:00
Michael Moravec
0b6ab2d1a7 Fix compatibility with DBAL develop
* ResultStatement signature BC break
* PDO::FETCH_* -> FetchMode::*
* PDO::PARAM_* -> ParameterType::*
* AbstractPlatform::DATE_INTERVAL_UNIT_* -> DateIntervalUnit::*
* AbstractPlatform::TRIM_* -> TrimMode::*
2021-07-24 13:24:39 +01:00
Thibault RICHARD
aa9d0148d5 Fix typo in "Working with Objects" 2021-07-24 14:13:29 +02:00
Michael Moravec
183f4a5211 Drop tools/sandbox 2021-07-24 10:31:50 +02:00
Grégoire Paris
520bfa5c42 Merge pull request #8319 from simPod/fix-args
Fix variadic args in Expr
2021-07-23 23:45:34 +02:00
21skills
86703cbc73 Extra brackets if no cti joins fix
Continuation of a problem from
https://github.com/doctrine/orm/pull/6812
The same problem appears if you add WITH condition to the joined entity with discriminator
2021-07-23 21:27:05 +02:00
piowin
0504c535f1 Failing test for GH8443 2021-07-23 21:27:05 +02:00
Simon Podlipsky
77c73e8801 Fix variadic args in Expr 2021-07-23 10:34:34 +02:00
mike
84afd6c937 Removing all the occurence of any
If someone wants to override the doctrine mapping that person should
write their own mapping file.
2021-07-21 19:48:11 +02:00
mike
7065070838 replacing all the sequence by choice
The order is never important in the declaration
2021-07-21 19:45:36 +02:00
Grégoire Paris
3e18990e90 Merge pull request #8851 from greg0ire/backport-7008
Remove unused exceptions
2021-07-21 07:45:28 +02:00
Grégoire Paris
6b481be074 Remove unused exceptions 2021-07-20 23:28:50 +02:00
Grégoire Paris
52f5528d3a Merge pull request #8838 from carnage/remove-expensive-array-ops
Remove expensive array ops
2021-07-20 23:23:13 +02:00
Grégoire Paris
0db4a3936f Merge pull request #8841 from greg0ire/strict_types
Enable strict mode
2021-07-20 23:19:35 +02:00
Grégoire Paris
ccc2993610 Merge pull request #8837 from greg0ire/backport-6878
Replace spl_object_hash() with spl_object_id()
2021-07-20 23:19:18 +02:00
Grégoire Paris
b7c0e97e71 Assert child property is not null
It is then passed to a class whose constructor cannot work with null.
2021-07-20 21:56:31 +02:00
Grégoire Paris
6c7e854797 Enable strict mode 2021-07-20 21:56:29 +02:00
Grégoire Paris
efb74f3ba3 Document possible return type 2021-07-20 21:56:11 +02:00
Grégoire Paris
270e7a4234 Pass strings to SimpleXMLELement::addAttribute() 2021-07-20 21:56:10 +02:00
Grégoire Paris
decbd93af4 Cast mode to string
It might be an integer, in fact it probably is, but the phpdoc says it
might be a string too.
2021-07-20 21:55:49 +02:00
Grégoire Paris
4770008cb7 Cast string value to float
round() becomes stricter with PHP 8 and no longer accepts strings.
2021-07-20 21:55:49 +02:00
Grégoire Paris
1413111099 Ensure walkLiteral returns a string
By contract, it is supposed to.
2021-07-20 21:55:45 +02:00
Grégoire Paris
60cf2c785f Merge pull request #8846 from greg0ire/backport-6974
Use $strict param in functions that have it
2021-07-19 20:14:10 +02:00
Grégoire Paris
0a46111bb2 Merge pull request #8849 from doctrine/2.10.x
Merge 2.10.x into 3.0.x
2021-07-18 12:47:34 +02:00
Grégoire Paris
ee7ddac7a2 Merge pull request #8848 from greg0ire/2.10.x
Merge 2.9.x into 2.10.x
2021-07-18 12:39:24 +02:00
Grégoire Paris
e7de028d2d Merge remote-tracking branch 'origin/2.9.x' into 2.10.x 2021-07-18 12:05:37 +02:00
Grégoire Paris
3c4009df38 Merge pull request #8847 from greg0ire/adapt-tests-to-new-wrapping
Adapt tests to new way of wrapping
2021-07-18 12:04:40 +02:00
Grégoire Paris
0a1be2cc21 Adapt tests to new way of wrapping
Namespacing is configured here, which means instead of just one layer,
we have a PSR cache wrapped in a doctrine cache with namespacing, itself
wrapped again with a PSR cache.
2021-07-18 11:00:46 +02:00
Grégoire Paris
e39a9ba199 Regenerate Psalm baseline
It looks like using --update-baseline can make number of occurences
drop, but will not result in a removal of some code elements.
2021-07-17 10:37:07 +02:00
Grégoire Paris
65a55cea7e Use $strict param in functions that have it 2021-07-15 23:18:27 +02:00
Grégoire Paris
9e6bc35944 Merge pull request #8845 from greg0ire/backport-6929
[CS] Clean elses
2021-07-15 22:51:47 +02:00
Grégoire Paris
c289b79fb2 Merge pull request #8844 from greg0ire/backport-6549
Ditch SimpleAnnotationReader
2021-07-15 22:32:22 +02:00
Grégoire Paris
03a728dfc8 Ditch SimpleAnnotationReader
We want to get rid of it, because it is not really usable in context
when you use annotations from more than one namespace. This implies
importing classes for all annotations in use.
2021-07-15 22:23:40 +02:00
Grégoire Paris
558ebcdc83 Merge pull request #8842 from greg0ire/backport-6963
Add documentation for ToolEvents
2021-07-15 08:06:59 +02:00
Gabriel Caruso
4b06fb2424 [CS] Clean elses 2021-07-14 22:08:46 +02:00
Claudio Zizza
474218395a Add root namespace to full classname 2021-07-14 11:06:35 +02:00
Claudio Zizza
70092b9800 Update loadClassMetadata example and add namespaces 2021-07-14 11:04:41 +02:00
Claudio Zizza
cd13addcfc Add ToolEvents of SchemaTool 2021-07-14 11:03:08 +02:00
Grégoire Paris
5b6a1d7a40 Merge pull request #8836 from greg0ire/explicit-type-casts
Make implicit type casts explicit
2021-07-13 23:53:35 +02:00
Marco Pivetta
74ffc25b50 Removing useless post-array-population association hydration via array_walk() 2021-07-11 14:40:22 +02:00
Marco Pivetta
91de49e6a6 Removing is_array check on a type that can only have two possible states - using instanceof instead 2021-07-11 14:40:21 +02:00
Marco Pivetta
102484dea8 Removing useless array_key_exists() calls, using ?? operator instead 2021-07-11 14:34:21 +02:00
Marco Pivetta
f9b9a14275 Removing useless variable 2021-07-11 14:34:17 +02:00
Marco Pivetta
8b3d5848a2 Removing useless checking for never-used parameter, inlining merge operation 2021-07-11 14:33:49 +02:00
Marco Pivetta
9c5d676111 Replacing possible O(n^2) operation from PersistentCollection diffing operations 2021-07-11 14:33:43 +02:00
Michael Moravec
84ad007de3 Replace spl_object_hash() with spl_object_id()
It is more efficient, and can be provided to 7.1 users thanks to
symfony/polyfill-php72.
2021-07-10 11:55:13 +02:00
Grégoire Paris
e88d261dca Make implicit type casts explicit 2021-07-10 10:41:25 +02:00
Benjamin Eberlei
95408cd8e4 [docs] Fix sentence about how nullable types affecting column definitions. (#8835) 2021-07-08 22:22:34 +02:00
Thomas Landauer
182bdaac6b Adding fields to Index (#8830)
* Adding `fields` to Index

I guess this was just forgotten here.
Wording is taken from https://www.doctrine-project.org/projects/doctrine-orm/en/2.9/reference/annotations-reference.html#index

* Update attributes-reference.rst
2021-07-08 22:06:57 +02:00
Grégoire Paris
551018136b Merge pull request #8826 from greg0ire/3.0.x 2021-07-08 12:15:53 +02:00
Grégoire Paris
3c805b22b4 Merge pull request #8825 from greg0ire/github-templates
Backport Github issue and PR templates
2021-07-06 08:34:55 +02:00
Grégoire Paris
48be0c1bd0 Merge remote-tracking branch 'origin/2.10.x' into 3.0.x 2021-07-06 08:31:57 +02:00
Grégoire Paris
7a56ca13f8 Merge pull request #8824 from greg0ire/remove-license-header
Drop license header
2021-07-06 08:30:55 +02:00
Grégoire Paris
6a41ab56ce Backport Github issue and PR templates 2021-07-05 23:14:47 +02:00
fridde
802dd54f07 Referenced new support for PHP8 attributes (#8823) 2021-07-05 22:06:04 +02:00
Grégoire Paris
be2d99e5f6 Drop license header 2021-07-05 21:26:41 +02:00
Grégoire Paris
0a663da5b6 Merge pull request #8822 from greg0ire/2.10.x 2021-07-05 10:36:24 +02:00
Grégoire Paris
0b3fc57458 Merge remote-tracking branch 'origin/2.9.x' into 2.10.x 2021-07-05 10:14:57 +02:00
Grégoire Paris
836c0d3803 Merge pull request #8814 from greg0ire/backport-7158
Proposed corrected typo in demo code.
2021-07-05 10:11:50 +02:00
Grégoire Paris
aa3ed91dd2 Merge pull request #8821 from greg0ire/fix-phpstan 2021-07-05 10:01:59 +02:00
Grégoire Paris
f542dde131 Pin PHPStan to current version
We want to control upgrades to avoid suddenly failing builds.
2021-07-05 09:22:54 +02:00
Grégoire Paris
a165d4af7c Adapt ignore rules to new PHPStan version 2021-07-05 09:13:37 +02:00
Cathy Guilbaud
ff13059ba2 Proposed corrected typo in demo code.
changed $payed to $paid.
2021-07-04 17:34:22 +02:00
Grégoire Paris
c3953435dd Merge pull request #8806 from greg0ire/resurrect-phpbench
Resurrect phpbench
2021-07-03 23:21:21 +02:00
Grégoire Paris
37f60be836 Merge pull request #8813 from greg0ire/deprecate-uuid-generator
Deprecate all things related to DB-generated UUIDs
2021-07-03 22:38:44 +02:00
Grégoire Paris
9f5b38f539 Deprecate all things related to DB-generated UUIDs
DB-generated UUIDs have been deprecated in the DBAL.
2021-07-03 21:52:26 +02:00
Grégoire Paris
665e5c49ea Merge pull request #8812 from greg0ire/update-baseline
Update baseline
2021-07-03 21:31:33 +02:00
Grégoire Paris
3a10e07dfc Update baseline
Many deprecations have been addressed, particularly DBAL ones.
2021-07-03 21:21:24 +02:00
Grégoire Paris
909de45c5c Merge pull request #8811 from greg0ire/2.10.x
Merge 2.9.x into 2.10.x
2021-07-03 21:17:46 +02:00
Grégoire Paris
5aa7f75f77 Merge remote-tracking branch 'origin/2.9.x' into 2.10.x 2021-07-03 21:02:03 +02:00
Grégoire Paris
8f2aef5fa3 Merge pull request #8810 from greg0ire/update-baseline
Update Psalm baseline
2021-07-03 21:00:26 +02:00
Grégoire Paris
05be0e8bbd Update Psalm baseline
It seems some deprecations have been addressed recently.
2021-07-03 20:46:37 +02:00
Grégoire Paris
64cf6edea6 Use consistent style for the OR operator 2021-07-03 12:07:43 +02:00
Grégoire Paris
7608a40463 Run phpbench in the CI 2021-07-03 12:05:45 +02:00
Grégoire Paris
b1f6f9bfc3 Make phpbench runnable again
There seems to have been a new major version.
2021-07-03 11:57:32 +02:00
Grégoire Paris
71af666c38 Merge pull request #8796 from derrabus/improvement/hydrators-dbal-3
Migrate hydrators and queries to DBAL's new Result interface
2021-06-30 23:39:19 +02:00
Grégoire Paris
3fe980de96 Merge pull request #8801 from derrabus/bugfix/ignore-return-type-will-change
Ignore errors about missing ReturnTypeWillChange class
2021-06-30 23:02:01 +02:00
Grégoire Paris
f5d988de4e Merge pull request #8784 from greg0ire/undeprecate-passing-null
Undeprecate targetEntity omission for some types
2021-06-30 21:42:13 +02:00
Grégoire Paris
e840aef630 Merge pull request #8798 from greg0ire/backport-7776
Remove hack to access class scope inside closures
2021-06-30 08:20:29 +02:00
Gabriel Caruso
2936bac7ec Remove hack to access class scope inside closures
This is possible since 5.4.
2021-06-29 23:56:37 +02:00
Grégoire Paris
55971d2f05 Merge pull request #8799 from greg0ire/backport-6909-6910
Combine consecutive issets and unsets
2021-06-29 23:51:35 +02:00
Grégoire Paris
1f6bfe1754 Merge pull request #8800 from jderusse/fix-exception
Fix exception not thrown by "getEntityIdentifier"
2021-06-29 23:50:41 +02:00
Alexander M. Turek
0723e664e1 Migrate hydrators and queries to DBAL's new Result interface
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-06-29 23:04:15 +02:00
Alexander M. Turek
b0c7993dd6 Ignore errors about missing ReturnTypeWillChange class
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-06-29 22:50:16 +02:00
Jérémy Derussé
796af72650 Fix exception not thrown by "getEntityIdentifier" 2021-06-29 22:32:29 +02:00
Gabriel Caruso
02174fb68f Combine consecutives issets 2021-06-28 23:33:33 +02:00
Gabriel Caruso
92c51de734 Combine consecutive unsets 2021-06-28 23:32:02 +02:00
Claudio Zizza
233d9b0276 Update session examples in docs (#8795)
The session examples contained approaches that aren't favorable for an application
and needed an overhaul using either scalar values or an DTO instead of the whole
entity with detach() and merge().
2021-06-28 23:23:40 +02:00
Grégoire Paris
b6d7826dc7 Merge pull request #8789 from greg0ire/backport-7292
Use a more concrete, less confusing example
2021-06-28 23:09:24 +02:00
Grégoire Paris
ce8de6df7f Merge pull request #8794 from derrabus/improvement/dbal-depecations
Fix deprecated DBAL calls
2021-06-28 10:58:20 +02:00
Grégoire Paris
b3ee7141eb Use a more concrete, less confusing example
I picked a toothbrush because you usually do not share it with other
persons, feel free to propose something else.
2021-06-28 00:03:29 +02:00
Grégoire Paris
73aa6e8352 Merge pull request #8791 from greg0ire/backport-docs-batch-2
Backport docs batch 2
2021-06-28 00:00:10 +02:00
Grégoire Paris
d1e5c59af9 Merge pull request #8792 from greg0ire/backport-malukenho
Backport malukenho's work
2021-06-27 23:59:19 +02:00
Grégoire Paris
e792777187 Merge pull request #8793 from greg0ire/backport-slamdunk
Backport slamdunk's work
2021-06-27 23:58:46 +02:00
Alexander M. Turek
afa837a361 Fix deprecated DBAL calls 2021-06-27 18:26:37 +02:00
Filippo Tessarotto
5a9bd0904b Apply ternary_operator_spaces 2021-06-27 12:18:14 +02:00
Filippo Tessarotto
b50d06ae58 Apply align_multiline_comment 2021-06-27 12:15:37 +02:00
Filippo Tessarotto
220201cf14 Apply escape_implicit_backslashes,heredoc_to_nowdoc 2021-06-27 12:06:02 +02:00
Filippo Tessarotto
5fa3a92ecb Apply bare heredoc_to_nowdoc 2021-06-27 12:05:50 +02:00
Jefersson Nathan
fef46263b5 Remove unused return statement
Signed-off-by: Jefersson Nathan <admin@phpse.net>
2021-06-27 11:09:23 +02:00
Jefersson Nathan
e6d9f99ac0 Remove redundant php-docs
Signed-off-by: Jefersson Nathan <admin@phpse.net>
2021-06-27 11:09:21 +02:00
Igor Pellegrini
f3e87d2c2f Fix bullet list not rendering correctly on Github
As *rst*, if reading the tutorial on the Github repository, the items
are not seen as elements of a bullet list, hence they are not rendered
and they are collapsed in a single line of text.

Fix won't affect how it renders on
[doctrine-project.org](https://www.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/getting-started.html).
2021-06-27 10:42:17 +02:00
Grégoire Paris
244e7c7c29 Merge pull request #8787 from greg0ire/optional-doctrine-annotations
Make doctrine/annotations an optional dependency
2021-06-27 10:15:00 +02:00
Catalin Ciobanu
53ba6b9732 Updated docblock 2021-06-26 23:04:56 +02:00
Jachim Coudenys
b3f580bf5e Fix the link to the 'Change Tracking Policies' documentation 2021-06-26 23:04:12 +02:00
Alex Rock Ancelet
774b5cbdd4 document using DTOs and entities as Value Objects 2021-06-26 22:51:22 +02:00
Gabriel Caruso
7fa3e6ec7c Use HTTPS instead of HTTP 2021-06-26 22:43:16 +02:00
Grégoire Paris
e743981f8d Merge pull request #8790 from greg0ire/backport-docs-batch
Backport docs batch
2021-06-26 22:18:30 +02:00
Haralan Dobrev
a469514ef0 Remove obsolete backslashes from underscores
These backslashes were not correctly migrated when updating the website
and it prevents search for some important terms like the query hints.
2021-06-26 18:57:58 +02:00
Jachim Coudenys
9fb13dbe28 Fix the result cache documentation (it caches raw data, not hydrated entities) 2021-06-26 17:12:28 +02:00
Adrian Föder
fc97041e49 [TASK] Streamline code block type hints for readability
This corrects a mistake with a given type hint in
the PHP code blocks as well as adds further for
consistency and brevity.
2021-06-26 16:14:05 +02:00
Claudio Zizza
f8f3b196a1 Extend documentation of arbitrary joins 2021-06-26 16:13:56 +02:00
Claudio Zizza
c01961840e Fix of variable typo in cache usage example 2021-06-26 16:13:47 +02:00
Andreas Möller
6ef1367cde Fix: Consistently format inversedBy and mappedBy attributes 2021-06-26 16:13:39 +02:00
Adrian Föder
3572b49e6a [FEATURE] Mention and link identifier generation strategies 2021-06-26 16:13:30 +02:00
Maciej Malarz
587c5f5ad6 Fix Criteria's orderBy example 2021-06-26 16:13:23 +02:00
someniatko
4f0a04e0eb Better PHPDoc for AbstractQuery cache methods
Updated useResultCache() and setResultCacheLifetime() docs to clearly state $lifetime is measured in seconds;
Added description to useResultCache()'s params. Renamed $bool => $useCache.
2021-06-26 16:13:19 +02:00
Andreas Möller
4451019dc0 Fix: Attributes vs. annotations 2021-06-26 15:56:33 +02:00
Gabriel Ostrolucký
c021426613 Fix #2935 [DDC-2236] Add note that Paginator might screw aggreg. queries 2021-06-26 15:56:09 +02:00
Gabriel Ostrolucký
243c8bff1f Fix EBNF of InExpression (StateFieldPath -> Arithmetic) 2021-06-26 15:55:18 +02:00
Gert de Pagter
5bbad8c403 Require ctype extension 2021-06-26 15:53:07 +02:00
Thomas Landauer
6c6b919788 Added UNIQUE INDEX to generated SQL schema
When I tried the example code, I got this unique index too.

Plus my `ALTER TABLE` statement was a little different from the one in the docs:
> ALTER TABLE cart ADD CONSTRAINT FK_BA388B79395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)
Should I change that too?
2021-06-26 15:51:51 +02:00
Thomas Bisignani
b37c433080 [Documentation] Fixed comments syntax 2021-06-26 15:50:34 +02:00
Claudio Zizza
173f31a14a Add readOnly attribute to annotation example 2021-06-26 15:48:33 +02:00
Guido Sangiovanni
319acb1076 typo in class description
fixed typo in class description
2021-06-26 15:46:45 +02:00
Arman
242d2c1c41 Remove year from license 2021-06-26 15:46:14 +02:00
Jérôme Vasseur
5c95ce5c21 Fix EntityRepository constructor phpdoc
Remove redundant phpdoc from EntityRepository constructor
2021-06-26 15:45:02 +02:00
Grégoire Paris
fa583f6533 Make doctrine/annotations an optional dependency
First, there are other drivers than the annotations-based one, and
second, one of them is base on attributes, which are basically
annotations native to PHP.

Closes #8785
2021-06-26 09:51:42 +02:00
Grégoire Paris
7a78fd2900 Undeprecate targetEntity omission for some types
Some relationship types are attached to properties that can be typed
since php 7.4.
To avoid repeating the property type in targetEntity, an autodetection
feature has been developed that allows building the mapping from that
type information and annotations.
Omitting the targetEntity stays deprecated for ManyToMany as there is no
auto-detection for that yet (although one could be built by analyzing
phpdoc annotations).
2021-06-24 23:41:05 +02:00
Grégoire Paris
67fc57b5e1 Merge pull request #8780 from derrabus/improvement/deprecated-constants
Fix usages of deprecated DBAL constants
2021-06-23 09:13:32 +02:00
Grégoire Paris
b4547888d9 Merge pull request #8782 from doctrine/2.9.x
Merge 2.9.x up into 2.10.x
2021-06-23 08:28:06 +02:00
Grégoire Paris
f233e4cf6b Merge pull request #8781 from derrabus/bugfix/static-analysis
Fix Psalm/PHPStan errors
2021-06-23 08:20:28 +02:00
Alexander M. Turek
7277afefb9 Fix usages of deprecated DBAL constants 2021-06-23 01:30:14 +02:00
Alexander M. Turek
b9f7e09401 Fix Psalm/PHPStan errors 2021-06-23 01:12:54 +02:00
Julio Montoya
5e91eea726 Link to correct section (#8778) 2021-06-22 13:12:54 +02:00
Julio Montoya
10922a5329 Spell "entity" properly (#8777) 2021-06-22 13:09:57 +02:00
Grégoire Paris
fbf793af0e Merge pull request #8543 from simonberger/add_missing_param_and_return_attributes
Add missing @param and @return PHPDoc attributes
2021-06-20 21:51:38 +02:00
Simon Berger
a26ae0648f Add missing @param and @Result PHPDoc attributes 2021-06-20 21:42:50 +02:00
Grégoire Paris
8bb564d5fe Limit template annotations to Psalm
Phpstan requires that the template can be resolved in all cases, while
Psalm seems to tolerate this ambiguous situation.
See https://github.com/phpstan/phpstan/issues/5175#issuecomment-861437050
2021-06-16 08:13:57 +02:00
Grégoire Paris
08149ea0b9 Merge pull request #8692 from greg0ire/split_orm_exception
Split the ORMException class
2021-06-15 23:43:16 +02:00
Grégoire Paris
06844484dd Split the ORMException class 2021-06-15 23:34:35 +02:00
Matthias Pigulla
7827869191 Make ResolveTargetEntityListener deal with the DiscriminatorMap as well (#8402) 2021-06-15 08:08:15 +02:00
Grégoire Paris
23602784f8 Merge pull request #8765 from doctrine/2.9.x-merge-up-into-2.10.x_osteH8Wj
Merge release 2.9.3 into 2.10.x
2021-06-14 18:40:15 +02:00
Philipp Fritsche
82e77cf508 Bugfix: handle repeatable attributes (#8756)
* fix: handle repeatable attributes

* Restore interface compatibility

A reader is supposed to only ever return objects. By introducing
RepeatableAttributeCollection, we fulfill the interface and improve
clarity.

* refactor: accurate type declarations and returns

* refactor: remove unused use

* Ignore AttributeReader in phpstan and psalm to pass on CI running PHP 7.4.

* test: isTransient

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
Co-authored-by: Benjamin Eberlei <kontakt@beberlei.de>
2021-06-13 12:29:22 +02:00
Grégoire Paris
1518b40dd2 Merge pull request #8758 from greg0ire/restore-bc-for-annotations
Restore bc for annotations
2021-06-10 19:12:13 +02:00
Grégoire Paris
10e41ec8bc Deprecate required of mandatory arguments 2021-06-09 23:04:16 +02:00
Grégoire Paris
303e346390 Restore backwards-compatibility
There used to be no constructor in this class, adding one with mandatory
arguments was technically a BC-break.

Fixes #8753
2021-06-09 23:04:16 +02:00
Grégoire Paris
fc7db8f59e Merge pull request #8747 from greg0ire/fix-attributes-syntax
Use correct named argument syntax in docs
2021-06-07 22:41:13 +02:00
Grégoire Paris
ae7f04ea53 Use correct named argument syntax in docs 2021-06-07 21:06:44 +02:00
Grégoire Paris
b8808099ea Merge pull request #8742 from derrabus/bugfix/return-type-will-change
Add ReturnTypeWillChange to ReflectionEmbeddedProperty
2021-06-05 23:52:49 +02:00
Alexander M. Turek
6432a3eeb2 Add ReturnTypeWillChange to ReflectionEmbeddedProperty 2021-06-05 22:51:55 +02:00
Grégoire Paris
3a0f60d6c6 Merge pull request #8734 from VincentLanglet/fixMetadata
Fix metadata constructor inference by phpstan
2021-06-05 21:48:17 +02:00
Grégoire Paris
ee19cf5cfd Merge pull request #8740 from VincentLanglet/fixMetada2
Make ClassMetadata covariant
2021-06-03 10:21:39 +02:00
Vincent Langlet
66daafd597 Make ClassMetadata covariant 2021-06-03 09:04:46 +02:00
Vincent Langlet
249c4fe61b Remove currentWorkingDirectory 2021-06-01 09:28:45 +02:00
Vincent Langlet
89673c60bf Fix metadata constructor inference by phpstan 2021-05-31 23:53:58 +02:00
github-actions[bot]
f8bcd2d200 Merge release 2.9.2 into 2.10.x (#8733)
* Mark 2.8.x as unmaintained, and 2.9.x as current

* Fix ClassMetadataInfo template inference

* Fix metadata cache compatibility layer

* Bump doctrine/cache patch dependency to fix build with lowest deps

* Add generics to parameters

* Add note about performance and inheritance mapping (#8704)

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>

* Adapt flush($argument) in documentation as it's deprecated. (#8728)

* [GH-8723] Remove use of nullability to automatically detect nullable status (#8732)

* [GH-8723] Remove use of nullability to automatically detect nullable status.

* [GH-8723] Make Column::$nullable default to false again, fix tests.

* Add automatic type detection for Embedded. (#8724)

* Add automatic type detection for Embedded.

* Inline statement.

Co-authored-by: Benjamin Eberlei <kontakt@beberlei.de>

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
Co-authored-by: Vincent Langlet <VincentLanglet@users.noreply.github.com>
Co-authored-by: Andreas Braun <git@alcaeus.org>
Co-authored-by: Fran Moreno <franmomu@gmail.com>
Co-authored-by: Juan Iglesias <juan.manuel.iglesias93@gmail.com>
Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>
Co-authored-by: Yup <warxcell@gmail.com>
Co-authored-by: Benjamin Eberlei <kontakt@beberlei.de>
2021-05-31 17:45:06 +02:00
Yup
75b4b88c5b Add automatic type detection for Embedded. (#8724)
* Add automatic type detection for Embedded.

* Inline statement.

Co-authored-by: Benjamin Eberlei <kontakt@beberlei.de>
2021-05-31 11:53:14 +02:00
Benjamin Eberlei
d9e59d6862 [GH-8723] Remove use of nullability to automatically detect nullable status (#8732)
* [GH-8723] Remove use of nullability to automatically detect nullable status.

* [GH-8723] Make Column::$nullable default to false again, fix tests.
2021-05-31 10:19:16 +02:00
Yup
5fa94969de Adapt flush($argument) in documentation as it's deprecated. (#8728) 2021-05-29 22:22:19 +02:00
Juan Iglesias
f2c3ddac97 Add note about performance and inheritance mapping (#8704)
Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>
2021-05-27 08:27:55 +02:00
Grégoire Paris
46f0da9ffa Merge pull request #8710 from franmomu/recompute
Handle generic parameters in UnitOfWork
2021-05-25 13:29:21 +02:00
Fran Moreno
1e832a6782 Add generics to parameters 2021-05-25 13:01:47 +02:00
Grégoire Paris
56bdb44efd Merge pull request #8722 from alcaeus/fix-metadata-cache-clear 2021-05-25 12:55:00 +02:00
Andreas Braun
fffac44991 Bump doctrine/cache patch dependency to fix build with lowest deps 2021-05-25 11:58:11 +02:00
Andreas Braun
e42b3d6584 Fix metadata cache compatibility layer 2021-05-25 10:38:00 +02:00
Grégoire Paris
7ab2c3abbd Merge pull request #8708 from VincentLanglet/patch-2
Fix ClassMetadaInfo template inference
2021-05-25 08:49:50 +02:00
Grégoire Paris
498c816b65 Merge pull request #8717 from greg0ire/update-branch-metadata
Mark 2.8.x as unmaintained, and 2.9.x as current
2021-05-25 00:01:21 +02:00
Vincent Langlet
eec740079d Fix ClassMetadataInfo template inference 2021-05-24 21:52:40 +02:00
Grégoire Paris
c359715a97 Mark 2.8.x as unmaintained, and 2.9.x as current 2021-05-24 21:32:26 +02:00
Benjamin Eberlei
f3e55fae9f Update .doctrine-project.json to include 2.9 stable and 2.10 upcoming 2021-05-24 17:54:12 +02:00
Michael Babker
91c3bd4121 Fix links to attribute sections (#8714) 2021-05-24 17:52:30 +02:00
Peter Gribanov
e6cf12c66f remove usage Webmozart (#8713) 2021-05-24 17:50:15 +02:00
Grégoire Paris
1c983629b5 Merge pull request #8706 from greg0ire/3.0.x
Merge 2.9.x into 3.0.x
2021-05-21 09:27:38 +02:00
Grégoire Paris
65160f626d Merge remote-tracking branch 'origin/2.9.x' into 3.0.x 2021-05-21 09:17:53 +02:00
Grégoire Paris
99d67cb77d Merge pull request #8705 from greg0ire/2.9.x
Merge 2.8.x into 2.9.x
2021-05-21 09:15:28 +02:00
Grégoire Paris
43f66d5808 Merge remote-tracking branch 'origin/2.8.x' into 2.9.x 2021-05-21 09:04:27 +02:00
Grégoire Paris
a6577b89a2 Merge pull request #8701 from jderusse/symfony6
Allow Symfony 6.0
2021-05-20 07:58:49 +02:00
Jérémy Derussé
0ca87566a9 Allow Symfony 6.0 2021-05-20 07:48:21 +02:00
Grégoire Paris
5d01f94a36 Merge pull request #8699 from greg0ire/fix-psalm
Fix some static analysis issues
2021-05-20 07:43:12 +02:00
Grégoire Paris
3d02b02636 Update static analysis baseline files
These issues were not introduced with new code, but with upgrades.
2021-05-20 00:03:39 +02:00
Grégoire Paris
6de321cb09 Address Psalm issues introduced by persistence 2021-05-20 00:03:39 +02:00
Grégoire Paris
535bc92dc8 Merge pull request #8700 from deguif/fix-undefined-offset
Fix undefined index
2021-05-18 12:20:38 +02:00
François-Xavier de Guillebon
ebb5d03f7a Fix undefined offset 2021-05-18 10:00:19 +02:00
Grégoire Paris
8e13369621 Merge pull request #8698 from deguif/cache-deprecation
Fix cache deprecation
2021-05-17 22:15:13 +02:00
François-Xavier de Guillebon
8eff4b775a Fix cache deprecation 2021-05-17 21:33:52 +02:00
Grégoire Paris
b85403d0a2 Merge pull request #8691 from alcaeus/check-deprecations
Check for use of deprecated API with Psalm
2021-05-15 18:50:30 +02:00
Andreas Braun
22ce3adfce Move to psalm level 2
This converts more issues to errors, most notably around deprecations. This can be used to later remove deprecated API.
2021-05-15 17:01:43 +02:00
tweet9ra
3a194ad699 SimpleObjectHydrator: skip unsuit custom type before converting it (#8566)
When using inheritance, it is possible to map the same column to properties of
different child classes. This can result in the same column being selecting several
times with different aliases in one SQL query, and only one aliased field needs
to be hydrated per row.
We now check that such an aliased value is mapped to the class we are hydrated
before attempting to convert it as it might result in an error when using a custom
type that does not get the expected data to initialize php value.

Co-authored-by: Sergey Naumov <s.naumov@lamoda.ru>
2021-05-15 09:37:16 +02:00
Andreas Braun
d52dab54dd Merge pull request #8672 from alcaeus/allow-cache-2.0 2021-05-14 20:21:56 +02:00
Andreas Braun
b5ac7714bc Remove ignored phpstan errors related to doctrine/cache 2.0 2021-05-13 20:38:21 +02:00
Andreas Braun
590551d5c3 Fix setup tool tests 2021-05-13 20:16:52 +02:00
Andreas Braun
c9fb9fdb40 Improve BC layer for getMetadataCacheImpl 2021-05-13 20:16:52 +02:00
Andreas Braun
965926dcc8 Update phpstan baseline to account for doctrine/cache deprecation 2021-05-13 20:16:52 +02:00
Andreas Braun
a6e30c5f4c Fix checkstyle violations 2021-05-13 20:16:52 +02:00
Andreas Braun
30ab6f4cea Add upgrade note for cache changes 2021-05-13 20:16:52 +02:00
Andreas Braun
5e5a44dce2 Suggest using symfony/cache in setup tool 2021-05-13 20:16:52 +02:00
Andreas Braun
d7bf30b291 Fix setup tool tests 2021-05-13 20:16:51 +02:00
Andreas Braun
ce8da6623f Stop using doctrine/cache 2021-05-13 20:16:51 +02:00
Andreas Braun
2ecec0c5d6 Remove reliance on doctrine/cache implementations in tests 2021-05-13 20:16:51 +02:00
Andreas Braun
6f128e4515 Allow installing doctrine/cache 2.0 2021-05-13 20:11:14 +02:00
Benjamin Eberlei
e24b0f0be7 [GH-8589] A new approach to non-nullable typed associations for BC (#8678)
* [GH-8589] A new approach to non-nullable typed associations for BC

* Address review comment about keeping the target entity type detection.
2021-05-10 19:08:16 +02:00
Benjamin Eberlei
6753b26f73 [GH-8676] Allow nested annotations to work without parents as attributes (#8677)
* [GH-8676] Allow nested annotations to work without parents as attributes.

* Housekeeping
2021-05-09 19:58:44 +02:00
Grégoire Paris
4ccc4e19fc Merge pull request #8600 from VincentLanglet/computeChangeset
Remove internal tag from computeChangeSet
2021-05-05 19:27:39 +02:00
Simon Podlipsky
4e2009433b Reflect that default EntityManager is not always named default (#8671)
Follows up #8646
2021-05-05 18:53:34 +02:00
Grégoire Paris
c25b822217 Merge pull request #8673 from Seldaek/patch-1
Add hint for ->iterate() deprecation
2021-05-05 13:31:30 +02:00
Jordi Boggiano
c3dcc5af91 Add hint for ->iterate() deprecation 2021-05-05 10:31:33 +02:00
Grégoire Paris
b2f404b25f Merge pull request #8651 from alcaeus/deprecate-doctrine-metadata-cache
Introduce PSR-6 for metadata caching
2021-05-01 14:53:46 +02:00
Alexandr Li
d141f27875 ConvertDoctrine1Schema: Fix Doctrine 1 notnull field import (#8649)
* ConvertDoctrine1Schema: Fix Doctrine 1 `notnull` field import

* cs fix

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-05-01 13:56:41 +02:00
Andreas Braun
4691839201 Extend DoctrineTestCase to fix missing methods 2021-04-29 12:54:23 +02:00
Andreas Braun
91387382b7 Allow symfony/cache 4.4 to provide PHP 7.1 support 2021-04-29 09:48:27 +02:00
Andreas Braun
f634c64b7a Use stubs over mocks in tests
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-04-29 09:42:18 +02:00
Andreas Braun
7ba9c980b5 Introduce PSR-6 for metadata caching 2021-04-29 09:42:18 +02:00
Grégoire Paris
dacdcf2c7b Merge pull request #8662 from greg0ire/2.9.x
Merge 2.8.x into 2.9.x
2021-04-29 09:27:40 +02:00
Grégoire Paris
f296fee9e4 Merge remote-tracking branch 'origin/2.8.x' into 2.9.x 2021-04-29 09:20:26 +02:00
Grégoire Paris
8555fc1d34 Merge pull request #8659 from greg0ire/make-tests-independent
Make tests independent
2021-04-29 09:07:26 +02:00
Grégoire Paris
b0826fd746 Merge pull request #8201 from oojacoboo/2.8.x
Throw Exception when unable to locate identifier
2021-04-28 15:57:50 +02:00
Jacob Thomason
fe93c2e9d5 Throw Exception that includes name of entity when unable to locate identifier 2021-04-28 15:33:03 +02:00
Grégoire Paris
850d57827f Make tests independent
It seems like IdentityMapTest cannot be run on its own when the second
level cache is enabled (with ENABLE_SECOND_LEVEL_CACHE=1).
It does work when running the whole test suite because
ExtraLazyCollectionTest disables part of that cache in its setUp()
method.
In this patch, we restore the class metadata as it was before running
setUp() and put the test in IdentityMapTest inside the group that is
excluded when running with ENABLE_SECOND_LEVEL_CACHE=1 on the CI.
2021-04-28 14:12:31 +02:00
Benjamin Eberlei
e1388fa986 [GH-8327] Make EntityManagerProvider compatible with expected DoctrineBundle usage (#8646)
* [GH-8327] Make EntityManagerProvider compatible with expected DoctrineBundle usage.

* phpcs

* [Gh-8327] Delegate to EntityManagerProvider::getDefaultManager in ConnectionFromManagerProvider
2021-04-25 19:44:12 +02:00
Grégoire Paris
1445a655fe Merge pull request #8654 from smilesrg/remove_entitymanager_copy
Removed EntityManagerInteface::copy()
2021-04-24 17:05:26 +02:00
Grégoire Paris
9a48450481 Merge pull request #7608 from mavroprovato/patch-1
Avoid unnecessary flush after processing first row
2021-04-24 14:23:09 +02:00
Serhii Smirnov
cf8adfe5d3 Updated UPGRADE.md 2021-04-24 15:05:25 +03:00
Kostas Kokkoros
cff8b96dd6 Avoid unnecessary flush after processing first row
The code as is needlessly flushes after just one row is updated or
removed. It makes more sense to update after ``$batchSize`` elements are
updated or removed, just as it is in the insert case.
2021-04-24 13:01:33 +02:00
Grégoire Paris
cf624ebb7b Merge pull request #8656 from doctrine/2.9.x
Manually merge 2.9.x into 3.0.x
2021-04-24 09:59:46 +02:00
Serhii Smirnov
c9a81e5241 #8462: Removed EntityManagerInterface::copy() 2021-04-23 19:31:40 +03:00
Grégoire Paris
996c1c74b3 Merge pull request #8644 from greg0ire/more-accurate-return-type
Describe return types more accurately
2021-04-22 22:31:05 +02:00
Grégoire Paris
48612e6dc6 Merge pull request #8641 from Jean85/remove-deprecated-proxy-usage
Replace deprecated Proxy usages with parent interface to reduce baseline
2021-04-19 23:37:22 +02:00
Benjamin Eberlei
ddfee26f80 Support for Array parameters in SQL filters (#8375)
* #1168 Add support for array parameters on the SQLFilter

* DDC-1168 Add support for array parameters on the SQLFilter

* [GH-2624] Rework array support to use new getParameterList()

* [DDC-1952] Change at() mocking to using returnCallback()

* [DDC-1952] Make arrays of values explicit with new setParameterList

* Adjust tests to use country as list and locale as single value.

* [DDC-1952] Add tests for new exxeption conditions.

* Apply suggestions from code review

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>

Co-authored-by: Manuel Nogales <nogales.manuel@gmail.com>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-04-19 19:46:22 +02:00
Grégoire Paris
eb860a704e Change incorrect DBAL return types 2021-04-19 19:27:00 +02:00
Grégoire Paris
51ffcb4891 Describe return types more accurately
This fixes an SA regression introduced when using stricter types in
SchemaTool.

Fixes #8642
2021-04-19 19:09:10 +02:00
Grégoire Paris
72f500318a Merge pull request #8544 from greg0ire/bc-type-declarations
Add type declarations where backwards-compatible
2021-04-19 14:02:17 +02:00
Grégoire Paris
55f030f66b Add type declarations where backwards-compatible
This includes:
- private methods
- return type declarations of final protected methods
- return type declarations of public and protected methods of final classes

Parameter type declarations are a more delicate matter and should
probably be handled separately to make it easier to catch issues during
code review.

Type declarations can be more trusted than simple phpdoc when it
comes to static analysis, having them means we can infer the phpdoc of
calling methods with confidence.

Note that it seems that some of the phpdoc I initially inferred these
declarations from were apparently wrong, in particular some mentioning
Doctrine\Dbal\Statement when was is really passed around is
Doctrine\Dbal\Driver\Statement.
2021-04-19 13:51:00 +02:00
orklah
95af30eb72 FileLockRegion::__construct 3rd param is meant to be an int (#8640) 2021-04-19 13:29:43 +02:00
Alessandro Lai
9ea0769d78 Replace deprecated Proxy usages with parent interface to reduce baseline 2021-04-19 10:43:49 +02:00
Benjamin Eberlei
22413453da Reintroduce PHP 7.1 support (#8613)
* Reintroduce PHP 7.1 support

* phpcs

* Another object typehint

* More compatibility

* phpcs

* Reduce doctrine/inflector versions again since 1.4.4 is released.

* Housekeeping: phpcbf

* Simplify PHPUnit Polyfill abstraction.

* Missing assertDoesNotMatchRegularExpression

* phpcs

* Add 7.1 on Github actions, since dependencies now supported.

* Simplify code to work with renamed phpunit assertions and document when to remove.

* phpcs

* Downgrade target phpstan version to 7.1.0

* Run --prefer-lowest with PHP 7.1 not 7.3
2021-04-18 21:24:51 +02:00
Grégoire Paris
06fadcdd8c Merge pull request #8630 from Jean85/reduce-baseline
Reduce baseline
2021-04-18 18:50:59 +02:00
Alessandro Lai
7c56aa2141 Reduce baseline with a nullable return where needed 2021-04-18 18:39:20 +02:00
Alessandro Lai
4cdcb5f760 Reduce baseline for AbstractCollectionPersister 2021-04-18 18:39:20 +02:00
Alessandro Lai
b542b36e45 Remove baseline for DefaultCacheFactory 2021-04-18 18:39:20 +02:00
Alessandro Lai
e5a7a13e1e Remove single baseline rule from DefaultCache 2021-04-18 18:39:20 +02:00
Alessandro Lai
8336dd3779 Remove baseline for AbstractQuery 2021-04-18 18:39:14 +02:00
Grégoire Paris
b04d7a62ae Merge pull request #8548 from orklah/test2
Adding details to types in PHPDoc
2021-04-18 18:09:28 +02:00
Grégoire Paris
a959a474fd Merge pull request #8636 from greg0ire/update-gitattributes
Update ignore rules to reflect current situation
2021-04-18 17:56:47 +02:00
Benjamin Eberlei
ce128e742b [GH-5202] Implement Query::HINT_READ_ONLY flag (#7936)
* Rebase QueryHintReadOnly on 2.9.x

* Housekeeping: phpcs

* [GH-5202] Dont mark known entities as read only.

* [GH-5202] Not mark objects read only when proxy before.

* phpcs
2021-04-18 16:45:25 +02:00
Benjamin Eberlei
dac87dae06 [GH-8327] Deprecate EntityManagerHelper for a provider abstraction. (#8524)
* cli config

* [GH-8327] Deprecate EntityManager HelperSet for a provider abstraction.

* Housekeeping: phpcs

* [GH-8327] Refactor tests towards use of SingleManagerProvider instead of HelperSet.

* [GH-8327] Refactor tests towards use of SingleManagerProvider instead of HelperSet.

* [GH-8327] Refactor tests towards use of SingleManagerProvider instead of HelperSet.

* Housekeeping: cs

* Update tests/Doctrine/Tests/ORM/Tools/Console/ConsoleRunnerTest.php

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>

* [GH-8327] Change option from entity-manager to em for consistency with DoctrineBundle.

* Add final to new methods and classes

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>

* [GH-8327] Bugfix: phpstan detected stricter type checks needed.

* phpcs

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-04-18 14:32:42 +02:00
Jakub Caban
a2230485b2 Fix typed properties for default metadata (#7939) (#8589)
* Make Column::$type, Column::$nullable and JoinColumn::$nullable nullable by default

* Add tests for mapped typed properties (type and nullable)

* Fix Yaml driver tests and remove driver exceptions thrown too early

* Fix PHP driver tests

* Fix static PHP driver tests

* Fix XML driver tests

* Coding Standards

* Deprecate unused MappingException method

* Add manyToOne test and check nullable at the right place

* Coding Standards

* Bugfix: Temporarily change association join columns in CascadeRemoveOrderTest to circumvent new CommitOrderCalculator bug.

* phpcs

Co-authored-by: Benjamin Eberlei <kontakt@beberlei.de>
2021-04-18 14:26:41 +02:00
Benjamin Eberlei
a68aa580c5 [GH-8345] Fields for unique constraints (#8629)
* Add possibility to use fields instead of column for unique constraint and indexes (#8345)

* Document changes in annotation reference

* phpcs

* Ensure exactly one of fields/columns is set for index/uniqueConstraint

* Adapt docs to fields/columns changes

* phpcs

* Implement fields in Attribute driver and fix mapping classes constructors.

* Coding Standard

* Apply suggestions from code review

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>

* phpcs

Co-authored-by: Jakub Caban <kuba.iluvatar@gmail.com>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-04-18 14:06:30 +02:00
Grégoire Paris
5ee71c54d4 Update ignore rules to reflect current situation
We no longer use Travis, we do not use git submodules as far as I know,
and we now use baseline files as well as project metadata.
2021-04-18 10:49:48 +02:00
orklah
dc37c2cd2f psalm fixes 2021-04-17 17:11:04 +02:00
Grégoire Paris
261a405970 Merge pull request #8635 from greg0ire/2.9.x
Manually merge 2.8.x into 2.9.x
2021-04-17 16:42:07 +02:00
Grégoire Paris
1ea51d88c4 Merge remote-tracking branch 'origin/2.8.x' into 2.9.x 2021-04-17 16:31:14 +02:00
Grégoire Paris
da3a9fa361 Merge pull request #8634 from orklah/static-upgrade
upgrade static tools
2021-04-17 15:41:51 +02:00
orklah
4fd81d26ff upgrade static tools 2021-04-17 13:12:35 +02:00
Benjamin Eberlei
f8e06ad31e [GH-6396] Allow custom hydrators access to meta columns via Query::HINT_INCLUDE_META_COLUMNS hint. (#8382) 2021-04-16 21:27:29 +02:00
Grégoire Paris
559c1ba806 Merge pull request #8628 from greg0ire/2.9.x
Merge 2.8.x up into 2.9.x
2021-04-16 20:08:51 +02:00
Grégoire Paris
4665758c44 Merge remote-tracking branch 'origin/2.8.x' into 2.9.x 2021-04-16 19:59:27 +02:00
Grégoire Paris
e2e9f8fa97 Merge pull request #8627 from greg0ire/add-baselines
Add baseline files for static analyzers
2021-04-16 19:04:04 +02:00
Grégoire Paris
f7249ec709 Declare return type
This helps SA tools figure out that it is fine to call count on the
return value of that method.
As a side-effect, using $metadata->name is not really an option since it
is not part of the ClassMetadata interface.
2021-04-16 13:14:54 +02:00
Grégoire Paris
87dbcca454 Add baseline files for static analyzers
There are many CS and SA-related changes in the ORM as we pursue better
code quality, and easier contributions. These often involve huge
changes, which can be hard to review and inevitably lead to some
regressions. I know some of those could have been avoided if we were
using stricter levels for PHPStan and Psalm.

By adding baselines, we ensure new code is at level 5 for both tools,
which should allow us to catch the most interesting issues.
2021-04-16 09:23:11 +02:00
Grégoire Paris
ceeea8ccd1 Merge pull request #8620 from greg0ire/2.9.x
Manually merge 2.8.x into 2.9.x
2021-04-13 19:23:10 +02:00
Grégoire Paris
6e16ef8c31 Merge remote-tracking branch 'origin/2.8.x' into 2.9.x 2021-04-13 18:51:39 +02:00
Grégoire Paris
305e0d6664 Merge pull request #8617 from greg0ire/cs9
Upgrade to doctrine/coding-standard 9
2021-04-13 18:48:12 +02:00
Grégoire Paris
199be94e6d Upgrade to doctrine/coding-standard 9 2021-04-13 09:00:33 +02:00
Benjamin Eberlei
09a7d9f18a [GH-6578] Add validation that inherited entity class is mapped in discriminator. (#8378) 2021-04-10 18:13:31 +02:00
Grégoire Paris
f57f33b67f Merge pull request #8606 from greg0ire/2.9.x 2021-04-09 13:33:34 +02:00
Grégoire Paris
e86cddb360 Merge remote-tracking branch 'origin/2.8.x' into 2.9.x 2021-04-09 13:21:30 +02:00
Grégoire Paris
fa588af3b1 Merge pull request #8604 from janatjak/2.8.x
Fix psalm param typehint for OneToManyAssociationBuilder::setOrderBy method
2021-04-09 12:57:12 +02:00
Grégoire Paris
d4741720fa Merge pull request #8605 from greg0ire/fix-phpdoc-lsp-violations 2021-04-09 11:59:28 +02:00
Grégoire Paris
343385d060 Pin squizlabs/php_codesniffer
We are referencing rules in phpcs.xml.dist, and may experience
unexpected BC-breaks because of that when they get renamed.
2021-04-09 09:27:44 +02:00
Grégoire Paris
6d04dced03 Address sniff rename
This sniff seems to have been renamed or split in the latest version of
phpcs.
2021-04-09 09:19:10 +02:00
Grégoire Paris
22fa3a8556 Document actual return types
Some executors may return integers, for instance executors that only
execute update or delete statements.
Also, in case an integer is not returned, what's actually returned is a
Doctrine\DBAL\Driver\ResultStatement, and not a Doctrine\DBAL\Driver\Statement
2021-04-09 08:52:56 +02:00
Jakub Janata
eb05756dc3 Fix psalm param typehint for OneToManyAssociationBuilder::setOrderBy method 2021-04-08 22:52:50 +02:00
Grégoire Paris
5bb7e20708 Merge pull request #8602 from NicoHaase/fix-8599
Adjusted return type annotation for getOriginalEntityData
2021-04-07 23:22:19 +02:00
Nico Haase
a9076313c7 Adjusted return type 2021-04-07 21:06:58 +02:00
Grégoire Paris
2a87821b28 Merge pull request #8552 from acoulton/maint-phpunit-upgrade 2021-04-07 15:33:06 +02:00
acoulton
da5877d60c Only polyfill older phpunit methods when required 2021-04-07 12:08:55 +01:00
Andrew Coulton
67dfe8e1af Simplify mock building calls
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-04-07 11:07:35 +01:00
Vincent Langlet
2dfe51b396 Remove internal tag 2021-04-07 11:41:34 +02:00
Grégoire Paris
5ac036de02 Merge pull request #8594 from greg0ire/make-sure-test-is-run 2021-04-06 17:47:17 +02:00
Grégoire Paris
fda0d7b440 Merge pull request #8596 from doctrine/2.8.x-merge-up-into-2.9.x_606c485ba431f2.86881997 2021-04-06 15:06:02 +02:00
Grégoire Paris
23e1fd8ad6 Drop assertion about not being an instance of proxy
We do not want to enforce it as it is an internal details that seems to
vary from environment to environment.
2021-04-06 14:55:25 +02:00
Benjamin Eberlei
f8fa0fe069 [GH-8592] Deprecated Named (Native) Queries in Metadata/EntityRepository (#8593)
* [GH-8592] Deprecated Named (Native) Queries in Metadata and EntityRepository.

* [GH-8592] Add deprecation notice for named queries in docs [ci-skip]
2021-04-05 21:59:08 +02:00
Grégoire Paris
a588555ecd Merge pull request #8586 from KartaviK/patch-3
Additional psalm param typehint for orderBy argument in findBy method
2021-04-05 20:38:36 +02:00
Grégoire Paris
501057da83 Ensure test is suffixed with Test 2021-04-05 14:42:17 +02:00
Grégoire Paris
7de84537f6 Merge pull request #8591 from DmitriiBezborodnikov/case_insensive_parenthesis
Return case insensitive check
2021-04-05 14:40:51 +02:00
Grégoire Paris
97f8325dad Make sure tests are suffixed with Test
They will not be taken into account when running vendor/bin/phpunit
otherwise.
2021-04-05 14:32:40 +02:00
Grégoire Paris
0ebd7052d7 Drop create table at shutdown
It makes tests more isolated from each other: another test relying on
some tables including some of the ones created here may fail creating
the tables it needs because they already exist.
2021-04-05 14:03:49 +02:00
Dmitrii Bezborodnikov
5d73378b92 Return case insensitive check 2021-04-05 14:03:49 +02:00
Grégoire Paris
10572ec441 Merge pull request #8590 from VincentLanglet/patch-2
Fix phpdoc of ClassMetadataInfo::getIdentifierValues
2021-04-04 23:47:09 +02:00
Vincent Langlet
76278d801d Fix phpdoc 2021-04-04 21:19:54 +02:00
Roman Varkuta
ca80830b26 Describe $orderBy parameter as a hash
A list of string is incorrect, it actually looks like this:
['someField' => 'DESC', 'someOtherField' => 'ASC'…]`
2021-04-03 12:45:24 +02:00
Grégoire Paris
d7e47f413f Merge pull request #8585 from doctrine/2.9.x
Merge 2.9.x into 3.0.x
2021-04-02 09:24:27 +02:00
Grégoire Paris
1ed89c756a Merge pull request #8582 from doctrine/2.8.x-merge-up-into-2.9.x_6066399d9875f8.96494390
Merge release 2.8.3 into 2.9.x
2021-04-02 09:12:58 +02:00
Grégoire Paris
bb078b5cb7 Merge remote-tracking branch 'origin/2.8.x' into 2.8.x-merge-up-into-2.9.x_6066399d9875f8.96494390 2021-04-02 09:00:35 +02:00
Grégoire Paris
bcb4889a2c Merge pull request #8583 from greg0ire/sync-static-analysis-workflows
Synchronize static analysis jobs with upstream
2021-04-02 08:58:50 +02:00
Grégoire Paris
961da8b0cc Synchronize static analysis jobs with upstream 2021-04-01 23:32:04 +02:00
Benjamin Eberlei
657a30f8ce [GH-6394] Bugfix: IdentifierFlattener support for association non-object values. (#8384)
* [GH-6394] Bugfix: IdentifierFlattener support for association non-object values

* [GH-6394] Bugfix: BasicEntityPersister::update used wrong identifiers for version assignment.

* Exclude MissingNativeTypeHint phpcs rule as 7.4 is not lowest version.
2021-04-01 23:16:53 +02:00
Benjamin Eberlei
c3f8996af5 Bump requirement to DBAL 2.13 (#8577) 2021-04-01 21:26:25 +02:00
Grégoire Paris
0655083e50 Merge remote-tracking branch 'origin/2.8.x' into 2.9.x 2021-04-01 09:02:08 +02:00
Grégoire Paris
0b25d4d8b0 Merge pull request #8573 from greg0ire/fix-build
Fix build issues
2021-04-01 07:49:27 +02:00
Grégoire Paris
a88242ee6c Adapt test logic to PHP and SQLite
There seems to be at least 2 camps in the software world when it comes
to the question "What's today minus one month", today being at the end
of march.

While PHP and SQLite agree that that would be the 2nd of March, other
RDBMS than SQLite and humans will tell you that it's the last day of
February.

This patch ensures that we check one logic for SQLite, and the other
logic for other platforms.
2021-03-30 21:08:29 +02:00
Grégoire Paris
fe4964008d Accommodate 2 behaviors of symfony/console in test
Decorated text used to be wrapped too early in SymfonyStyle->block()
See https://github.com/symfony/symfony/pull/40348
The fix was not contributed to version 3, which means we have to rewrite
the test so that it passes for both the correct and the buggy version.
2021-03-30 08:41:10 +02:00
Grégoire Paris
3f3de70c3e Merge pull request #8564 from cybercitizen7/featureIncludeDirectory
Adding DIR to include statement to fix issue with pathing
2021-03-26 19:46:40 +01:00
darkw1z
eb4e317144 Adding DIR to include statement to fix issue with pathing 2021-03-26 14:04:46 +01:00
Grégoire Paris
c8f2f61ea1 Merge pull request #8556 from VincentLanglet/patch-2
Fix fieldMapping phpdoc
2021-03-26 08:26:40 +01:00
Grégoire Paris
28b62cfb71 Merge pull request #8560 from doctrine/2.9.x
Merge 2.9.x up into 3.0.x
2021-03-25 23:48:51 +01:00
Vincent Langlet
c9502d3d0b Fix fieldMapping phpdoc 2021-03-24 15:07:08 +01:00
Benjamin Eberlei
b6b3c97436 [GH-8265] Attribute Metadata Driver (#8266)
* [GH-8265] Prototype for Attribute Metadata Driver

* [GH-8265] Skip AttributeDriverTest on PHP 7.

* [GH-8265] Fill more test entities with Attribute declarations to pass tests.

* [GH-8265] More test entity attributes for passing AttributeDriverTest.

* [GH-8265] Final changes to get AttributeDriverTest passing with test entities.

* [GH-8265] automatically update cs for new code when possible.

* [GH-8265] exclude sniffs that break because of phpcs not knowing attributes.

* [GH-8265] Fix AttributeReader styles.

* [GH-8265] Fix AttributeReader styles.

* [GH-8265] Missing changes to AttributeDriver

* [GH-8265] Fix InverseJoinColumn attribute cs violations.

* [GH-8265] Fix AbstractMappingDriverTest::_loadDriver and other CS

* [GH-8265] Coding styles

* [GH-8265] Coding styles

* [GH-8265] Coding styles

* [GH-8265] Coding styles

* [GH-8265] Convert Cache, ChangeTrackingPolicy, Column to named annotations.

* [GH-8265] Convert all annotations to named constructor for attribute support.

* [GH-8265] Style after attribute changes.

* [GH-8265] more styles

* [GH-8265] Remove workaround code for attributes.

* More cs

* More cs

* More cs

* More cs

* Add Attribute Metadata driver reference.

* Housekeeping: phpcs

* More merge conflict resolutions

* phpcs

* fix broken merge

* Change NamedArgumentConstructorAnnotation interface to use NamedArgumentConstructor annotation instead.

* phpcs

* Housekeeping: cs

* Housekeeping: cs

* Update docs with review comments

* Improve attribute docs

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>

* Rename AttributesDriver to AttributeDriver

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-03-23 13:30:57 +01:00
Benjamin Eberlei
8f6d146bc4 Bump doctrine/deprecations to at least v0.5.3 (#8553) 2021-03-22 23:23:03 +01:00
Grégoire Paris
3358ccde39 Merge pull request #8547 from greg0ire/psalm-lv6-phpdoc
Make phpdoc types correct
2021-03-21 22:11:51 +01:00
acoulton
1f4e6ebeeb Add a forward-compatibility wrapper for phpunit8 assertions
While doctrine still supports php7.2 the test cases need to run
under phpunit8 as well. However some assertion methods produce
deprecation warnings in the test output with phpunit >= 9.

This commit adds a thin forward compatiblity wrapper for the
new assertion method names so that they can be used with both
supported phpunit versions.
2021-03-18 11:25:18 +00:00
acoulton
a94db4f5c0 Fix remaining warnings from the phpunit9 upgrade
Some tests were still using deprecated assertion and mocking methods,
resulting in a long list of warnings in the phpunit output.

This commit resolves all the warnings:

* Fixes a couple of test names in `@depends` tags (presumably these
  tests were renamed at some point for coding standards).

* Changes how mocks are configured when asserting the same method
  is called multiple times with a sequence of arguments / sequence
  of return values. The old `->at` expectation is deprecated because
  it can be brittle and give unreliable results. Some of this
  mocking could probably still be refactored further, but my focus
  was on solving the deprecation with the existing setup.

* Removes one use of prophecy for mocking, in favour of using
  phpunit mock objects. Prophecy now requires an extra composer
  dependency and a trait which seems overkill given it was only
  used in one place.

* Updates to the new names for assertFileExists and assertRegExp
  (and their `not` versions) - these are functionally equivalent.

* Replaces the last few references to old PHPUnit_Framework_XXX
  classes with their namespaced equivalent. These were mostly in
  comments, or in native php `assert()` statements that were sanity
  checking mocked object types. These asserts are probably redundant
  (and are clearly not running in CI since the classes they referenced
  no longer exist).
2021-03-18 10:51:43 +00:00
Grégoire Paris
47475f3a67 Merge pull request #8532 from acoulton/bug-fix-ci-db-connection
All CI runs are using the sqlite fallback connection instead of the expected driver
2021-03-17 19:49:56 +01:00
acoulton
61c4a5da0a Rename tmpdb_ to privileged_db in test config and TestUtil
To avoid confusion, the `tmpdb_` test config values are now named
`privileged_db_` and better documented in the phpunit.xml.dist.

The TestUtil class has been refactored to more closely mirror the
structure and method / variable naming of the equivalent in
doctrine/dbal. This does not introduce any significant functional
changes. The only real difference is that the test output now prints
the selected database driver the first time it is referenced,
rather than repeating this through the test run.
2021-03-17 10:31:22 +00:00
acoulton
dd34bca4eb Upgrade previously-skipped tests to phpunit 9
These tests had not been running in CI so missed the previous
phpunit upgrade.

Note that assertions in decimal/floaty values in GH7941Test have
been changed to compare numerically with a reasonable level of
precision, instead of using regex. This is because the types
returned by the different drivers are inconsistent, and phpunit
now only allows regex comparisons on strings.
2021-03-17 10:31:22 +00:00
acoulton
3e21c50f61 Fix unit test and CI database driver / credential configuration
Builds using the github actions phpunit.xml files were not properly
recognising driver-specific configuration values, so were all
falling back to use the in-memory sqlite database instead of the
expected driver. This also meant a number of tests were skipped
as they rely on functionality not available in sqlite.

This commit addresses that by:

* REMOVING the automatic fallback to the sqlite memory database -
  phpunit.xml must now always specify explicit parameters for the
  desired connection.

* Displaying the active driver in the build output for visibility
  and debugging.

* Changing the way TestUtil loads the database config in line
  with the equivalent logic in doctrine/dbal, and to support the
  way that the config is/was specified in the phpunit.xml files
  for CI.

Note that this means a couple of the expected config variable names
have changed. Developers that are using customised phpunit.xml files
locally will need to update them to provide:

* Database config variables if they want to use the sqlite/memory
  driver - see phpunit.xml.dist for details.
* `db_driver` instead of `db_type`
* `db_user` instead of `db_username`
* `db_dbname` instead of `db_name`
* And, if in use, the equivalent changes to the `tmpdb_` values

The other change is that now if you provide any value for
`db_driver` we will attempt to create that connection type and
that will throw if other details (username / password / etc as
required by the driver) are not provided. Previously providing
partial configuration would cause TestUtil to silently fall back
to the in-memory sqlite driver.
2021-03-17 10:31:22 +00:00
Grégoire Paris
bc3592bcc8 Make phpdoc type correct 2021-03-16 19:20:11 +01:00
Grégoire Paris
4fccec1322 Merge pull request #8545 from orklah/psalm-plugins-2
remove some empty() use when safe
2021-03-15 23:51:09 +01:00
orklah
0177133385 remove unwanted check with 0 2021-03-15 23:28:20 +01:00
orklah
8df5cb84fa remove some empty() use when safe 2021-03-15 23:28:19 +01:00
Grégoire Paris
3b7275e183 Merge remote-tracking branch 'origin/2.8.x' into 2.9.x 2021-03-14 18:57:41 +01:00
Grégoire Paris
5247c56fce Merge pull request #8539 from greg0ire/cs-20210311
🎉 Final CS batch 🎉
2021-03-14 18:47:03 +01:00
Grégoire Paris
cc37c490c2 Synchronize coding standard workflow with upstream
Now that there no longer are cs issues, we can thank diff-sniffer and
kiss it goodbye!
2021-03-13 09:55:38 +01:00
Grégoire Paris
95824efd61 Manually fix cs 2021-03-13 09:46:38 +01:00
Grégoire Paris
44d4712e64 Ignore rule about annotation phpdoc
These phpdoc is parsed by doctrine/annotations, and that package does
not understand things like array<string, mixed> yet.
2021-03-13 09:46:38 +01:00
Grégoire Paris
930f44c02f Ignore rule for externally-defined property 2021-03-13 00:08:03 +01:00
Grégoire Paris
6e3c011e65 Ignore rule about superflous comment
We can fix it with a breaking change.
2021-03-13 00:08:03 +01:00
Grégoire Paris
a82de0d422 Ignore rule about unused method
It cannot work when you call the private method like a callable.
2021-03-13 00:08:03 +01:00
Grégoire Paris
9917488179 Ignore rule about empty statements
This should be implemented in a separate pull request.
2021-03-12 08:20:46 +01:00
Grégoire Paris
93f31d2c33 Merge pull request #8533 from acoulton/test-string-lock-version
Add test coverage for passing optimistic lock version as string
2021-03-11 21:41:32 +01:00
acoulton
77356b954f Add test coverage for passing optimistic lock version as string
As discussed in #8527, when using optimistic locking with integer
version columns, Doctrine has always supported passing the lock
version as a string. For example when passing in a version
received in POST / GET.

Technically speaking this does not comply with the docs and phdoc
(which show the app explicitly casting to int before passing).

Nonetheless the maintainers decided it should continue to be valid
for now and reinstated the old soft-equals logic with #8531.

This modified test just avoids accidental changes in future.
2021-03-11 13:24:53 +00:00
Grégoire Paris
92f764206e Ignore broken rule 2021-03-11 09:11:24 +01:00
Grégoire Paris
141539673e Merge pull request #8530 from doctrine/cs-20210310
CS-batch 25/26 🤩
2021-03-11 00:05:31 +01:00
Grégoire Paris
23dc804c9b Merge pull request #8531 from beberlei/GH-8527-RevertLockEquals
[GH-8527] Revert cs fixes for entity version compares in lock+merge
2021-03-10 23:30:25 +01:00
Benjamin Eberlei
9e3baa7baa [GH-8527] Revert cs fixes for entity version compares in lock+merge 2021-03-10 22:46:07 +01:00
Grégoire Paris
322ea51ecf Manually fix cs 2021-03-10 22:17:31 +01:00
Grégoire Paris
21b046452b Merge pull request #8529 from greg0ire/cs-20210308
CS batch 24/26 🤞
2021-03-10 19:53:52 +01:00
Grégoire Paris
c57b81ada4 Manually fix cs 2021-03-09 21:15:33 +01:00
Grégoire Paris
4fa7c9c6de Merge pull request #8521 from greg0ire/cs-20210228
CS batch 23/an estimated 26
2021-03-08 19:57:18 +01:00
Benjamin Eberlei
2685b65c2b [GH-6855] Trigger deprecation for unsupported lifecycle callback mapping on embedded classes.(#8381) 2021-03-04 22:08:11 +01:00
Benjamin Eberlei
3902a4eb6e [GH-8458] Properly deprecate ConvertDoctrine1Schema (#8517) 2021-03-02 09:38:09 +01:00
Jakub Caban
b3ed525d4d Use typed properties for default metadata for #7939 (#8439)
[GH-7939] Detect column and association types from typed properties.

* Use typed properties for default metadata for #7939

* Coding Standards

* Remove $name from CmsUserTypes and adapt tests

* Factor out conditions required for typed property

* Factor out typed validation and completion methods

* Move Typed tests model to separate namespace

* Don't pass by reference, return array

* Document changes to default mapping for typed properties

* Better wording in annotation reference

* Add missing targetEntity assertion on typed association

* Try to comply with CS

* USe constants instead of strings

* Use one-line comments for single line content

* phpcs

* phpcs

Co-authored-by: Benjamin Eberlei <kontakt@beberlei.de>
2021-03-01 22:13:58 +01:00
Grégoire Paris
3580517aac Manually fix cs 2021-03-01 21:49:10 +01:00
Benjamin Eberlei
4cdc6b1a71 [GH-7128] Improve OneToManyRequiresMappedBy Exception message (#8380) 2021-03-01 21:42:57 +01:00
plfort
38ccbd8638 DDC-2076 - MEMBER OF - Remove useless join over target table of ManyToMany relationship (#8438)
Co-authored-by: Pierre-Louis FORT <pierre-louis.fort@theia.fr>
2021-02-28 23:37:40 +01:00
Grégoire Paris
f9e7c3c2d8 Merge pull request #8516 from greg0ire/cs-20210227
CS batch 22/an estimated 26
2021-02-28 21:27:52 +01:00
Grégoire Paris
3600c0fbca Manually fix cs 2021-02-28 18:31:38 +01:00
Grégoire Paris
f779513042 Remove unused properties
They should have been removed as part of a6b43b93ac
2021-02-28 18:31:38 +01:00
Benjamin Eberlei
b4e6530d2d [GH-8471] Deprecate Partial DQL syntax and forcing partial loads. (#8472)
* [GH-8471] Deprecate Partial DQL syntax and forcing partial loads.
2021-02-28 18:17:12 +01:00
Diego Rin Martín
07d426edf5 Changed lock function to compare timestamps instead of DateTimeInterface objects directly. (#8508)
When using optimistic lock with DateTimeInterface based version field a bug appears due to the use of the === operator for comparing the lock version and the entity version. This comparison always resolves to false because the === operator when comparing objects is only true when both sides are the exact same instance of the object.

To fix the issue I have decided to compare timestamps instead the DateTimeInterface based objects directly, calling getTimestamp() method and doing a strict comparison.

Modified OptimisticLockException to use DateTimeInterface instead of DateTime class.

Added test suite to cover case.

Fixes #8499
2021-02-27 18:40:48 +01:00
Grégoire Paris
4afd4069be Merge pull request #8515 from greg0ire/cs-20210226
CS batch 21/an estimated 26
2021-02-27 14:30:25 +01:00
Grégoire Paris
239215c2e5 Merge pull request #8502 from greg0ire/rework-contributing-md
Rework CONTRIBUTING.md
2021-02-27 13:03:20 +01:00
Grégoire Paris
e6f11652d2 Add section for 2.9.x branch 2021-02-27 12:16:49 +01:00
Grégoire Paris
2910a73927 Rework badges urls
Some .x were missing, and ugly urlencoding can be avoided.
2021-02-27 12:10:47 +01:00
Grégoire Paris
3959b2743c Remove references to Travis 2021-02-27 12:03:35 +01:00
Grégoire Paris
658e54027e Remove trailing whitespace 2021-02-27 12:01:06 +01:00
Grégoire Paris
ba882451b0 Refer to our actual coding/standard
We do much more than just PSR 1 and 2
2021-02-27 12:01:05 +01:00
Grégoire Paris
1ed9840123 Refer to global workflow policy
We are doing things differently now, and the how is already documented.
2021-02-27 12:01:05 +01:00
Grégoire Paris
71044894a1 Manually fix cs 2021-02-26 21:30:49 +01:00
Grégoire Paris
1a41d6b87c Fix configuration mix up 2021-02-26 08:25:44 +01:00
Grégoire Paris
5dfcb08999 Merge pull request #8512 from greg0ire/cs-20210225
CS batch 20/an estimated 26
2021-02-25 23:23:24 +01:00
Grégoire Paris
284bd6fd03 Manually fix cs 2021-02-25 21:22:50 +01:00
Grégoire Paris
e40ac3e1d0 Merge pull request #8510 from greg0ire/cs-20210224
CS batch 19/an estimated 26
2021-02-24 22:41:28 +01:00
Grégoire Paris
0bce2472f2 Manually fix cs 2021-02-24 18:51:02 +01:00
Grégoire Paris
89f57de884 Merge pull request #8504 from greg0ire/cs-20210223
CS batch 18/an estimated 26
2021-02-23 23:18:42 +01:00
Grégoire Paris
ae19f40958 Merge pull request #8495 from Warxcell/fix_to_iterable_with_cache
Fix bug when using Result Cache with Query::toIterable
2021-02-23 20:16:39 +01:00
Grégoire Paris
c2d69a3c48 Merge pull request #8507 from greg0ire/address-move-away-from-master
Address move away from master
2021-02-23 18:19:47 +01:00
Grégoire Paris
6ce91dd37b Address move away from master 2021-02-23 09:24:40 +01:00
Grégoire Paris
57e6ba25c9 Merge pull request #8505 from dbu/patch-1
fix typo in changelog
2021-02-23 08:56:31 +01:00
David Buchmann
9d2e67bbb4 fix typo in changelog 2021-02-23 08:17:31 +01:00
Grégoire Paris
2dce5b20ad Manually fix cs 2021-02-22 23:50:09 +01:00
Warxcell
930859f803 Fix bug when using ResultCache with Query::toIterable.
Signed-off-by: Warxcell <warxcell@gmail.com>
2021-02-22 23:35:22 +02:00
Yup
a70c73ae3a Use RegEx to match if queryPart contains OR/AND (#8453)
This allows fixes cases of queries that contain line feeds or tabs but
do not benefit from automatic wrapping of parenthesis.
2021-02-22 20:58:06 +01:00
David Buchmann
074346b8d5 Note deprecation of AbstractQuery::iterator (#8497) 2021-02-22 20:30:05 +01:00
Grégoire Paris
9ed4a8c043 Merge pull request #8498 from greg0ire/cs-20210222
CS batch 17/an estimated 26
2021-02-22 20:25:06 +01:00
Grégoire Paris
9c917811e5 Manually fix cs 2021-02-22 09:12:04 +01:00
Grégoire Paris
f883820257 Ignore rule about wrong comment style 2021-02-22 08:48:46 +01:00
Grégoire Paris
a32045dd51 Ignore rule violated by external package 2021-02-22 07:52:57 +01:00
Grégoire Paris
672b04a55d Merge pull request #8483 from olsavmic/fix-single-scalar-hydrator-memory-leak-on-exception
Fix single scalar hydrator memory leak on exception
2021-02-21 21:12:50 +01:00
Grégoire Paris
261334aca2 Merge pull request #8494 from greg0ire/cs-20210221
CS batch 16/an estimated 26
2021-02-21 20:29:47 +01:00
Warxcell
7f6ed094cd Add test to verify that using ResultCache with Query::toIterable is failing. 2021-02-21 21:12:52 +02:00
Grégoire Paris
a792655813 Manually fix cs 2021-02-21 12:20:19 +01:00
Grégoire Paris
fb71204910 Relax assertion (#8493)
EntityManager is too restrictive, any implementation can actually be
returned here.

Closes #8488
2021-02-21 07:43:56 +01:00
Grégoire Paris
b918661cf1 Merge pull request #8492 from greg0ire/cs-20210220
CS batch 15/an estimated 26
2021-02-20 20:49:25 +01:00
Michael Olšavský
7971a53164 Method hydrateAll() does not take into account possible exception
from hydrateAllData() which in turn does not call cleanup()
2021-02-20 18:58:50 +01:00
Grégoire Paris
a175f96ae8 Manually fix cs 2021-02-20 15:37:15 +01:00
Grégoire Paris
7c1cde6471 Ignore rule that triggers on external property 2021-02-20 15:32:26 +01:00
Grégoire Paris
1ffc0cacf4 Merge pull request #8491 from greg0ire/cs-20210219
CS batch 14/an estimated 26
2021-02-20 11:10:27 +01:00
Grégoire Paris
e979d0d50f Manually fix cs 2021-02-20 00:01:41 +01:00
Grégoire Paris
553ea03079 Ignore rule about case mismatch
@group does not have to do with the Group entity at all.
2021-02-19 23:33:25 +01:00
Grégoire Paris
149014879d Ignore rule about property defined externally 2021-02-19 23:11:43 +01:00
Grégoire Paris
b991c58988 Merge pull request #8490 from greg0ire/cs-20210218
CS batch 13/an estimated 26
2021-02-19 23:08:25 +01:00
Aleksandr Frolov
ee9627b82e Update QueryBuilder::setParameters docs (#8487)
Use `ArrayCollection` instead of plain array (which is supported only for bc)
2021-02-19 01:45:14 +01:00
Grégoire Paris
e3f03414f9 Manually fix cs 2021-02-18 23:17:03 +01:00
Grégoire Paris
1f406fd3df Merge pull request #8484 from greg0ire/cs-20210217
CS batch 12/an estimated 26
2021-02-18 21:54:43 +01:00
Grégoire Paris
0ae53a6703 Merge pull request #8485 from doctrine/2.8.x-merge-up-into-2.9.x_602d59a0aa86b9.63081052
Merge release 2.8.2 into 2.9.x
2021-02-17 20:50:44 +01:00
Grégoire Paris
49864a7f57 Merge remote-tracking branch 'origin/2.8.x' into 2.8.x-merge-up-into-2.9.x_602d59a0aa86b9.63081052 2021-02-17 20:39:28 +01:00
Grégoire Paris
b747bf15ff Manually fix cs 2021-02-17 16:32:39 +01:00
Grégoire Paris
5fe85bfc03 Ignore rule about underscore in method name
We inherit from a class defined in another package.
2021-02-17 15:55:21 +01:00
Grégoire Paris
0dccf05ca8 Automatically fix cs 2021-02-17 15:55:21 +01:00
Grégoire Paris
ebae57eb96 Merge pull request #8480 from greg0ire/cs-20210216
CS batch 11/an estimated 26
2021-02-16 23:10:18 +01:00
Benjamin Eberlei
30a7c2aa67 [GH-8410] Fix memory leak in new toIterable and state bug. (#8467)
* [GH-8410] Fix memory leak in new toIterable and state bug.

The new AbstractQuery::toIterable() had a memory leak that
AbstractQuery::iterable() did not have. This leak is now fixed.

After fixing the leak, one test failed where the identity map in
ObjectHydrator triggered and lead to a notice. Introduced a new
AbstractHydrator::cleanupAfterRowIteration() that the ObjectHydrator
uses to cleanup the state.

* [GH-8413] Bugfix: Iterating with multiple, mixed results

When multiple entity results are part of a row, the result handling
must be different. In addition mixed results with scalars are broken
and now throw an exception as illegal operation.

* Housekeeping: phpcs

* [GH-8413] Add assertions for entity alias iteration.

* [GH-8387] Missing @deprecated on Query::iterate
2021-02-16 17:52:20 +01:00
Benjamin Eberlei
3a9b8fde9b Housekeeping: Fix cs 2021-02-16 16:24:19 +01:00
Yosh
4f864bc178 Identifier type is not set when many2many relations are deleted (#8401)
* Ensure identifier type is set on deleteJoinTableRecords

* Housekeeping: phpcs

* Housekeeping: phpcs

Co-authored-by: Benjamin Eberlei <kontakt@beberlei.de>
2021-02-16 16:12:39 +01:00
Grégoire Paris
d76cbd755f Manually fix cs 2021-02-16 09:07:26 +01:00
Grégoire Paris
4aece04ae7 Automatically fix cs 2021-02-16 08:48:48 +01:00
Grégoire Paris
f31dbf8d4e Merge pull request #8479 from greg0ire/cs-20210215
CS batch 10/an estimated 27
2021-02-15 23:44:27 +01:00
Grégoire Paris
416f35dba9 Manually fix cs 2021-02-14 21:00:58 +01:00
Grégoire Paris
c29370e061 Automatically fix cs 2021-02-14 14:39:35 +01:00
Grégoire Paris
4e0f6837d0 Merge pull request #8478 from beberlei/CsFixes2
CS Fixes 2 string interpolation to sprintf
2021-02-14 14:39:00 +01:00
Benjamin Eberlei
e45d212f02 Housekeeping: CS fixes Doctrine\ORM\Mapping\MappingException 2021-02-14 14:28:42 +01:00
Benjamin Eberlei
8f62bd39b5 Housekeeping: CS fixes Doctrine\ORM\ORMException 2021-02-14 09:53:19 +01:00
Benjamin Eberlei
5e11afcdf1 Housekeeping: CS fixes Doctrine\ORM\Mapping\MappingException 2021-02-14 09:49:39 +01:00
Benjamin Eberlei
f833222017 Cs fixes1 (#8475)
* Housekeeping: CS Query, AbstractQuery, NativeQuery.

* Housekeeping: phpcs TreeWalker

* Housekeeping: CS Doctrine\ORM\EntityManager

* Housekeeping: CS Doctrine\ORM\Cache

* Upgrade git-phpcs

* Drop unused method parameter

* Describe types more precisely

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-02-14 09:23:15 +01:00
Grégoire Paris
c7f39ebbde Merge pull request #8477 from greg0ire/cs-20210214
CS batch 9/an estimated 28
2021-02-14 09:20:11 +01:00
Grégoire Paris
15f08ed006 Manually fix cs 2021-02-14 00:04:18 +01:00
Grégoire Paris
b6fd4b5ef3 Automatically fix cs 2021-02-14 00:04:11 +01:00
Benjamin Eberlei
e2e59e94f5 [GH-8383] deprecate notify change tracking policy (#8473)
* [GH-8383] Deprecate notify change tracking policy.

* [GH-8383] Add warning to documentation about notify change tracking policy deprecation.
2021-02-13 23:14:28 +01:00
Grégoire Paris
5e4dae88f3 Merge pull request #8476 from greg0ire/cs-20210213
CS batch 8/an estimated 30
2021-02-13 17:26:58 +01:00
Grégoire Paris
7312ddeda7 Manually fix cs 2021-02-13 13:46:01 +01:00
Grégoire Paris
9a67b6f699 Merge pull request #8474 from greg0ire/cs-20210212
CS batch 7/an estimated 30
2021-02-12 23:03:28 +01:00
Grégoire Paris
f59a0c349b Manually fix cs 2021-02-12 20:43:17 +01:00
Grégoire Paris
4c8831f716 Remove unused helper method 2021-02-12 20:04:56 +01:00
Benjamin Eberlei
6fe388a705 Introduce doctrine/deprecations (#8466)
* Introduce doctrine/deprecations, empty out VerifyDeprecations trait for now.

* Replace more usages of VerifyDeprecations (akwardkly for now)

* Update doctrine/deprecations to v0.2.0

* Remove ORM VerifyDeprecations trait and its use.

* Use doctrine/deprecatios VerifyDeprecations trait where useful

* Housekeeping: phpcs

* Fix reference link for toIterable/iterate deprecation
2021-02-12 18:14:34 +01:00
Vincent Langlet
172a8d9414 Restrict EntityManagerInterface::getRepository (#8417) 2021-02-12 17:44:22 +01:00
Grégoire Paris
01ca442be7 Ignore error about no assignment
These files must be require'd
2021-02-12 08:45:07 +01:00
Grégoire Paris
01374ca2ab Ignore rule about lone comment
That comment is mistaken for a method comment because it precedes one.
The issue was reported but will most likely not be fixed.
2021-02-12 07:39:56 +01:00
Grégoire Paris
94e8b1d43c Merge pull request #8470 from greg0ire/cs-20210211
CS batch 6/an estimated 30
2021-02-12 07:25:43 +01:00
Grégoire Paris
61d0f96c17 Manually fix cs 2021-02-11 21:02:10 +01:00
Grégoire Paris
41729be80a Spell "first" properly 2021-02-11 18:24:56 +01:00
Grégoire Paris
6dbaa39016 Merge pull request #8469 from greg0ire/cs-20210209
CS batch 5/an estimated 30
2021-02-10 21:11:11 +01:00
Grégoire Paris
58c95a92d1 Manually fix cs 2021-02-09 22:58:05 +01:00
Grégoire Paris
4958180b02 Merge pull request #8468 from greg0ire/cs-20210208
CS batch 4/an estimated 30
2021-02-09 22:22:41 +01:00
Grégoire Paris
d00dbf7e2d Merge pull request #8357 from snapshotpl/add-psalm-annotation
Add psalm annotation to ArrayCollection of Parameters
2021-02-08 21:25:58 +01:00
Grégoire Paris
8312ff0cb5 Merge pull request #8353 from fezfez/patch-1
Add docs to export-ignore
2021-02-08 21:23:35 +01:00
Witold Wasiczko
17012f1fea Improve psalm types 2021-02-08 21:16:56 +01:00
Witold Wasiczko
324ac3972f Add psalm annotation for parameters 2021-02-08 21:16:25 +01:00
Grégoire Paris
fb9b9b276e Manually fix cs 2021-02-08 13:53:04 +01:00
Benjamin Eberlei
323469cdb7 Add /*.phpunit.xml to .gitignore 2021-02-07 19:38:52 +01:00
Grégoire Paris
792a9a9149 Merge pull request #8464 from greg0ire/cs-20210207
CS batch 3/many
2021-02-07 14:21:09 +01:00
Grégoire Paris
0f655f9fb6 Manually fix cs 2021-02-07 12:21:40 +01:00
Grégoire Paris
2d7acbd07f Merge pull request #8457 from greg0ire/cs-20210206
CS Batch 2/many
2021-02-06 12:22:10 +01:00
andrews05
835030297a Add support for INDEX BY an associated entity (2.9.x) (#7918)
* Add support for INDEX BY an associated entity

This allows specifying an association in the INDEX BY clause of a query
which will index by the association's join column.

Related to #7661.

* Reintroduce IndexBy#simpleStateFieldPathExpression as deprecated property.

* Housekeeping: phpcs

* Housekeeping: phpcs

Co-authored-by: Benjamin Eberlei <kontakt@beberlei.de>
2021-02-06 11:46:18 +01:00
Grégoire Paris
b06679cc14 Manually fix cs 2021-02-06 11:44:32 +01:00
Julian Ullrich
2693a93aed fixed entity generation for numeric values (#8434)
* fixed entity generation for numeric values

* fixed entity generation for numeric values

Co-authored-by: julian <julian@ullrichmail.net>
2021-02-06 00:35:45 +01:00
Benjamin Eberlei
8724589c6e Housekeeping: Fix wrong typehint - Closes #8421 2021-02-06 00:23:45 +01:00
Grégoire Paris
4cc78d9478 Merge remote-tracking branch 'origin/2.8.x' into 2.9.x 2021-02-05 23:40:59 +01:00
Grégoire Paris
424305ef38 Merge pull request #8455 from greg0ire/cs
Cs
2021-02-05 23:40:01 +01:00
Grégoire Paris
9d01f6a45c Run phpcbf after running git-phpcs
git-phpcs can publish comments to Github, that will be helpful.
phpcbf will still be helpful to ensure no one upgrades the coding
standard without also fixing issues that can be autofixed.
2021-02-05 21:39:13 +01:00
Grégoire Paris
7ed487b534 Manually fix CS 2021-02-05 21:38:33 +01:00
Grégoire Paris
68d24288ce Merge remote-tracking branch 'origin/2.8.x' into 2.9.x 2021-02-05 20:06:04 +01:00
Grégoire Paris
40f3925589 Merge pull request #8144 from greg0ire/cs
Automated fixes with phpcbf + manual fixes
2021-02-05 08:44:58 +01:00
Alexander Schranz
f92c3dba32 Fix --complete flag in orm:ensure-production-settings command (#8426) 2021-02-01 22:08:04 +01:00
Grégoire Paris
5abad7c0af Merge remote-tracking branch 'origin/2.8.x' into 2.9.x 2021-01-31 00:01:45 +01:00
Grégoire Paris
bcbd4401b8 Ignore export directory 2021-01-30 23:50:15 +01:00
Grégoire Paris
d6aca8e146 Fix proxy file exclude pattern
__CG__ is a file prefix, not a directory
2021-01-30 23:45:46 +01:00
Grégoire Paris
8f1911a4fe Fix cs by hand 2021-01-30 23:29:40 +01:00
Grégoire Paris
7f30cd3102 Require doctrine/common ^3.0.3
That release comes with a fix for a bug that affects us since we are
using return type declarations for wakeUp() in proxyfied classes in on
of our tests.
2021-01-30 18:55:32 +01:00
Grégoire Paris
f01fe3e050 Fix or remove wrong assertions 2021-01-30 18:55:32 +01:00
Grégoire Paris
210c2ee6a4 Remove strict types 2021-01-30 18:55:32 +01:00
Grégoire Paris
497dfd1a84 Avoid covariant return types
It's not supported by PHP 7.2/7.3
2021-01-30 18:55:31 +01:00
Grégoire Paris
d9f0e2a27f Add exclude rules for tricky cases 2021-01-30 18:55:31 +01:00
Grégoire Paris
9a40ac6e2a Restore weird phpdoc
Tests do not pass when I format that phpdoc nicely.
2021-01-30 18:55:31 +01:00
Grégoire Paris
1687d9c479 Restore version annotation, but capitalized
@version is commonly used for svn ids and is forbidden
2021-01-30 18:55:31 +01:00
Gabriel Ostrolucký
1a46ed8901 Relax contract of EntityListenerResolver so it doesn't require class name (#8448)
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
2021-01-30 13:37:26 +01:00
Grégoire Paris
36d0352c01 Add missing use statements 2021-01-30 11:21:44 +01:00
Grégoire Paris
15eacd787b Remove weird extra argument 2021-01-30 11:21:44 +01:00
Grégoire Paris
5b3f9bdd7b Fix type declarations 2021-01-30 11:21:44 +01:00
Grégoire Paris
e00dba94f4 Remove strict types 2021-01-30 11:21:44 +01:00
Grégoire Paris
ab0e4007a5 Use interface instead of concretion 2021-01-30 11:17:40 +01:00
Grégoire Paris
32266c54f9 Fix compatibility with parent signature 2021-01-30 11:17:39 +01:00
Grégoire Paris
dd2120cd41 Make default value compatible with phpdoc 2021-01-30 11:17:39 +01:00
Grégoire Paris
8991df0785 Add missing return types 2021-01-30 11:17:39 +01:00
Grégoire Paris
ca31923a39 Run phpcbf in the CI
There are still many CS issues to fix, but with this, we now know people
can run vendor/bin/phpcbf to fix their issues and only their issues.
2021-01-30 11:17:39 +01:00
Grégoire Paris
68bc00b6c6 Automatically fix CS 2021-01-30 10:58:42 +01:00
Grégoire Paris
5b55b8c6cf Disable rules that would result in BC-breaks 2021-01-29 23:21:12 +01:00
Grégoire Paris
10f381bc95 Restrict fixes to be compatible with PHP 7.2 2021-01-29 21:16:18 +01:00
Nikolay Gagarinov
40aa8fe5db update getting-started fix type, improve doc (#8440)
* update getting-started fix type, improve doc

* Update getting-started.rst
2021-01-26 21:40:41 +01:00
Simon Podlipsky
5801474ba3 Catch doctrine/persistence MappingException (#8264)
When driver chain is used doctrine/persistence MappingException is thrown instead of doctrine/orm MappingException
2021-01-11 09:07:06 +01:00
Claudio Zizza
9dbd960631 Update website config to current repository branches (#8420) 2021-01-11 09:06:06 +01:00
Grégoire Paris
544df89055 Use proper workflow name (#8418)
This must have been a copy/paste/adapt mistake.
2021-01-11 09:05:18 +01:00
orklah
f0ad5f72b2 bump psalm and fix some issues on level 6 (#8409) 2021-01-08 20:30:15 +01:00
azjezz
378944dd27 remove T from class metadata (#8398) 2020-12-19 20:48:16 +01:00
Benjamin Eberlei
8b749642cd [GH-8231] Bugfix: Missed dirty check synchronization check. (#8392)
When an entity with change tracking policy "deferred explicit" gets
removed, then persisted again, it is not schedulded for a dirty check
synchronization. This is not the case for entities that are persisted
and are already in the managed state.
2020-12-14 11:00:07 +01:00
Nic Wortel
277b53a970 Use the ramsey/composer-install action to install dependencies (#8388)
Follow-up of https://github.com/doctrine/.github/pull/16.
2020-12-10 20:03:47 +01:00
Benjamin Morel
2febb4509a Fix Psalm param (#8386) 2020-12-09 11:03:01 +01:00
Benjamin Eberlei
cbc252f3b7 Add Doctrine\ORM\Query\Expr::mod() (#8377)
* Add Doctrine\ORM\Query\Expr::mod()

Co-authored-by: Menno Holtkamp <menno.holtkamp@shopforce.nl>

* [GH-6739] Add entry to documentation

Co-authored-by: Menno Holtkamp <menno.holtkamp@shopforce.nl>
2020-12-06 23:09:20 +01:00
Benjamin Eberlei
21d2c88013 [GH-7486] Bugfix: failing the command when clearing empty cache is wrong semantics. (#8376) 2020-12-06 22:00:00 +01:00
Vašek Henzl
e7d33eb1a9 Infer datetime_immutable DBAL type for \DateTimeImmutable instance parameters (#8328)
The support for passing \DateTimeImmutable instance as a query parameter has
been added to ORM in #1333 (the year 2015), a long time before immutable date
types (datetime_immutable etc) were introduced to DBAL in doctrine/dbal#2450
(2017).

Back then, it made sense to treat \DateTimeImmutable (or any
\DateTimeInterface) in the same way as \DateTime and infer parameter type as
datetime. However, when immutable date types were later added to DBAL, it
wasn't reflected anyhow in type inference in ORM and \DateTimeImmmutable
instances are still inferred as datetime DBAL type.

This PR fixes this IMO incorrect behaviour of
ParameterTypeInferer::inferType(): for a \DateTimeImmmutable parameter, it now
returns datetime_immutable DBAL type; for \DateTime or any other types
implementing \DateTimeInterface, it returns datetime DBAL type as it did
before.

This behaviour is in line with DateTimeImmutableType handling only
\DateTimeImmutable and DateTimeType handling any \DateTimeInterface.

Why? In most cases, it doesn't matter and datetime works for \DateTimeImmutable
parameters just fine. But it does matter if using custom implementation of
datetime_immutable type like UTCDateTimeImmutableType from
simpod/doctrine-utcdatetime. Then the broken type inference is revealed.

This is partially related to #6443, however, this PR isn't about custom DBAL
types but about correct type inference for build-in types.
2020-12-05 23:36:33 +01:00
Michel Hunziker
cab7a4558d Fix invalid psalm annotation (#8374) 2020-12-05 14:47:49 +01:00
Benjamin Eberlei
242cf1a33d Fix ambiguous case where an entity is also a Traversable (#8371)
* Fix ambiguous case where an entity is also a Traversable

* Address phpcs violations.

* Address phpcs violations.

* Address phpcs violations.

Co-authored-by: Laurent VOULLEMIER <laurent.voullemier@gmail.com>
2020-12-04 20:53:07 +01:00
Grégoire Paris
da225a0db8 Drop step that switches the release branch (#8372)
ORM is a repository where we use the stable branch as the default
branch, that step is not appropriate here.
2020-12-04 20:46:09 +01:00
Benjamin Eberlei
3ef5a30102 [GH-8366] Catch additional Persistence MappingException (#8370) 2020-12-04 20:16:50 +01:00
Grégoire Paris
418587bc25 Merge remote-tracking branch 'origin/2.7' into 2.8.x 2020-12-03 20:18:13 +01:00
Grégoire Paris
01187c9260 Remove trailing whitespaces (#8360)
Stylistically, it's not great to have them, but more importantly, the
latest symfony/yaml version has issues with trailing whitespaces.
2020-12-03 09:52:14 +01:00
Stéphane
35cf4810c1 Add docs to export-ignore 2020-11-27 18:50:57 +01:00
Benjamin Eberlei
404edd418b [GH-8229] Prevent Illegal Inheritance Override (#8348)
* [GH-8229] Prevent AttributeOverride on fields from entities, only allowed for MappedSuperclass

* [GH-8229] Prevent AssociationOverride on fields from entities, only allowed for MappedSuperclass

* Revert "Fix SQL alias generation regression for simple inheritance (#8329)"

This reverts commit f4ebded63c.

* [GH-8229] Finalize checks for illegal attribute/assocation overrides.

* [GH-8229] Revert ccae8f7176 PR #8234

* [GH-8229] Update documentation to clarify only mapped superclass or trait works with overrides

* [GH-8229] Fix style violations introduced by revert

* [GH-8229] Fix style violations introduced by revert

* [GH-8229] Temporarily disable the exception until 2.8.

* Make phpcs happy
2020-11-25 23:04:56 +01:00
Claudio Zizza
011d3c21eb Update functionality of code examples (#8336) 2020-11-24 22:39:42 +01:00
Benjamin Eberlei
3d46e07887 PHP8 Support (#8303)
* Update doctrine/dbal to 2.12 for PHP 8 support.

* Change Query\Parser::match to Query\Parser::matchToken including DQL functions.

* Fix phpunit constraint to 9.4, adjust @group usage to workaround PHPUnit bug.

* Fix PHPUnit API related changes.

* Add PHP 8 support for EntityGenerator namespace detection.

* Use new assertEqualsWithDetla for QueryDqlFunctionTest with date comparisons

* Replace ReflectionParameter::getClass usage with non-deprecated ::getType instead.

* Revert "Change Query\Parser::match to Query\Parser::matchToken including DQL functions."

This reverts commit 279070491d50deaa4d41e17b28bb5a68f5a22796.

* More matchToken => match reverts

* Housekeeping: phpcs

* Housekeeping: phpcs

* Housekeeping: phpcs

* Housekeeping: phpcs

* Add PHP 8 testrunner, update composer.json and small fix in OrmFunctionalTestCase for new PHPUnit behvaior

* Update doctrine/coding-standard to 8.x

* Update rule names for doctrine/coding-standard v8.0

* Update to Psalm 4.

* Not failOnWarning anymore.

* Fix phpcs

* fix phpcs

* remove 7.2 for now until we can support in DBAL.

* Relax doctrine/dbal requirement and add 7.2 CI support again.
2020-11-15 13:24:31 +01:00
Roma
b1ac293a50 Add missing backtick in rst markup (#8335) 2020-11-10 20:37:36 +01:00
Romain Grégoire
f4ebded63c Fix SQL alias generation regression for simple inheritance (#8329)
This fixes a regression from 099c5b42e1.
Without the fix, "where part" in SQL is generated with incorrect aliases.
See https://github.com/doctrine/orm/issues/8229#issuecomment-722942180.
2020-11-10 10:53:01 +01:00
Benjamin Eberlei
51bc596502 Update to Psalm 4. (#8332) 2020-11-08 10:38:21 +01:00
Grégoire Paris
95f1b48422 Merge remote-tracking branch 'origin/2.7' into 2.8.x 2020-11-07 20:19:45 +01:00
Grégoire Paris
385b5a2f80 Phpunit 8 (#8330)
* Revert to whitelist

coverage requires PHPunit 9, and we don't have that yet.

* Upgrade to PHPUnit 8

This unlocks PCOV usage for coverage

* Upload coverage files to Codecov
2020-11-07 19:41:15 +01:00
Benjamin Eberlei
f7d8b155db Merge branch '2.7' into 2.8.x 2020-11-07 18:37:53 +01:00
Benjamin Eberlei
fa6fe09647 Ignore composer.lock 2020-11-07 18:37:46 +01:00
Benjamin Eberlei
539ffea390 Merge 2.7 into 2.8.x 2020-11-07 18:30:32 +01:00
Benjamin Eberlei
c270eba678 Start moving travis phpunit runs to Github actions. (#8317)
* Move PHPUnit runs from Travis to Github Actions

This removes all artifacts used for TravisCI testing and replaces them
with the existing infrastructure for Github Actions from DBAL component.

In addition some test changes were needed and triggered larger Coding
Style cleanups in 3 test files.

* Remove composer.lock and improve naming in CI workflow.
2020-11-07 18:11:42 +01:00
Michael Käfer
2f0eb95c90 Patch 1 (#8325)
* Update outdated doc parts

- The cache implementation moved from `Common` to `doctrine/cache`
- APCu is mor appropiate nowadays I guess
- AbstractQuery::useResultCache() is deprecated since 2.7

* Fix wrong argument

* Fix wrong arguments and remove useless line
2020-10-31 12:13:48 +01:00
Grégoire Paris
b13b2e8bab Upgrade doctrine/coding-standard (#8321)
* Use a classname that exists

Doctrine\ORM\Mapping\TableGenerator does not exist, only
Doctrine\ORM\Id\TableGenerator does.

* Upgrade doctrine/coding-standard

That library has a dependency on another library that requires composer
plugin API v1. Updating both libs allow to use Composer v2.

* Account for doctrine/reflection deprecation
2020-10-28 11:14:10 +01:00
Simon Podlipsky
4bfc84f035 Rename getIterable() to toIterable() (part 2) (#8293) 2020-10-17 23:55:39 +02:00
Michael Voříšek
ca27cc3f72 Fix EOL of text files (#8310) 2020-10-17 19:04:42 +02:00
Mateusz Sip
53dc5b2ac3 Detect associations inside embeddables (#8291) 2020-10-17 18:49:16 +02:00
orklah
f1219f1418 Add psalm template support to several types (#8289) 2020-10-17 12:01:52 +02:00
Grégoire Paris
072066f746 Merge remote-tracking branch 'origin/2.7' into 2.8.x 2020-10-17 11:07:05 +02:00
Laurent VOULLEMIER
5fde5801c1 Fix many typos (#8299)
- Some uppercase letters were used in the middle of sentence
- Some dots were missing
- There was two sentences with wrong or missing words
2020-10-13 21:52:04 +02:00
Thomas Landauer
18d96fcc02 Update working-with-indexed-associations.rst (#8298)
* Update working-with-indexed-associations.rst

Fixing broken link

* Update docs/en/tutorials/working-with-indexed-associations.rst

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>
2020-10-12 21:27:18 +02:00
Benjamin Eberlei
4d2908a065 Change <phpunit verbose="true" /> to false for better readability of test output. 2020-10-11 19:14:47 +02:00
Benjamin Eberlei
8d250f5921 Use SHELL_VERBOSITY=3 instead of LOG_LEVEL=DEBUG 2020-10-11 12:03:57 +02:00
Benjamin Eberlei
59fd9b5ea7 Change LOG_LEVEL to debug should expose more info from laminas/automatic-releases. 2020-10-11 00:17:52 +02:00
Benjamin Eberlei
8fcc70cfbe Change LOG_LEVEL to debug should expose more info from laminas/automatic-releases. 2020-10-11 00:14:35 +02:00
Grégoire Paris
7d84a49980 Setup automated release workflow (#8301) 2020-10-10 19:11:26 +02:00
Claudio Zizza
bb64fc953d Move website config to default branch (#8287)
Adds the website config to be compatible with the doctrine/doctrine-website#356 changes
2020-10-02 20:31:00 +02:00
orklah
e0eb82a3b1 psalm fixes (#8286) 2020-09-30 22:00:38 +02:00
orklah
79cdcde9ec rename parameters to match parents (#8284) 2020-09-26 20:24:11 +02:00
orklah
f4524a8bb0 Fix psalm errors and upgrade strictness (#8209)
* Fixes and improvements

* fix param type
2020-09-25 20:44:07 +02:00
Simon Podlipsky
f1365b78d5 Rename getIterable to toIterable (#8268) 2020-09-25 20:42:09 +02:00
Grégoire Paris
d810ea4111 Use inline literals over escaping (#8279)
Escaping underscores does not work as expected.
See https://www.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/dql-custom-walkers.html#modify-the-output-walker-to-generate-vendor-specific-sql
2020-09-22 20:10:05 +02:00
Michael Voříšek
107ba93d79 Convert CRLF to LF in test file (#8276)
* Convert CRLF to LF in test file
* fix cs
2020-09-21 22:51:49 +02:00
Guillaume Simon
706670215d Fix OrderByItem parser to proceed with SimpleArithmetic expression before function (#8277)
There is parser bug for OrderByItem(), where a function is detected
before a SimpleArithmeticExpression while it should be the reverse:
simple arithmetic expressions can start with a function too, and thus
they should be matched first if present.

This fix enables the use of expressions in sorting and with window
functions.
2020-09-20 18:56:57 +02:00
Yohann Durand
ab2b4987b3 Improve formatting (#8028) 2020-09-08 20:56:51 +02:00
Thomas Landauer
717ef9106c Update events.rst (#8257)
* Update events.rst

Improved code formatting

* Update docs/en/reference/events.rst

I was wondering myself what the `#` was about ;-)

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>

* Update events.rst

See https://github.com/doctrine/orm/pull/8257#discussion_r482305774

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>
2020-09-03 22:44:28 +02:00
Christoph Ziegenberg
ccae8f7176 Fix for bug #8229 (id column from parent class renamed in child class) (#8234)
This fixes problems with id columns defined in the parent class but renamed in the child class using an attribute override. Before this change always the child column name was used (which was not present in the parent class), now the correct column names are used for the parent table when creating inserts, joins and deletions for it.

Co-authored-by: Crossjoin <crossjoin@users.noreply.github.com>
2020-08-29 13:25:18 +02:00
Grégoire Paris
da18985aca Stop using the DBAL extension of PHPBench (#8252)
It has been removed, and the default XML storage driver is supposed to
be fine for our purposes.
2020-08-29 12:28:40 +02:00
Simon Podlipsky
60cd524443 Introduce getIterable() on AbstractQuery (#7885) 2020-08-14 11:12:40 +02:00
Simon Podlipsky
045d1f3bf2 Bump Doctrine CS to v6 (#8241) 2020-08-13 09:10:43 +02:00
Grégoire Paris
1ae6f18fe9 Merge remote-tracking branch 'origin/2.7' into 2.8.x 2020-08-12 22:26:19 +02:00
Simon Podlipsky
1e2ed07731 Use consistent formatting in command line (#8238) 2020-08-12 08:38:00 +02:00
Grégoire Paris
424241f29c Use more accurate terminology (#8236)
I think this was a mistake when writing this documentation, and that the
original author meant to use attribute here, columns do not have
columns, they have attributes.
2020-08-09 22:48:52 +02:00
Grégoire Paris
8230afcde9 Fetch deeper
This is needed to preserve parent information and be able to find the
merge base with the head branch. The assumption here is that the common
ancestor can be found among the 10 parent commits.
2020-08-07 22:11:21 +02:00
Kirill Matasov
7cffba8743 Fix annotation in Expr 2020-08-07 22:11:21 +02:00
Zacharias Luiten
91b9dd90f4 Add DQL support for ORDER BY CASE (#8188) 2020-08-05 22:49:51 +02:00
Benjamin Cremer
7e5fe79349 Change preferred cache driver for metadata and query caches (#8223)
See: https://twitter.com/lcobucci/status/1289087725694484481
2020-08-03 21:40:52 +02:00
njutn95
efd25484f4 Update aggregate-fields.rst (#8215)
Minor typo fix
2020-07-20 21:19:16 +02:00
Andreas Möller
271f3480c8 Fix: Typo (#8213) 2020-07-15 22:46:25 +02:00
orklah
aab589b596 add/fix more types (checked by psalm) (#8199)
* add/fix more psalm types

* remove inexistant SimpleEntityExpression

* Declare template implements for TreeWalkerChainIterator
2020-07-10 22:08:13 +02:00
orklah
190218b267 Change list() syntax to array destructuring (short list syntax) (#8204) 2020-07-07 22:02:34 +02:00
Benjamin Eberlei
181114f2c7 [GH-8106] Move test into existing QueryTest testcase to reduce surface. 2020-07-05 21:51:35 +02:00
tom93
3689b76a86 Fix QueryBuilder::getParameter() on parameter names with colons (#8107)
* Fix type errors

(partially cherry picked from commit 17e7c2a42e)

* Fix QueryBuilder::getParameter() on parameter names with colons

Fixes #8106.

Co-authored-by: Michael Moravec <mail@majkl578.cz>
2020-07-05 21:46:48 +02:00
Igor Pellegrini
75fe18ea5f Add alert to "avoid persisting detached entities" (#8109)
The alert is hidden into the code of ``EntityManager``,
while it's useful to be mentioned in the documentation.
2020-07-05 20:24:08 +02:00
Grégoire Paris
6c73a6b720 Infer return type information with Psalter (#8150)
These changes are a subset of changes done with vendor/bin/psalm --alter
--issues=LessSpecificReturnType
--allow-backwards-incompatible-changes=false
2020-07-05 20:15:39 +02:00
Benjamin Eberlei
775d91c2a3 [GH-8122] Move test from AbstractMappingDriverTest to ClassMetadataFactoryTest case 2020-07-05 20:11:01 +02:00
Gildas Quéméner
64c3f68734 Prohibits class typo in the discriminator map (#8122)
* Prevents incorrect table aliases to be generated

When a defined subclass has a case typo, the query builder will be lost
and will generate exotic table alias. This commit fixes the issue at the
root by prohibiting case typo in discriminator map.

See https://github.com/doctrine/orm/pull/8112 for the consequence of
such typo.

* Controls growing rate of the abstract test class

* Fixes incorrect test case

The Cube class must be autoloaded with the correct case, otherwise
composer autoloader will complain.

* Removes non architecture compliant code

See https://github.com/doctrine/orm/pull/8122/files#r423952247

* Ensures discriminator map is case sensitive
2020-07-05 19:48:38 +02:00
Mohamed Ettaki Talbi
2a2a0b2980 Remove unwanted period (#8198) 2020-07-02 08:36:18 +02:00
Grégoire Paris
505d658e3d Merge remote-tracking branch 'origin/2.7' into 2.8.x 2020-06-21 13:50:48 +02:00
vladyslavstartsev
a438e90046 add dev files to .gitattribute (#8190)
those files probably are not used by end user of the lib
2020-06-19 13:48:45 +02:00
Nicolas Grekas
6a670d7d6d Allow using on PHP 7.1 with Composer 2 (#8184) 2020-06-18 23:05:13 +02:00
Grégoire Paris
765521d257 Use CodeCov instead of Scrutinizer (#8187)
* Document current branch status in the README

* Use CodeCov instead of Scrutinizer
2020-06-17 22:47:25 +02:00
Grégoire Paris
5ced62bf83 Run benchmark on PHP 7.4 (#8186)
phpbench recently dropped compatibilty with PHP 7.1
When this job was introduced, 7.1 was the latest version of PHP we
supported, so it makes sense to bump to 7.4 now.
See https://github.com/phpbench/phpbench/releases/tag/0.17.0
See e07c90df44
2020-06-17 22:06:42 +02:00
Grégoire Paris
bee8decd18 Require persistence 2 and common 3 (#8166)
This allows us to drop the autoload-calls-based BC layer.
2020-06-17 14:56:17 +02:00
Alexander Berl
93867f8d77 TASK: Replace "Blacklist" example with "Banlist" (#8174) 2020-06-08 23:06:53 +02:00
Laurent VOULLEMIER
6bce7e9cab Add iterable support for IN criterias (#8162) 2020-06-03 18:40:53 +02:00
Grégoire Paris
4d8418fe6f Merge remote-tracking branch 'origin/2.7' into drop-persistence-bc-layer 2020-06-02 18:40:48 +02:00
Grégoire Paris
d95e03ba66 Allow doctrine/common 3 and doctrine/persistence 2 (#8158) 2020-05-26 18:03:49 +02:00
Robert Basic
825ceb6b7a Fix inline code example (#8153)
* Fix inline code example

* Remove extra backslash
2020-05-22 22:45:24 +02:00
orklah
de2e2a1d74 Add psalm types (#7989) 2020-05-18 21:48:28 +02:00
Benjamin Eberlei
850d57e791 [GH-8137] Update doctrine/inflector dependency to 1.4|2.0 (#8147)
* [GH-8137] Update doctrine/inflector dependency to 1.4|2.0 and resolve deprecations.

* [GH-8137] Address review comments

* Address phpcs issues.

* More CS

* Codingstyle
2020-05-17 19:58:02 +02:00
Grégoire Paris
c3dd71704b Merge remote-tracking branch 'origin/2.7' into 2.8.x 2020-05-16 15:14:51 +02:00
Grégoire Paris
6780a963f7 Migrate git-phpcs to Github actions (#8146) 2020-05-16 14:01:10 +02:00
Philippe Le Van (@plv)
0b305e5bd3 Add possibility to use sql comments in the DQL syntax (#8140) 2020-05-15 08:04:58 +02:00
Benjamin Eberlei
4d172e2591 Revert changes to embeddable mapping in 2.7 (#8138)
* Revert "Fix inherited embeddables and nesting after AnnotationDriver change #8006 (#8036)"

This reverts commit a9b6b72017.

* Revert "Make Embeddable not transient"

This reverts commit 58677c29b4.

* Housekeeping: CS fixes
2020-05-12 20:10:26 +02:00
Grégoire Paris
21a98234d0 Static analysis with Psalm (#8116)
* Remove useless ternaries

If these expressions are truish inside the condition, they will still be
truish inside the if.

* Describe properties more accurately

These are not objects, they are strings holding class names for classes
that implement TreeWalker.

* Remove duplicate key

Comparison::IS and Comparison::EQ are the same. I chose to remove IS
because it does not seem to exist anymore on master

* Remove unwanted . before = operator

This worked, but makes no sense.

* Setup static analysis with Psalm

* Move PHPStan to Github actions
2020-05-11 23:06:46 +02:00
Gabriel Birke
061207861b Improve CLI config documentation (#8130)
Change code examples for `cli-config.php` to use
`ConsoleRunner::createHelperSet` instead of constructing the helper set
array yourself.
Remove DBAL-specific documentation

Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>
2020-05-11 21:43:26 +02:00
Grégoire Paris
8a9954e46c Address deprecations from persistence (#7953)
A backwards-compatibility layer has been added to persistence to help
consumers move to the new namespacing. It is based on class aliases,
which means the type declaration changes should not be a BC-break: types
are the same.
See https://github.com/doctrine/persistence/pull/71

This means:
- using the new namespaces
- adding autoload calls for new types to types that may be extended and
use persistence types in type declarations of non-constructor methods,
so that signature compatibility is recognized by old versions of php.
More details on this at
https://dev.to/greg0ire/how-to-deprecate-a-type-in-php-48cf
2020-05-07 08:35:39 +02:00
Grzesiek
527fff53cc removed repository class from metadata (#8125)
The annotation is required only in the next chapter of the tutorial, specifically the "Entity Repositories"
2020-05-03 21:58:20 +02:00
Maks Rafalko
70fb1ecd78 Warn users about performance issues with DateTime objects in setParameter() (#8114) 2020-04-25 22:16:17 +02:00
Jeroen van den Heuvel
73ec483e9d Convert PHP to SQL for new object expression (#8062) 2020-04-16 23:01:43 +02:00
Mathieu
8d67eec812 Fix JoinColumn documentation (#7966) 2020-03-30 21:33:13 +02:00
Vincent Langlet
a418cf6418 Remove TODO (#8078) 2020-03-30 20:06:04 +02:00
Arne
6138afdca9 [Docs] Make clear that calling remove() detaches the object (#8081)
I changed a relationship from eager to lazy loading which broker the behaviour of my application in regards to object removal. It was not clear for me that removing an object detaches it and subsequent calls like contains() in a OneToMany relationship with the object scheduled for removal will return false afterwards.
2020-03-27 19:42:39 +01:00
Vincent Langlet
dafe298ce5 Fix phpdoc (#8074) 2020-03-19 07:41:02 +01:00
Matthias Pigulla
58b8130ea1 Fix regression in 2.7.1 when mysqli is used with discriminator column that is not a string (#8055)
* Add a test case showing the regression

* Cast the discriminator value to string

* Fix CS
2020-03-16 11:19:12 +01:00
Grégoire Paris
3c91792dd8 Address deprecation about PHPUnit annotations (#8070)
These changes have been done using Rector, this might not result in the
best placement for method calls, but it is not worse than the current
situation.

I used the configuration documented at
b398e8740c/docs/HowItWorks.md (221-order-of-rectors)

Fixes #8069
2020-03-16 08:56:59 +01:00
Benjamin Eberlei
a705f526fb [GH-7633] disallow cache partial objects (#8050)
* [GH-7633] Bugfix: Partial queries were stored in 2LC.

There was a check in DefaultQueryCache that prevented partial queries,
because they are not supported. However the checked hint
Query::HINT_FORCE_PARTIAL_LOAD is optional, so cant be used to prevent
caching partial DQL queries.

Introduce a new hint that the SqlWalker sets on detecing a PARTIAL
query and throw an exception in the DefaultQueryCache if thats found.

* Housekeeping: CS

* [GH-7633] HINT_FORCE_PARTIAL_LOAD still needs to be checked.

* Housekeeping: Fix CS
2020-03-15 01:11:34 +01:00
Maciej Malarz
a9b6b72017 Fix inherited embeddables and nesting after AnnotationDriver change #8006 (#8036)
* Add test case

* Treat parent embeddables as mapped superclasses

* [GH-8031] Bugfix: Get working again on nested embeddables in inherited embeddables.

* Housekeeping: CS

* Update note on limitations

* [GH-8031] Verify assocations still do not work with Embeddables.

* Housekeeping: CS

Co-authored-by: Benjamin Eberlei <kontakt@beberlei.de>
2020-03-15 01:00:58 +01:00
Jorrit Schippers
cd905fff77 Fix documentation of default generated value behavior (#8068) 2020-03-13 20:40:31 +01:00
Claudio Zizza
431d0a3c5e Remove ORM 2.0 version constraints from docs (#8002) 2020-03-06 21:47:40 +01:00
Andreas Möller
eb700405be Fix: Use neutral pronouns (#8059) 2020-03-06 16:08:53 +01:00
Rosemary Orchard
9273057649 Annotations override naming strategy (#8041)
Add a note/warning that annotations override the naming strategy.
2020-03-01 14:01:26 +01:00
Soliman
1da002ca2f Throw OptimisticLockException when connection::commit() returns… (#7946)
* Throw OptimisticLockException when connection::commit() returns false

* Update unit tests

* Fix doctrine persistence version to avoid deprecations changes

* Apply changes from 2.8.x

* Update from 2.8.x
2020-02-29 23:06:47 +01:00
Grégoire Paris
e04a79526e Merge pull request #7230 from holtkamp/patch-2
Mention that lifecycle callbacks do not support Embeddables
2020-02-17 23:00:44 +01:00
Menno Holtkamp
d157a6cbeb Mention that lifecycle callbacks do not support Embeddables
As discussed in https://github.com/doctrine/doctrine2/issues/6855
2020-02-17 22:25:00 +01:00
Benjamin Eberlei
ca57222010 Merge pull request #8023 from peterkeatingie/query-cache-fix
Put into cache using root entity name
2020-02-16 10:50:24 +01:00
Peter Keating
9bb2bf0cce Put into cache using root entity name 2020-02-15 15:53:47 +00:00
Benjamin Eberlei
445796af0e Travis: Use 7.4 instead of 7.4snapshot 2020-02-15 15:35:56 +01:00
Benjamin Eberlei
ab93285284 Remove nightly builds from .travis.yml 2020-02-15 15:34:36 +01:00
Benjamin Eberlei
ef639d4de6 Remove nightly builds from .travis.yml 2020-02-15 15:34:05 +01:00
Benjamin Eberlei
31f4dd671a Merge remote-tracking branch 'origin/2.7' into 2.8.x 2020-02-13 21:31:29 +01:00
Benjamin Eberlei
a692670469 Merge pull request #8006 from doctrine/malarzm-patch-1
Make Embeddable not transient
2020-02-13 21:31:02 +01:00
Maciej Malarz
58677c29b4 Make Embeddable not transient 2020-02-13 21:05:52 +01:00
Benjamin Eberlei
60c4867ed3 Merge branch 2.7 into 2.8.x 2020-02-12 23:42:36 +01:00
Benjamin Eberlei
9a0fcb5a86 Merge pull request #7940 from doctrine/GH-7864-ExtraLazyRemoveElement
[GH-7864] Bugfix in PersistentCollection::removeElement for EXTRA_LAZY.
2020-02-12 23:42:06 +01:00
Benjamin Eberlei
0ee1716b26 Merge branch 2.7 into 2.8.x 2020-02-12 23:38:27 +01:00
Benjamin Eberlei
8104c65d6c Merge pull request #7987 from beberlei/GH-7982-NoSqlExecutor
[GH-7982] no sql executor leads to parse error
2020-02-12 23:37:39 +01:00
Benjamin Eberlei
a64d254d07 [GH-7982] Bugfix: Passing string|null DQL to Lexer(string $input) leads to downstream notice. 2020-02-12 23:23:12 +01:00
Claudio Zizza
a236a83fa8 Merge pull request #7993 from SenseException/readme2-8
Update version and links in readme
2020-01-20 11:14:33 +01:00
Claudio Zizza
37f1bd7606 Update version and links in readme 2020-01-17 21:42:59 +01:00
Grégoire Paris
af4cb282ba Merge pull request #7978 from alexeyshockov/patch-2
Stable PHP 7.4 in Travis
2020-01-17 07:49:48 +01:00
Benjamin Eberlei
ce4914ba0e Merge 2.7 to 2.8.x 2020-01-17 00:08:23 +01:00
Benjamin Eberlei
fdad48278b Merge pull request #7991 from greg0ire/7.4-sa
Try running phpstan on php 7.4
2020-01-17 00:06:40 +01:00
Benjamin Eberlei
fc94127d7f Make ocramius/package-versions 1.2 the lowest version for phpstan 2020-01-16 23:51:17 +01:00
Grégoire Paris
dea3e5df44 Try running phpstan on php 7.4
It might be easier to find packages compatible with both our locked deps
and phpstan with that version of php.
2020-01-16 23:49:15 +01:00
Alexey Shokov
bdfd6c1677 Stable PHP 7.4 in Travis 2020-01-16 23:27:20 +01:00
Benjamin Eberlei
5d7d3e99a0 Downgrade ocramius/package-versions to lowest in composer.lock to support all PHP versions. 2020-01-16 23:18:00 +01:00
Benjamin Eberlei
3bc1096fd0 [GH-7982] Default Query state to dirty to fix execution of empty query. 2020-01-15 23:30:59 +01:00
Benjamin Eberlei
8e0157d97d Merge branch '2.7' into 2.8.x 2020-01-15 22:57:06 +01:00
Benjamin Eberlei
a2f01f7ccc Allow everything from ocramius/package-versions ^1.0. 2020-01-15 22:56:08 +01:00
Benjamin Eberlei
1767f4b8e7 Merge branch '2.7' into 2.8.x 2020-01-15 22:02:55 +01:00
Benjamin Eberlei
401db453a2 Merge pull request #7974 from beberlei/gh-7505
[GH-7505] Bug in SimpleObjectHydrator when using inheritance with same field
2020-01-15 22:02:25 +01:00
Benjamin Eberlei
6e59ec8f16 [GH-7505] Fix cs 2020-01-15 21:52:11 +01:00
Benjamin Eberlei
87e491465a Add @group 2020-01-15 21:13:25 +01:00
Luís Cobucci
8b588eceb2 Merge pull request #7973 from DocFX/patch-1
Just a micro grammar update.
2020-01-14 11:26:21 +01:00
Benjamin Eberlei
edce36598f Adjust tests back for 2.x. 2020-01-09 00:41:47 +01:00
Benjamin Eberlei
ca95b0ee13 Merge branch '2.7' into 2.8.x 2020-01-08 19:39:17 +01:00
Woody Gilk
20c46035d1 [Docs] Prefer PhpFileCache for caching and remove APC/XCache. 2020-01-08 19:36:08 +01:00
William Pinaud
324aacfb54 Just a micro grammar update. 2020-01-08 18:52:11 +01:00
Benjamin Eberlei
1edfcabead Merge pull request #7894 from TomckySan/convert-default-value-to-boolean
Fix boolean properties default value when generating entities.
2020-01-05 16:11:33 +01:00
Luís Cobucci
2785cde792 Merge pull request #7957 from lcobucci/fix-version-information
Fix version information
2019-12-17 19:19:05 +01:00
Luís Cobucci
d67e3e8b1b Rely on ocramius/package-versions to render the version
Since `Doctrine\ORM\Version` is now deprecated it shall not be updated
on future releases.

This ensures that our CLI tool will present the correct version number.
2019-12-17 15:47:55 +01:00
Luís Cobucci
d629c4e487 Remove build.xml and related files
We aren't using ant/phing to handle the releases any more.
2019-12-17 01:03:34 +01:00
Luís Cobucci
4a4226213f Merge pull request #7875 from nicolas-grekas/schema-tool
Whilelist existing assets we know about from metadata in SchemaTool::getUpdateSchemaSql()
2019-12-16 23:59:31 +01:00
Andreas Braun
0ce1440884 Add upgrade note about schema_filter change 2019-12-16 23:45:49 +01:00
Laurent VOULLEMIER
9aa28b4e33 Test asset whitelisting on SchemaTool#getUpdateSchemasSql() 2019-12-16 23:45:49 +01:00
Nicolas Grekas
5c2b6870bf Whitelist existing assets we know about from metadata in SchemaTool::getUpdateSchemaSql() 2019-12-16 23:22:50 +01:00
Luís Cobucci
4389b2c188 Merge pull request #7956 from lcobucci/fix-test-suite
Ignore Doctrine\Common\Persistence\ObjectManagerDecorator deprecation
2019-12-16 21:49:25 +01:00
Luís Cobucci
e481d9880b Ignore Doctrine\Common\Persistence\ObjectManagerDecorator deprecation
Since applying the fixes requires bumping up the dependency, which isn't
done in a patch release.

This should be removed in v2.8.0.
2019-12-16 21:22:28 +01:00
Luís Cobucci
85528f28e2 Fix CS errors 2019-12-16 21:22:23 +01:00
Luís Cobucci
5873242fb5 Merge pull request #7937 from doctrine/GH-7930-SqliteForeignKeys
Revert SchemaTool change to check for foreign key support
2019-12-16 10:45:07 +01:00
Luís Cobucci
4aa09861dd Merge pull request #7941 from Grafikart/feat-typed-functions
Allow DQL functions to specify return type
2019-12-12 19:50:23 +01:00
Grafikart
24e9a7caaf Allow defining return types for DQL functions 2019-12-12 14:19:09 +01:00
Luís Cobucci
d90df59118 Merge pull request #7948 from beberlei/TravisSmokeTesting
Add stage that runs before Test to allow fast failures on Sqlite/phpcs
2019-12-12 11:54:41 +01:00
Benjamin Eberlei
f9103a7b41 Add another stage that runs before Test to allow fast failures on Sqlite, Quality + PHPCS-differ 2019-12-12 11:43:24 +01:00
Luís Cobucci
9891477094 Merge pull request #7928 from kokspflanze/2.7-patch-deprecated
Deprecate EntityRepository#clear()
2019-12-09 21:56:41 +01:00
kokspflanze
59e3a55110 Deprecate EntityRepository#clear() 2019-12-09 21:42:11 +01:00
Luís Cobucci
c9e41d0aa7 Merge pull request #7934 from BenMorel/php74
Fix Trying to access array offset on value of type null
2019-12-09 21:32:58 +01:00
Benjamin Morel
f37c12834d Fix Trying to access array offset on value of type null 2019-12-09 21:24:29 +01:00
Benjamin Eberlei
041404e8b3 [GH-7864] Revert removeElement EXTRA_LAZY support. 2019-12-07 00:03:09 +01:00
Benjamin Eberlei
bfc68b3aba Add warning about removeElement on extra lazy 2019-12-03 20:34:44 +01:00
Benjamin Eberlei
1e628370c4 [GH-7864] Address review comments. 2019-12-03 19:35:49 +01:00
Benjamin Eberlei
ae2b9b1921 Housekeeping: phpcbf to fix issues. 2019-12-01 21:11:09 +01:00
Benjamin Eberlei
419df77a09 [GH-7864] ExtraLazyCollectionTest is not cacahble and should not fail SLC suite. 2019-12-01 20:28:30 +01:00
Benjamin Eberlei
d6f6b2e97c [GH-7864] Remove tests that checked invalid behavior. 2019-12-01 19:47:58 +01:00
Benjamin Eberlei
75d5adf599 [GH-7864] Bugfix in PersistentCollection::removeElement for EXTRA_LAZY. 2019-12-01 19:27:45 +01:00
Benjamin Eberlei
cfd6fadf9c Revert "#7841 SchemaTool generates extra diff for platforms without FK support"
This reverts commit 3707c39124.
2019-12-01 11:23:45 +01:00
Tomoka Baba
2bf7916c52 Fix to pass code quality check. 2019-11-20 17:03:34 +09:00
Tomoka Baba
253fd10cc0 Modified test to use assertTrue. 2019-11-20 17:02:25 +09:00
Tomoka Baba
2c956d55f2 Fix to pass code quality check. 2019-11-20 17:02:25 +09:00
Tomoka Baba
3db992e953 Add test code. 2019-11-20 17:01:52 +09:00
Tomoka Baba
6fc9b3ab16 Fix to pass code quality check. 2019-11-20 17:01:52 +09:00
Tomoka Baba
2d833a5e86 Fix boolean properties default value when generating entities. 2019-11-20 17:01:19 +09:00
Luís Cobucci
a416a9a8b2 Bump up version 2019-11-19 09:43:57 +01:00
Luís Cobucci
4d763ca4c9 Bump up version 2019-11-19 09:38:05 +01:00
Luís Cobucci
398d74deaa Merge pull request #7911 from lcobucci/be-more-explicit-on-deprecation-messages
Be explicit about which Doctrine package in message
2019-11-19 09:36:14 +01:00
Luís Cobucci
3314322929 Be explicit about which Doctrine package in message
Avoiding possible confusion while reading the deprecation messages.
2019-11-19 09:03:36 +01:00
Luís Cobucci
ce93817bf7 Merge pull request #7909 from lcobucci/add-deprecation-messages
Add deprecation messages
2019-11-19 08:21:44 +01:00
Luís Cobucci
50992eafa2 Deprecated the usage of number unaware underscore naming strategy 2019-11-19 02:15:11 +01:00
Luís Cobucci
9ccb8837e7 Add deprecation message for EM#clear($entityName) 2019-11-19 01:34:50 +01:00
Luís Cobucci
d959744c0a Merge pull request #7079 from mairo744/hotfix/sqlite-join-table-name
fix getJoinTableName for sqlite with schema attribute
2019-11-18 23:37:33 +01:00
mairo744
0264ba1759 Fix creation of join table names with schemas in SQLite
Join table name doesnt depending on the platform.
Table name was "schema.table" instead of "schema__table".

(cherry picked from commit 4878cd3f4ef30ffc6047c18e0f7b16aafeabc3b4)
2019-11-18 23:25:28 +01:00
Luís Cobucci
8332fa1855 Merge remote-tracking branch 'upstream/2.6' into 2.7 2019-11-18 23:06:28 +01:00
Luís Cobucci
4fae126459 Bump up version 2019-11-18 23:05:16 +01:00
Luís Cobucci
2d9b935183 Bump up version 2019-11-18 23:01:21 +01:00
Luís Cobucci
4804f602f8 Merge pull request #7908 from lcobucci/fix-bc-break-on-naming-strategy
Fix BC-break on underscore naming strategy
2019-11-18 22:57:27 +01:00
Luís Cobucci
3d17290eb5 Fix BC-break on underscore naming strategy
We broke our BC promises on the last patch release by changing how the
underscore naming strategy parses values with numbers.

This commit makes it possible to configure whether or not to make the
underscore naming strategy aware of numbers, keeping the old
configuration as default value.
2019-11-18 22:38:14 +01:00
Luís Cobucci
8420d24f90 Merge remote-tracking branch 'upstream/2.6' into 2.7 2019-11-18 19:59:58 +01:00
Luís Cobucci
52f2b37921 Bump up version 2019-11-18 12:17:41 +01:00
Luís Cobucci
16751d210f Bump up version 2019-11-18 12:06:51 +01:00
Luís Cobucci
686f508576 Merge pull request #7905 from lcobucci/7890-paginator-objecti
[Paginator] Fix type conversion during hydration of pagination limit subquery
2019-11-18 10:50:54 +01:00
Luís Cobucci
00ef1eba90 Add paginator query hint to force type conversion
We're keeping a BC layer in the hydrator, which prevents type conversion
in scalar results.

This makes bypasses such layer in order to always convert the identifier
types when limiting the result set during a pagination.

The main goal here is to keep the conversion DB->PHP inside of the
hydrator components.
2019-11-18 10:27:10 +01:00
Gabriel Ostrolucký
3843eee5cb [Paginator] Add test case for regression with custom id
Co-authored-by: Alexei Korolev <alexei.korolev@gmail.com>
2019-11-18 10:27:10 +01:00
Luís Cobucci
f576e6c41f Merge pull request #7904 from greg0ire/validate-composer-json
Make sure composer files are valid
2019-11-16 11:47:02 +01:00
Grégoire Paris
c79d2e0dc2 Make sure composer files are valid
The composer.lock is put under version control and it often happens to
be out of sync with the composer.json, which could lead to
hard-to-understand issues.
Using the --strict option here because we might as well aim for a
perfectly valid composer.json
2019-11-16 10:59:39 +01:00
Grégoire Paris
33b8d020a7 Synchronize lock file and json manifest 2019-11-16 10:59:39 +01:00
Luís Cobucci
1b2daac25d Merge pull request #7710 from rtek/pretty-tool-describe
Prettified arrays in tool command orm:mapping:describe
2019-11-16 02:15:31 +01:00
Luís Cobucci
977985f756 Merge pull request #7701 from someniatko/deprecate-use-result-cache
Split and deprecate AbstractQuery#useResultCache()
2019-11-16 02:12:29 +01:00
rtek
0c36f87935 Prettify arrays in orm:mapping:describe command
This will prevent excessive column width and wrapping in the output which uses Symfony\Component\Console\Style\SymfonyStyle::table().
2019-11-16 02:03:03 +01:00
someniatko
e8f265d480 Make ResultCacheTest tests slightly more logical 2019-11-16 01:59:57 +01:00
Illia Somov
7bcbad076d Split and deprecate AbstractQuery#useResultCache() 2019-11-16 01:59:57 +01:00
Luís Cobucci
57496e32fd Add minor BC-break notes on output walkers in paginator
As explained in
https://github.com/doctrine/orm/pull/7863#issuecomment-554578313.
2019-11-16 01:48:37 +01:00
Luís Cobucci
797bfc53c4 Fix deprecation messages version 2019-11-16 01:32:15 +01:00
Luís Cobucci
8c47dcb6fc Merge pull request #7863 from Seb33300/skip-limit-subquery
Paginator: Skip limit subquery if not required
2019-11-16 01:21:43 +01:00
Sébastien ALFAIATE
6347190886 Skip limit subquery if not required 2019-11-16 01:03:22 +01:00
Luís Cobucci
9162f3519d Merge pull request #7900 from doctrine/2.6.x-merge-up-into-2.7
Merge up 2.6 to 2.7
2019-11-16 00:27:50 +01:00
Grégoire Paris
fc9314d9f5 Merge remote-tracking branch 'origin/2.7' into 7900--2.6.x-merge-up-into-2.7 2019-11-15 23:50:05 +01:00
Luís Cobucci
26806d08eb Require more updated doctrine packages 2019-11-15 23:46:22 +01:00
Luís Cobucci
6a827d5b61 Merge pull request #7861 from ferrastas/bug_removing_collection
Delete statements will not be created using `clear`
2019-11-15 22:58:31 +01:00
Gabriel Ostrolucký
7d77984306 Restore ability to clear deferred explicit tracked collections
This was regression from #7862 which tried to respect tracking config
when clearing collections, but this logic can happen in UOW only,
PersistentCollection::clear is triggered too early to know what
is (going to be) persisted.

Fixes #7862
2019-11-15 22:49:06 +01:00
Ferran Vidal
ec93014713 Delete statements will not be created using clear. 2019-11-15 22:43:53 +01:00
Luís Cobucci
c83094bde0 Merge pull request #7684 from rharink/2.6
only replace '_id' at end of columnName
2019-11-15 16:50:16 +01:00
Robert den Harink
982d1519db only replace '_id' at end of columnName 2019-11-15 16:36:48 +01:00
Marco Pivetta
f7c04ae537 Merge pull request #7901 from lcobucci/add-deprecation-notices
Add deprecation warnings for 2.7.x
2019-11-15 16:15:31 +01:00
Michael Moravec
f9a4258ded Upgrading notes for 2.7 2019-11-15 14:43:33 +01:00
Michael Moravec
eb9f11bf96 Added deprecation warnings for 2.x 2019-11-15 14:43:15 +01:00
Luís Cobucci
2b8cb9de79 Add basic tool to verify deprecation messages 2019-11-15 14:42:48 +01:00
Luís Cobucci
570abb5bad Fix PHP warnings in test suite 2019-11-15 14:42:47 +01:00
Luís Cobucci
855244fd10 Merge pull request #7865 from Ocramius/fix/#7837-paginate-with-custom-identifier-types-even-with-cached-dql-parsing
#7837 paginate with custom identifier types even with enabled DQL query cache
2019-11-15 11:08:22 +01:00
Guilherme Blanco
c62977412c Merge pull request #7869 from BenMorel/patch-4
UnitOfWork::clear() misses $eagerLoadingEntities
2019-11-15 00:27:08 -05:00
Gabriel Ostrolucký
98e557b68e Improve assertion failure message for testWillFindSongsInPaginatorEvenWithCachedQueryParsing 2019-11-14 23:37:13 +01:00
Mickaël RAYBAUD-ROIG
3a32c00dcf Add a failing test for issue #7505 2019-11-14 23:28:42 +01:00
Gabriel Ostrolucký
1dde2c9e8e Add test case verifying eager loads are clear
Otherwise, getClassMetadata would be triggered more times
2019-11-14 22:17:06 +01:00
Marco Pivetta
adfd010a78 Merge pull request #7889 from ajgarlag/hotfix/fix-tests-with-dbal-2.10
Use quoted collation declaration when available.
2019-11-05 15:52:18 +01:00
Antonio J. García Lagar
1bc4e1f594 Use quoted collation declaration when available. 2019-11-05 14:58:24 +01:00
Marco Pivetta
21680df9bd Merge pull request #7884 from rogeriolino/patch-1
[Documentation] Advanced field value... - missing entity alias
2019-11-05 01:23:52 +01:00
Rogério Alencar Lino Filho
19aa3c125c missing entity alias 2019-10-31 18:20:58 -03:00
Marco Pivetta
e9e012a037 Merge pull request #7880 from kuraobi/update-doc-dql-qb
Update documentation to recommend DQL over QueryBuilder when possible
2019-10-29 19:04:03 +01:00
Mathieu Lemoine
d1db0655ac Update documentation to recommend DQL over QueryBuilder when possible 2019-10-29 16:26:17 +01:00
Luís Cobucci
2d643e6b7b Merge pull request #7876 from nicolas-grekas/sf5-cmd
Fix compat of commands with Symfony 5
2019-10-23 16:12:18 +02:00
Nicolas Grekas
4d6b1f3e63 Fix compat of commands with Symfony 5 2019-10-23 16:00:19 +02:00
Jonathan H. Wage
d9c30e34c4 Merge pull request #7723 from nicolas-grekas/sf5
Allow Symfony 5.0
2019-10-23 15:57:25 +02:00
Nicolas Grekas
90c1ee0bd0 Allow Symfony 5.0 2019-10-23 15:57:25 +02:00
Marco Pivetta
cfcca3a63c Merge pull request #7600 from Majkl578/travis-php7.4-2.7
[2.7] CI: Test against PHP 7.4snapshot instead of nightly (8.0)
2019-10-23 15:57:24 +02:00
Michael Moravec
af0949adab Merge pull request #7382 from Majkl578/homepage-2.7
Update homepage
2019-10-23 15:57:24 +02:00
Michael Moravec
cdb652ad87 CI: Test against PHP 7.4snapshot instead of nightly (8.0) 2019-10-23 15:57:24 +02:00
Claudio Zizza
4fb1ebfc10 Create 2.7 upgrade headline for deprecation changes 2019-10-23 15:57:24 +02:00
Michael Moravec
46c1b57560 Update homepage 2019-10-23 15:57:24 +02:00
Claudio Zizza
fdbbf7edd1 Add deprecation of EntityManagerInterface::copy() to upgrade information 2019-10-23 15:57:23 +02:00
Claudio Zizza
2fed8204c1 Set copy-method as deprecated 2019-10-23 15:57:23 +02:00
Michael Moravec
76f03b5db0 Bump version to 2.7-dev 2019-10-23 15:57:19 +02:00
Guilherme Blanco
9fef4e86e4 Merge pull request #7871 from BenMorel/2.6
AbstractQuery::getSingleScalarResult() throws exception when no result
2019-10-18 10:37:53 -04:00
Benjamin Morel
4781dc03e9 AbstractQuery::getSingleScalarResult() throws exception when no result 2019-10-16 20:41:00 +02:00
Benjamin Morel
cc5f84ac22 UnitOfWork::clear() misses $eagerLoadingEntities 2019-10-16 10:11:55 +02:00
Marco Pivetta
023e94661a #7837 force expiry of query cache when WhereInWalker is being used
In order to figure out the paginated query identifier type, we would
have to parse the DQL query into an AST+SQL anyway, so we'd have
to re-parse it manually: instead of doing that, we can force the
`WhereInWalker` to be reached at all times by forcing the
`$whereInQuery` to use no query cache.

While it is a sad performance regression, it is also not a
noticeable one, since we'll be performing an `O(1)` operation
around an I/O one (query execution, in this case).
2019-10-10 18:23:31 +02:00
Marco Pivetta
b59fc23f86 #7837 reproduced issue: DQL caching prevents WhereInWalker run
Since `WhereInWalker` does not run, query parameters are not translated
from their in-memory type to the expected SQL type when the paginator
is run again with the same DQL string. This is an architectural
issue, since (for the sake of simplicity) we moved parameter
translation into the SQL walker, we didn't consider that SQL
walkers only act when no cache is in place. The translatio
needs to be moved into the paginator logic again.
2019-10-10 17:30:43 +02:00
Luís Cobucci
d71dd5d94f Bump up version 2019-10-08 20:04:50 +02:00
Luís Cobucci
63513e9a05 Merge pull request #7856 from lcobucci/fix/underscore-strategy-dont-work-with-numbers
Fix underscore naming strategy behaviour with numbers
2019-10-08 12:06:24 +02:00
Luís Cobucci
c802bc46a5 Format NamingStrategyTest according to our CS 2019-10-08 11:56:11 +02:00
Luís Cobucci
506bf0ee12 Allow numbers in property names on underscore naming strategy 2019-10-08 11:56:11 +02:00
Luís Cobucci
a36809db72 Merge pull request #7851 from peter-gribanov/reflFieldValue2.6
Remove not used variable $reflFieldValue in ObjectHydrator
2019-10-04 07:50:26 +02:00
Peter Gribanov
5b00d7ba5e remove not used variable $reflFieldValue in ObjectHydrator 2019-10-03 11:14:24 +03:00
Luís Cobucci
b22604352d Merge pull request #7849 from axi/patch-1
Mention SQL logger impact on batch processing
2019-10-02 14:14:48 +02:00
axi
00c6b1bc60 Update batch-processing.rst
Clarify note
2019-10-02 14:00:06 +02:00
Luís Cobucci
4b0d86ee92 Merge pull request #7842 from vpArth-php/gh-7841
#7841 SchemaTool generates extra diff for platforms without FK support
2019-10-02 10:50:42 +02:00
Alexander Deider
3707c39124 #7841 SchemaTool generates extra diff for platforms without FK support 2019-10-02 15:35:59 +07:00
Luís Cobucci
fe72b00df2 Merge pull request #7850 from nlx-lars/nlx-lars/bugfix/7836-dont-merge-criteria
Don't merge PersistentCollection orderBy with criteria in matching()
2019-10-02 10:02:38 +02:00
Lars Lauger
79a7ecc92f Don't merge PersistentCollection orderBy with criteria in matching()
If no orderings are given to PersistentCollection::matching(), the
orderBy annotation will be used if present. If the criteria contains
orderings, those will be used without merging them with the orderBy.

See #7836
2019-10-02 09:23:38 +02:00
Luís Cobucci
16df8bfe0d Merge pull request #7298 from dunglas/patch-2
Add a missing type in Query::getFirstResult PHPDoc
2019-10-02 04:27:19 +02:00
Kévin Dunglas
b37ceaa9f7 Add a missing type in Query::getFirstResult and Query::getDQL 2019-10-02 04:13:42 +02:00
Luís Cobucci
c41fdbce8a Merge pull request #7727 from madand/patch-1
[doc] Finish incomplete definition of class UTCDateTimeType
2019-10-02 04:11:20 +02:00
Luís Cobucci
7526adc80a Merge pull request #7443 from naitsirch/fix/issue6793
Added doc about exception in Query#getOneOrNullResult()
2019-10-02 04:07:25 +02:00
Andriy Kmit
766eb693fb Finish incomplete definition of class UTCDateTimeType 2019-10-02 03:57:06 +02:00
Luís Cobucci
f9e2ae3488 Merge pull request #7667 from jschaedl/patch-1
Fixes example One-To-One, Self-referencing
2019-10-02 03:56:01 +02:00
Luís Cobucci
6bf2ff5d10 Merge pull request #7671 from jschaedl/patch-4
Added missing "the"
2019-10-02 03:45:50 +02:00
Jan Schädlich
27fcc01d81 Fixes example One-To-One, Self-referencing 2019-10-02 03:37:23 +02:00
Jan Schädlich
3ac1f8e680 Added missing "the" 2019-10-02 03:36:06 +02:00
Luís Cobucci
b63db53552 Merge pull request #7764 from guillaume-a/7763
#7763 escape quotes in field comments
2019-10-02 02:56:05 +02:00
Guillaume Aveline
bed8186573 Fix comment quoting in the EntityGenerator
Fixes: https://github.com/doctrine/orm/issues/7763
2019-10-02 02:42:09 +02:00
Luís Cobucci
f08ff83d0a Merge pull request #7768 from mickaelandrieu/patch-1
EntityManagerHelper can't accept an array of paths
2019-10-01 22:51:13 +02:00
axi
7c8c0906be Update batch-processing.rst
Looking for a way to improve one of our bulk update treatment, I went back to this page then found elsewhere that setting logger to null was a really effective way to improve time and memory consumption. Might be a right place to state it ? Don't know if my edit style is ok
2019-10-01 17:46:09 +02:00
Grégoire Paris
167cb44ea1 Merge pull request #7742 from bocharsky-bw/patch-1
Start i var from 1 instead of 0
2019-09-28 18:54:56 +02:00
Mickaël Andrieu
5d74bdb240 Remove misleading documentation
EntityManagerHelper does not have a second argument, see
ca38249f6c/lib/Doctrine/ORM/Tools/Console/Helper/EntityManagerHelper.php (L49)
2019-09-28 12:32:09 +02:00
Luís Cobucci
ca38249f6c Merge pull request #7838 from samnela/fix/name-classmetadata
Fix the name of ClassMetadata in documentation
2019-09-27 22:31:49 +02:00
Samuel NELA
6a74f373b9 Fix the name of ClassMetadata in documentation 2019-09-27 21:59:32 +02:00
Luís Cobucci
b52ef5a100 Merge pull request #7322 from dennisenderink/fix/joinedsubclasspersister-pass-identifier-types-on-delete
JoinedSubclassPersister pass identifier types on delete
2019-09-20 16:30:26 +02:00
Luís Cobucci
ef783f7049 Make use of the PersisterHelper to get field type
Removing the unnecessary code duplication.
2019-09-20 16:17:43 +02:00
Luís Cobucci
435d624d33 Centralise functional test classes
Which provides better isolation and makes things a bit more
understandable.
2019-09-20 16:17:43 +02:00
Dennis Enderink
53775fe086 Added correct return types to docblock 2019-09-20 16:17:43 +02:00
Dennis Enderink
59f1679fed Patched spacing 2019-09-20 16:17:43 +02:00
Dennis Enderink
390d081fca Created new DBAL type and updated/reverted tests; also clarified new method return type 2019-09-20 16:17:43 +02:00
Dennis Enderink
37d1d57900 Added unit tests 2019-09-20 16:17:42 +02:00
Dennis Enderink
d7a537c941 Pass ClassMetadata object instead of string in parent classes loop 2019-09-20 16:17:42 +02:00
Dennis Enderink
cfe73cd74f Separated class identifiers types retrieval in a separate method and implemented in JoinedSubclassPersister delete method 2019-09-20 15:40:03 +02:00
Luís Cobucci
d0e1da8c51 Merge pull request #7490 from vladyslavstartsev/patch-2
Fix broken link
2019-09-20 15:32:13 +02:00
vladyslavstartsev
7fbe663ea0 Fix broken link
closing #7489
2019-09-20 15:31:12 +02:00
Luís Cobucci
409f2f5d82 Merge pull request #7672 from jschaedl/patch-5
Added cross-links to relevant documentation
2019-09-20 15:30:14 +02:00
Luís Cobucci
3d8b672771 Merge pull request #7610 from smtchahal/patch-1
Change APC to OPcache in improving-performance.rst
2019-09-20 15:29:07 +02:00
Jan Schädlich
17650a6100 Added cross-links to relevant documentation 2019-09-20 15:19:49 +02:00
Luís Cobucci
1588ca7e1f Merge pull request #7821 from Ocramius/bug/#7820-paginator-ignores-dbal-type-conversions-in-identifiers
Bug: #7820 paginator ignores dbal type conversions in identifiers
2019-09-20 15:13:58 +02:00
Marco Pivetta
0de17319d3 #7820 use PersisterHelper to figure out identifier types
This logic was pre-existing, but I forgot about it while writing
#7820, therefore it was re-implemented inside this unit of
code. Now we just use the `PersisterHelper`, which does all
the nice and shiny identifier type discovery operations we need.
2019-09-20 15:03:22 +02:00
Marco Pivetta
681ff32e76 #7820 documented PersisterHelper#getTypeOfField() array return type
Array values are `string`, and the array is a packed array.
2019-09-20 14:57:44 +02:00
Marco Pivetta
caee6c8685 #7820 restricted return type of Doctrine\ORM\Mapping\ClassMetadataInfo#getTypeOfColumn()
This method will always return `string|null`, so we can safely
remove DBAL types from its possible return types.
2019-09-20 14:51:56 +02:00
Marco Pivetta
c67a515cc2 As per discussion with @lcobucci, it is better to keep dragons where
there be dragons, and this change does indeed rewrite the previous
approach by moving the responsibility of type conversion on a query
object from the `Paginator` to the `WhereInWalker`, which already
has access to class metadata for the root of the selection (and can
reliably detect the root of the selection too)
2019-09-19 20:05:34 +02:00
Luís Cobucci
24892779f7 Merge pull request #7818 from SenseException/simple-annotation-docs
Add note into docs about not using SimpleAnnotationReader
2019-09-18 10:49:43 +02:00
Marco Pivetta
39d2113549 Fixed #7820 - convert identifiers for WHERE IN(?) queries before binding parameters
This patch introduces new internal API on the `ResultSetMapping` class, which is responsible
for finding the type of the single column identifier of a DQL query selection root.
2019-09-17 16:54:25 +02:00
Marco Pivetta
65522d9775 Failing test case for #7820 - paginator doesn't use custom ID types
When using a `Doctrine\ORM\Tools\Pagination\Paginator` to iterate over a query that has entities with a custom DBAL type used in the identifier, then `$id->__toString()` is used implicitly by PDO, instead of being converted by the `Doctrine\DBAL\Types` system.

In order to reproduce this, you must have identifiers implementing `#__toString()` (to allow the `UnitOfWork` to hash them) and other accessors that are used by the custom DBAL type during DB/PHP conversions. If `#__toString()` and the DBAL type conversions are asymmetric, then the paginator will fail to find records.

Tricky situation, but this very much affects `ramsey/uuid-doctrine` and anyone relying on the `uuid_binary`.
2019-09-17 11:37:50 +02:00
Claudio Zizza
50eecf698c Add note into docs about not using SimpleAnnotationReader 2019-09-15 22:50:46 +02:00
Luís Cobucci
20ab78e3c1 Merge pull request #7753 from SenseException/getting-started-annotation
Add ORM annotations in getting-started docs
2019-09-12 17:01:53 +02:00
Luís Cobucci
613ffe9bbd Backport documentation sidebar 2019-09-10 16:31:41 +02:00
Luís Cobucci
61ff45f98e Merge pull request #7785 from mlocati/php74-fixes
Fix "access array offset on value of type null" PHP 7.4 notices
2019-09-10 16:08:49 +02:00
Luís Cobucci
a8aa475d09 Add PHP 7.4 to test matrix 2019-09-10 15:48:05 +02:00
Luís Cobucci
a4215cfa59 Update locked dependencies 2019-09-10 15:48:04 +02:00
Luís Cobucci
a4ac9a721f Upgrade PHPUnit to 7.5 2019-09-10 15:48:03 +02:00
Michele Locati
447183e235 Fix "access array offset on value of type null" PHP 7.4 notices 2019-09-10 15:47:57 +02:00
Luís Cobucci
642e543b4b Merge pull request #7778 from umpirsky/fix/issue-7266
Guard L2C regions against corrupted data
2019-08-14 18:07:58 +02:00
Luís Cobucci
80503c4837 Guard cache regions against corrupted data
For some bizarre reason the underlying cache drivers are returning
unexpected values, which are leaking to the cache objects and causing
them to error.

This makes our cache regions much more strict about the types that are
fetched from the cache provider, ensuring that no invalid information is
ever sent to the hydrators.
2019-08-14 17:42:56 +02:00
Luís Cobucci
3577064f8c Make closure static
To adhere to our coding standard.
2019-08-14 17:42:56 +02:00
Luís Cobucci
b6663733c0 Add type assertion to be more strict about persister type 2019-08-14 17:42:56 +02:00
Luís Cobucci
b9d6834213 Remove unnecessary function calls 2019-08-14 17:42:56 +02:00
Luís Cobucci
eafc4c5a0c Remove unnecessary parentheses 2019-08-14 17:42:56 +02:00
Saša Stamenković
ecf80b47a0 Call to a member function resolveAssociationEntries() on boolean
The following mistakes occur occasionally:

```
Call to a member function resolveAssociationEntries() on boolean {"detail":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function resolveAssociationEntries() on boolean at /www/vendor/doctrine/orm/lib/Doctrine/ORM/Cache/DefaultQueryCache.php:140)"}
```

On cache miss the parameter `$entityEntry` sometimes will be false. This fixes issue #7266.
2019-08-14 17:42:56 +02:00
Luís Cobucci
5499555862 Merge pull request #7791 from Steveb-p/fix-docs
Fix preFlush event documentation stating incorrectly that flush can be called safely
2019-08-14 14:03:13 +02:00
Paweł Niedzielski
70df74f65f Fix preFlush event documentation stating incorrectly that flush can be called safely
Original author: egonolieux
Supersedes #6858
2019-08-14 13:41:31 +02:00
Luís Cobucci
74415becce Merge pull request #7737 from Smartel1/smartel1/patch1
Fix MEMBER_OF comparison when using criteria in query builder
2019-08-14 10:07:11 +02:00
drews
3a56cf8ad9 Add MEMBER_OF comparison to queryExpressionVisitor 2019-08-14 09:47:20 +02:00
Luís Cobucci
6b7f53f0f3 Merge pull request #7766 from stephanschuler/respect-collection-ordering-in-selectable-matching
Respect collection orderBy meta when matching()

Fixes https://github.com/doctrine/orm/issues/7767
2019-08-13 23:42:32 +02:00
Stephan Schuler
e51666e8be Fix PersistentCollection::matching() not respecting collection ordering
The ordering of a Criteria is prefered over the collections default
ordering.

The default collection ordering used as additional sorting attributes.
2019-08-13 23:34:54 +02:00
Luís Cobucci
6e56bcd75f Merge pull request #7750 from AlexSmerw/issue_7735_null_values_in_entities_cache_for_2.6
Fix incorrect return of null values in L2C
2019-08-12 01:28:20 +02:00
Luís Cobucci
48bfef1f7a Merge pull request #7761 from paxal/persistent_collection/deferred_explicit_2.6
Do not modify UOW on PersistentCollection::clear() when owner has DEFFERED_EXPLICIT change tracking policy
2019-08-12 01:21:21 +02:00
A.Kuterev
e8f91434a7 Avoid reusing variable name
The same variable name is used below, and that causes a bug etc.
Fixes https://github.com/doctrine/orm/issues/7735
2019-08-12 01:18:48 +02:00
Luís Cobucci
7e26d82790 Merge pull request #7794 from lcobucci/fix-compatibility-with-dev-dependencies
Fix test compatibility with DBAL 2.10.x-dev
2019-08-12 00:00:45 +02:00
Luís Cobucci
869b70e4db Use Ubuntu Xenial for MySQL 5.7 build
Since July 21st 2019 it's no longer possible to install MySQL 5.7 in
Ubuntu Trusty.

More info: https://docs.travis-ci.com/user/database-setup/#mysql-57
2019-08-11 23:41:32 +02:00
Luís Cobucci
33904cb9c1 Fix test compatibility with DBAL 2.10.x-dev 2019-08-11 23:41:32 +02:00
Cyril PASCAL
a42191eecf Add functional test for ArrayCollection::clear() bug 2019-07-19 16:21:12 +02:00
Cyril PASCAL
3fbf163d34 Do not modify UOW on PersistentCollection::clear() when owner has DEFFERED_EXPLICIT change tracking policy 2019-06-26 16:07:15 +02:00
naitsirch
1c45e1b744 Fixed grammatical mistake in doc
Co-Authored-By: Grégoire Paris <postmaster@greg0ire.fr>
2019-06-24 22:07:56 +02:00
Claudio Zizza
c777aa62b6 Fix of ORM annotation in examples 2019-06-23 23:39:41 +02:00
Luís Cobucci
6296bd4e1d Merge pull request #7744 from noobshow/patch-1
Fixed a typo-error
2019-06-18 08:30:35 +02:00
Luís Cobucci
5a236c19f5 Merge pull request #7731 from greg0ire/try-mysql-addon
Replace custom install script with add-on
2019-06-17 23:33:04 +02:00
Olumide Samson
4f8a1f92a3 Fixed a typo-error
exploitet changed to exploited
2019-06-17 09:00:45 +01:00
Victor Bocharsky
5612790307 Start i var from 1 instead of 0
Because (0 % $batchSize) === 0 but we don't want to execute flush() and clear() on the first iteration.
2019-06-11 13:19:56 +03:00
Jonathan H. Wage
0b5be00374 Merge pull request #7732 from lchrusciel/patch-1
[Documentation] Missing comma fix
2019-06-04 11:11:46 -05:00
Łukasz Chruściel
145cc782ff [Documentation] Missing comma fix 2019-06-04 17:38:26 +02:00
Jonathan H. Wage
9712506be8 Merge pull request #7729 from JoppeDC/patch-1
Update DATE_ADD and DATE_SUB docs
2019-06-04 10:23:15 -05:00
Grégoire Paris
bd9ead11c5 Replace custom install script with add-on
Following this documentation:
https://docs.travis-ci.com/user/database-setup/#mysql-57
found via https://stackoverflow.com/a/49542847/353612
2019-06-03 22:12:54 +02:00
Joppe de Cuyper
a98ebf7344 Whitespace fixes 2019-06-03 20:21:19 +02:00
Joppe de Cuyper
c721ab63ee Update DATE_ADD and DATE_SUB docs 2019-06-03 20:20:03 +02:00
Jonathan H. Wage
2820438afc Merge pull request #7694 from darrylhein/patch-1
Change variable name in docs
2019-04-29 11:00:10 -05:00
Darryl Hein
180cfcc3e3 change variable name
to make it consistent throughout document
2019-04-28 21:07:22 -06:00
Marco Pivetta
52d806a34a Merge pull request #7612 from spirlici/patch-1
Update ordered-associations.rst
2019-03-12 00:16:09 +01:00
Marco Pivetta
49a8f2ec96 Merge pull request #7630 from yethee/gh-7629
Fix #7629 - `scheduledForSynchronization` leaks memory when using `@ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")`
2019-03-01 21:24:57 +01:00
yethee
7f5f4629e5 Ensure state is cleanup after empty commit 2019-03-01 23:00:01 +03:00
yethee
d91e0b3867 Failing tests 2019-02-28 17:12:54 +03:00
Sergiu Pirlici
b537758b32 Update ordered-associations.rst
Fixed some typos
2019-02-16 15:04:45 +02:00
Sumit Chahal
2ba6e473de Change APC to OPcache in improving-performance.rst
OPcache is a lot better supported now than APC,
which is apparently not maintained anymore.
2019-02-16 16:44:21 +05:30
Marco Pivetta
de97061d65 Merge pull request #7596 from mbessolov/patch-1
Correct method names and broken link in docs
2019-02-09 15:47:17 +01:00
Michael Bessolov
624ee78081 Correct method names and broken link in docs
This basically applying the same documentation fix as in #7335 (master) to 2.6 branch
2019-02-08 22:29:10 -08:00
Marco Pivetta
e003bb2bb4 Merge pull request #7577 from SenseException/advanced-config-link
Fix of single link to dbal docs in advanced-configuration.rst
2019-01-23 07:48:12 +01:00
Claudio Zizza
5c5f310646 Fix of link to dbal docs 2019-01-22 22:42:13 +01:00
Marco Pivetta
c10433e512 Merge pull request #7572 from SenseException/remove-codeigniter
Remove codeigniter Framework example
2019-01-17 22:35:58 +01:00
Claudio Zizza
580c530041 Remove codeigniter example from docs 2019-01-17 21:54:33 +01:00
Marco Pivetta
4d461afbd6 Merge pull request #7571 from batwolf/patch-1
Fix typo in inheritance mappings docs
2019-01-17 21:42:45 +01:00
Marco Pivetta
536e31f343 Merge pull request #7385 from SenseException/links-and-typos
Update information and links of documentation
2019-01-17 21:11:50 +01:00
Marc Plotz
c6eb4df25e fix typo
`has to allow null values` vs `has to allows null values`
2019-01-17 10:14:56 +01:00
Claudio Zizza
aae00e3987 Fix of links and php version after review 2019-01-07 14:40:26 +01:00
Claudio Zizza
b56800b15c Fix of links and anchors 2019-01-07 14:40:17 +01:00
Claudio Zizza
be461be36b Update getting help section 2019-01-07 14:40:10 +01:00
Claudio Zizza
85171a9490 Fix of reStructuredText format 2019-01-07 14:40:02 +01:00
Claudio Zizza
f5b9f2052a Update MySQL links to current version 2019-01-07 14:39:54 +01:00
Claudio Zizza
3d652997d1 Remove changelog from documentation
This was removed in favour of the UPGRADE.md file, which
contains the changelog information needed.
2019-01-07 14:39:42 +01:00
Marco Pivetta
10393dca68 Merge pull request #7557 from doctrine/malarzm-patch-1
Change Stackoverflow tag to doctrine-orm
2019-01-05 17:48:41 +01:00
Maciej Malarz
597bfaea03 Change Stackoverflow tag to doctrine-orm 2019-01-04 22:20:24 +01:00
Jonathan H. Wage
98b8ced814 Merge pull request #7551 from Majkl578/repo-rename/2.6
[2.6] Migrate repository name doctrine/doctrine2 -> doctrine/orm
2019-01-03 17:18:59 -06:00
Michael Moravec
efaee8ce85 Migrate repository name doctrine/doctrine2 -> doctrine/orm 2019-01-03 09:07:03 +01:00
Luís Cobucci
6e93f5bb72 Merge pull request #7528 from Ocramius/fix/#7527-prevent-unit-of-work-lookup-for-known-value-types
Fix #7527:  prevent `UnitOfWork` lookup for DBAL types specified in `Doctrine\ORM\Query#setParameter()`
2018-12-21 21:54:20 +01:00
Marco Pivetta
a41f5673bc #7527 automated CS checks 2018-12-20 22:59:46 +01:00
Marco Pivetta
ca436f0bae #7527 performance benchmark - verifying performance impact of inferred query parameter types
As an example result:

```
./phpbench.phar run tests/Doctrine/Performance/Query --iterations=50 --revs=50 --report=aggregate
PhpBench 0.15-dev (dcbe193). Running benchmarks.
Using configuration file: /home/ocramius/Documents/doctrine/doctrine2/phpbench.json

\Doctrine\Performance\Query\QueryBoundParameterProcessingBench

    benchExecuteParsedQueryWithInferredParameterTypeI49 P0 	[μ Mo]/r: 643.684 634.664 (μs) 	[μSD μRSD]/r: 17.700μs 2.75%
    benchExecuteParsedQueryWithDeclaredParameterTypeI49 P0 	[μ Mo]/r: 97.673 94.251 (μs) 	[μSD μRSD]/r: 8.259μs 8.46%

2 subjects, 100 iterations, 100 revs, 0 rejects, 0 failures, 0 warnings
(best [mean mode] worst) = 88.460 [370.679 364.458] 127.400 (μs)
⅀T: 37,067.880μs μSD/r 12.980μs μRSD/r: 5.603%
suite: 133f0e30090f815142331ebec6af18241694e7c0, date: 2018-12-19, stime: 10:47:10
+------------------------------------+--------------------------------------------------+--------+--------+------+-----+------------+-----------+-----------+-----------+-----------+----------+--------+-------+
| benchmark                          | subject                                          | groups | params | revs | its | mem_peak   | best      | mean      | mode      | worst     | stdev    | rstdev | diff  |
+------------------------------------+--------------------------------------------------+--------+--------+------+-----+------------+-----------+-----------+-----------+-----------+----------+--------+-------+
| QueryBoundParameterProcessingBench | benchExecuteParsedQueryWithInferredParameterType |        | []     | 50   | 50  | 5,970,568b | 604.680μs | 643.684μs | 634.664μs | 677.640μs | 17.700μs | 2.75%  | 6.59x |
| QueryBoundParameterProcessingBench | benchExecuteParsedQueryWithDeclaredParameterType |        | []     | 50   | 50  | 5,922,424b | 88.460μs  | 97.673μs  | 94.251μs  | 127.400μs | 8.259μs  | 8.46%  | 1.00x |
+------------------------------------+--------------------------------------------------+--------+--------+------+-----+------------+-----------+-----------+-----------+-----------+----------+--------+-------+
```

This indicates that the performance impact for NOT declaring parameter types
explicitly is *MASSIVE*.
2018-12-19 10:52:11 +01:00
Marco Pivetta
d8212e8dd6 Merge pull request #7530 from vladyslavstartsev/patch-3
Documentation error fix
2018-12-17 16:00:44 +01:00
vladyslavstartsev
12eb9f42dc Documentation error fix 2018-12-16 20:33:21 +02:00
Marco Pivetta
23af164d7a Note: this will still lead to the UnitOfWork#getSingleIdentifierValue() still being
called when not specifying the type of a DQL parameter being bound via
`Doctrine\ORM\Query#setParameter()`:

```php
$query->setParameter('foo', $theValue, $theType);
```

A full parameter bind is required in order to gain back performance:

```php
$query->setParameter('foo', $theValue, $theType);
```

This is up for discussion with patch reviewers.
2018-12-16 18:05:02 +01:00
Marco Pivetta
960a437d46 #7527 failing test case: UnitOfWork#getSingleIdentifierValue() should not be called for a well specified parameter type
As previously reported by @flaushi in https://github.com/doctrine/doctrine2/pull/7471#discussion_r241949045, we discovered
that binding a parameter causes a `ClassMetadataFactory#getClassMetadata()` call, which in turn leads to large performance
regression when using any `object` type as parameter.

Following two snippets lead to an internal `ClassMetadataFactory#getClassMetadata()` call, which in turn leads to an
exception being thrown and garbage collected, plus multiple associated performance implications:

```php
$query->setParameter('foo', new DateTime());
$query->getResult();
```

```php
$query->setParameter('foo', new DateTime(), DateTimeType::NAME);
$query->getResult();
```

This is due to following portion of code:

434820973c/lib/Doctrine/ORM/Query.php (L406-L409)

Notice how `$value = $this->processParameterValue($value);` happens before attempting to infer the type for the parameter value.

That call leads to this segment being reached, which leads to the regression:

434820973c/lib/Doctrine/ORM/AbstractQuery.php (L423-L433)

Assuming the bound parameter type is provided, we can completely skip attempting to introspect the given object:

```php
$query->setParameter('foo', new DateTime(), DateTimeType::NAME);
$query->getResult();
```

Processing the parameter value is not needed in this case, so we can safely skip that logic for all known parameters.
In order to not introduce a BC break or change the `AbstractQuery#processParameterValue()` implementation, we could filter
out all parameters for which the type is given upfront, and later on merge them back in instead.

The test expectation to be set is for `UnitOfWork#getSingleIdentifierValue()` to never be called.
2018-12-16 15:37:45 +01:00
Marco Pivetta
237bebe2ed Merge pull request #7519 from koftikes/fix/#7518-phpdoc-error
#7518 Fixed type mismatch between `EntityRepository#__construct()` and its documented constructor arguments
2018-12-13 08:14:30 +01:00
Jonathan H. Wage
fc3dca772e Merge pull request #7521 from doctrine/update-chat-link
Update chat link from Gitter to Slack.
2018-12-12 20:07:31 +00:00
Konstantin Litvinov
ee64d31f48 7518 Fixed PHPDoc Error. 2018-12-12 17:08:35 +03:00
Michael Moravec
493ff74a0d Merge pull request #7473 from Majkl578/incremental-cs-2.x
Incremental CS checks in 2.x branches
2018-12-10 14:43:55 +01:00
Michael Moravec
78c7000962 Lock dependencies for Code Quality stage 2018-12-10 13:58:51 +01:00
Michael Moravec
6a05e01298 Perform incremental coding standard checks for pull requests 2018-12-10 13:58:51 +01:00
Gabriel Ostrolucký
7de3434733 Update doctrine/coding-standard in 2.x branch
Co-Authored-By: Michael Moravec <me@majkl.me>
2018-12-10 13:58:51 +01:00
Luís Cobucci
74e6189f3e Merge pull request #7483 from javiereguiluz/patch-9
Fixed a minor syntax issue
2018-11-21 10:48:33 +01:00
Javier Eguiluz
2e7a3affba Fixed a minor syntax issue 2018-11-21 09:06:54 +01:00
Luís Cobucci
505ec21f97 Bump up development version 2018-11-21 01:24:06 +01:00
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
naitsirch
17bc627bf2 Added hint about exception in Query#getOneOrNullResult()
When calling `Query#getOneOrNullResult()` and there are more than one
objects in the result an `NonUniqueResultException` is thrown.
This information was missing in the documentation about the query result
formats.

This commit addresses #6793.
2018-10-29 21:26:02 +01: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
Luís Cobucci
374e7ace49 Preparing v2.6.0 release 2017-12-20 01:38:15 +01:00
Marco Pivetta
d752cafb47 Merge pull request #6911 from lcobucci/bump-dependencies
Require more up-to-date dependencies
2017-12-20 00:19:31 +01:00
Luís Cobucci
0e44271a40 Require more up-to-date dependencies 2017-12-20 00:10:05 +01:00
Marco Pivetta
4c89498359 Merge branch 'feature/#6767-allow-association-as-JTI-identifier'
Close #6767
2017-12-19 18:02:48 +01:00
Marco Pivetta
b6aa4bab15 #6767 using in_array rather than array_search
Ref: https://github.com/doctrine/doctrine2/pull/6767/files#r157355050
2017-12-19 18:01:38 +01:00
Marco Pivetta
27c42d418b #6767 removed unused variable
Ref: https://github.com/doctrine/doctrine2/pull/6767/files#r157354726
2017-12-19 18:00:03 +01:00
Tyler Romeo
bb8970286d Allow association mappings as IDs for joined-table inherited entity
SchemaTool has custom logic for creating the primary key of a
joined-table inherited entity. This logic overlooked association maps
as a possible source for identity columns, resulting in a fatal error
when fetching the primary key list for child entities.

Removed any custom logic for generating primary keys for root entities
in joined-table inheritance, deferring to the common logic used for
other entities.

Also adjusted the child entity logic, scanning association maps for
identity columns, and including the column as appropriate. It also
ensures that the primary key columns are in the correct order.
2017-12-19 17:58:31 +01:00
Luís Cobucci
b210c1e364 Merge pull request #6905 from Majkl578/setup-cache-7.1-compat
Setup: Switch Apc -> Apcu and Memcache -> Memcached
2017-12-19 08:21:02 +01:00
Guilherme Blanco
a16dc65cd2 Fixes #1391, DDC-3693 2017-12-18 22:46:48 -05:00
Guilherme Blanco
0345f7b836 Merge pull request #1578 from StoshSeb/patch-1
Fixed DDC-3740
2017-12-18 22:41:18 -05:00
Michael Moravec
349724f05b Setup: Switch Apc -> Apcu and Memcache -> Memcached 2017-12-19 02:43:03 +01:00
Michael Moravec
e1825e37ef Merge pull request #6780 from aequasi/patch-1
getRepository actually returns ObjectRepository
2017-12-18 00:40:47 +01:00
Luís Cobucci
cfa1dfbfe6 Merge pull request #6887 from greg0ire/stable_stability
Use stable packages
2017-12-18 00:39:02 +01:00
Grégoire Paris
8e3c3f0bae Add marker variable for Travis 2017-12-18 00:14:00 +01:00
Grégoire Paris
ad3c3f4114 Implement conditional build
This will make cron builds fail, which is a bit more noticeable than an
allowed failure.
2017-12-17 23:38:16 +01:00
Grégoire Paris
8ca7db8852 Use stable packages
This will make it easier to contribute. It will also make reviews safer
since you will be able to tell if a PR is reponsible for a broken build
or not. Catching errors early is still possible by having a look at
allowed failures.
2017-12-17 23:38:16 +01:00
Michael Moravec
ca42879f9e Merge pull request #6898 from Majkl578/upgrade-typos
UPGRADE: Added method parenthesis, fixed method name
2017-12-17 04:43:43 +01:00
Michael Moravec
28b6ca3a16 UPGRADE: Added method parenthesis, fixed method name 2017-12-17 04:31:42 +01:00
Luís Cobucci
c4a5e5c3f8 Merge pull request #6748 from KonstantinKuklin/patch1
Fix missing null check on `AbstractQuery#setResultCacheProfile()`
2017-12-17 03:37:06 +01:00
Konstantin Kuklin
c308986a90 Fix insufficient variable check
To ensure that `AbstractQuery#setResultCacheProfile()` doesn't raise
errors when being called with `null`.
2017-12-17 03:21:52 +01:00
Luís Cobucci
739f518ebe Merge pull request #6892 from thexpand/patch-1
Re-order attributes of relation complex types
2017-12-17 02:49:49 +01:00
Cvetomir
a46e794b60 Re-order attributes of relation complex types
This will provide the same look for all of the relations: one-to-many, many-to-one, one-to-one, many-to-many.
It helps during auto-completion of XML code when creating XML schema for an entity.
The order is as follows: field, target-entity, mapped-by, inversed-by, indexed-by, fetch, orphan-removal.
2017-12-17 02:36:41 +01:00
Luís Cobucci
d3ff823f97 Merge pull request #6812 from Deltachaos/bugfix/inheritance-joins-master
Fix syntax error when join unrelated entity with discriminator entity
2017-12-17 01:42:42 +01:00
Maximilian Ruta
32c125def1 Fix syntax error when join with discriminator 2017-12-17 01:25:50 +01:00
Michael Moravec
0837493a7c Merge pull request #6894 from Majkl578/fix-readme-php-version
README: Fix PHP version
2017-12-17 01:16:50 +01:00
Luís Cobucci
260c2e899a Merge pull request #6897 from lcobucci/update-phpstan
Upgrade PHPStan to 0.9.x
2017-12-17 01:08:48 +01:00
Luís Cobucci
74ce8913fc Upgrade phpstan to 0.9
Applying the necessary fixes.
2017-12-17 00:55:50 +01:00
Luís Cobucci
80a94727ee Run tests also with the stable version of dependencies 2017-12-17 00:54:12 +01:00
Luís Cobucci
d6212dd09e Merge pull request #6896 from lcobucci/improve-build-stages
Run all code quality tools in the same stage
2017-12-17 00:04:58 +01:00
Luís Cobucci
122e9c3aa3 Run all code quality tools in the same stage
In order to execute things in parallel and speed up the build.
2017-12-16 23:52:20 +01:00
Luís Cobucci
8e4f624f90 Merge pull request #6895 from lcobucci/simplify-LimitSubqueryWalker
Reduce complexity of LimitSubqueryWalker#walkSelectStatement()
2017-12-16 23:50:24 +01:00
Luís Cobucci
441c5d138c Reduce complexity of LimitSubqueryWalker#walkSelectStatement()
Ensuring that the code follows our code standards.
2017-12-16 23:31:50 +01:00
Michael Moravec
b3654f95d0 README: Fix PHP version 2017-12-16 22:05:22 +01:00
Michael Moravec
aacea65519 Merge pull request #6889 from carusogabriel/clean-elses
Clean elses
2017-12-16 05:30:33 +01:00
Gabriel Caruso
d0d802309c Clean elses 2017-12-14 05:55:54 -02:00
Michael Moravec
a352c214a0 Merge pull request #6805 from yesdevnull/patch-1
[Docs] Corrected NamingStrategy demo code to match example
2017-12-12 04:30:01 +01:00
Dan Barrett
cd00ccae69 Updated table/column names example to be lowercase 2017-12-11 12:14:39 +11:00
Guilherme Blanco
e149f89cfe Merge pull request #6820 from plfort/#6819-pagination-optim
#6819 Optimize LimitSubqueryWalker
2017-12-10 19:56:31 -05:00
Marco Pivetta
b79b26aa8b Merge pull request #5805 from borNfreee/patch-1
Fix typo in documentation
2017-12-08 09:44:35 +01:00
Maks Rafalko
04d9bc40e4 Update validation-of-entities.rst 2017-12-08 09:33:41 +03:00
Michael Moravec
31816f6e2f Merge pull request #1442 from elazar/patch-1
Corrected bad class reference in "Adding own commands"
2017-12-08 05:13:04 +01:00
Michael Moravec
d32a8634aa Merge pull request #5736 from guilliamxavier/patch-3
Fix PHP syntax error in composite-primary-keys.rst
2017-12-08 04:39:56 +01:00
Luís Cobucci
f13f7ebe54 Merge pull request #6862 from OskarStark/typo
fixed closing tag
2017-12-03 11:27:52 +01:00
Oskar Stark
79e1be8c3d fixed closing tag 2017-12-01 15:41:52 +01:00
Luís Cobucci
92dd27fe3f Merge pull request #6826 from JKapitein/patch-1
Add Type::GUID to $typeAlias list in EntityGenerator
2017-11-28 00:38:11 +01:00
JKapitein
ad0a8c53fa Add Type::GUID to $typeAlias list in EntityGenerator
Right now, when generating entities, a column of type 'guid' will generate the following PHPDoc:

```
/**
 * Get id
 *
 * @return guid
 */
public function getId() {...}
```

Since guid is not a valid PHP type, this throws a warning in PHPStorm, and I assume most IDEs.

Adding the type to the type alias list fixes the problem.
2017-11-28 00:11:32 +01:00
Luís Cobucci
be18256a93 Merge pull request #6849 from lcobucci/fix/options-on-entity-generation
Make entity generator generate values for all supported options

Fixes: https://github.com/doctrine/doctrine2/issues/6703
2017-11-26 20:55:28 +01:00
Luís Cobucci
bc7aeb9d11 Make entity generator create the correct options
The `EntityGenerator` was not creating the field options for all
supported values.
2017-11-26 20:05:52 +01:00
Luís Cobucci
6e095f7c3b Merge pull request #6801 from foaly-nr1/DDC6029
Improve misleading ORMInvalidArgumentException message

Fixes: https://github.com/doctrine/doctrine2/issues/6029
2017-11-26 18:54:01 +01:00
foaly-nr1
c0a505366f Use the correct type for the exception message
Since the UoW checks each item of a *-to-many association to ensure
it has the correct type, we should never say that we expect an instance
of `Doctrine\Common\Collections\Collection` or an `array`.
2017-11-26 17:55:59 +01:00
foaly-nr1
b211dd4db7 Add failing test for misleading exception message
Describes: https://github.com/doctrine/doctrine2/issues/6029
2017-11-26 17:55:59 +01:00
Luís Cobucci
3ca65e28fc Merge pull request #6683 from alextech/bugfix/xml_sequence_params
Supply default values for optional values in sequence mapping if omitted by driver.

Fixes: https://github.com/doctrine/doctrine2/issues/6682
2017-11-26 17:07:03 +01:00
Sasha Alex Romanenko
b3331b2237 Enforce sequence XSD requirement
Supply default values for allocationSize and initialValue optional parameters.

Related to: https://github.com/doctrine/doctrine2/issues/6682
2017-11-26 16:33:27 +01:00
Luís Cobucci
dfc31bc855 Merge pull request #6740 from mduplouy/DDC288
Fix operator when using criteria on ManyToMany

Fixes: https://github.com/doctrine/common/issues/600
2017-11-26 14:21:57 +01:00
Mathieu Duplouy
7c28a932ae Add operator to walkComparison output 2017-11-26 14:03:54 +01:00
Mathieu Duplouy
15c145f3b3 Add failing test for DCOM-288
Reported on: https://github.com/doctrine/common/issues/600
2017-11-26 13:54:54 +01:00
Luís Cobucci
dda42f6c09 Merge pull request #6848 from lcobucci/cache-namespace-fix
Fix overwriting explicit cache namespace

Replaces: https://github.com/doctrine/doctrine2/pull/5904
2017-11-26 13:22:24 +01:00
Jan Jakes
99b2e57606 Fix overwriting explicit cache namespace 2017-11-26 12:48:12 +01:00
Luís Cobucci
d3759a2447 Fix incorrect arguments on SetupTest
Which was only caught by adding proper type declaration on private
methods.
2017-11-26 12:26:28 +01:00
Luís Cobucci
b7cace86a0 Merge pull request #6705 from Majkl578/ticket/6699
Fix parameter name comparison in AbstractQuery regarding different types (fixes #6699)

Fixes https://github.com/doctrine/doctrine2/issues/6699
2017-11-24 03:00:07 +01:00
Luís Cobucci
b8fd708139 Fix parameter name comparison in QueryBuilder#setParameter() with different types 2017-11-24 02:43:01 +01:00
Michael Moravec
6cb5a9c50a Fix parameter name comparison in AbstractQuery#setParameter() with different types 2017-11-24 02:43:00 +01:00
Michael Moravec
4bbb1067ac Add failing test for #6699 2017-11-24 02:42:59 +01:00
Luís Cobucci
b47a39be64 Merge pull request #6655 from OskarStark/symfony-style
Use SymfonyStyle for command output
2017-11-24 01:52:00 +01:00
Oskar Stark
6b5eb11458 Use SymfonyStyle for command output 2017-11-24 01:25:17 +01:00
Luís Cobucci
43a88d539d Format commands' tests
To simplify and organise the code (also replacing `$this->assert*`
with `self::assert*`).
2017-11-24 01:25:15 +01:00
Luís Cobucci
8a893068ce Remove constants existence validation
These constants are available since PHP 5.4 and since we're requiring
PHP 7.1 there's no reason to require them.

I've also simplified the `array_map()` call since it's useless to
define a closure that simply calls a function.
2017-11-24 01:25:14 +01:00
Oskar Stark
214dc9896b Use addOption()/addArgument() to configure commands
In order to simplify and standardise the definition of the commands.
2017-11-24 01:20:09 +01:00
Luís Cobucci
ba32237e2b Merge pull request #6844 from lcobucci/configure-phpcs
Configure PHPCS
2017-11-23 13:30:18 +01:00
Luís Cobucci
984327d782 Update PHPStan 2017-11-23 11:29:39 +01:00
Luís Cobucci
2be1b7d0b8 Add configuration for PHPCS
And execute it on Travis (allowing it to fail for now to prevent a lot
of conflicts with `develop`).
2017-11-23 11:26:33 +01:00
Luís Cobucci
13197123c5 Sort dependencies definitions 2017-11-23 11:15:52 +01:00
Luís Cobucci
24408b42d3 Merge pull request #6843 from lcobucci/use-new-scrutinizer-config
Use new analyser on scrutinizer-ci
2017-11-23 11:08:52 +01:00
Luís Cobucci
8918bd3b8a Use new analyser on scrutinizer-ci
Also preventing from running the tests (because that's already done on
Travis-CI) and simplifying the build failure conditions.
2017-11-23 10:24:18 +01:00
Pierre-Louis FORT
4ab9413675 Test that orderByItem is string 2017-11-10 10:45:57 +01:00
Pierre-Louis FORT
91408a3a54 #6819 Optimize LimitSubqueryWalker when resultVariable are involved and they are not used in "order by" 2017-11-09 14:34:11 +01:00
Dan Barrett
bccc46dc12 Corrected demo code to match example
Example paragraph mentions changing column titles to upper case, yet `strtolower` was being used.
2017-11-01 16:40:04 +11:00
Luís Cobucci
a82f6c5725 Merge pull request #6742 from Legenyes/feature/DDC-2938_Support_all_time_intervals_on_DATE_ADD
Add support second, minute, week, year on DATE_ADD and DATE_SUB

Fixes #5835
2017-10-31 20:46:02 +01:00
Luís Cobucci
59792654c0 Improve tests for DATE_ADD and DATE_SUB
So that we can do proper assertions and cover all the possibilities
of the functions.
2017-10-31 15:48:26 +01:00
Sébastien Lévêque
f277eef6ea Add support second, minute, week, year on DATE_ADD and DATE_SUB 2017-10-29 21:48:40 +01:00
Andreas
ed86ee2567 Merge pull request #6800 from ErikJson/master
Fix some grammar and outdated information in docs
2017-10-29 05:53:58 +01:00
Erik Johansson
302c3a6640 Fix some grammar and outdated information in docs 2017-10-29 00:28:10 +03:00
Luís Cobucci
0497f50ba6 Merge pull request #6766 from ThomasLandauer/patch-1
Moved explanation out of PHP-Codeblock...
2017-10-26 09:49:48 +02:00
Marco Pivetta
2129801ac1 Merge pull request #6788 from kejwmen/fix/custom-types-docs
[Docs] Type::convertToDatabaseValue is always called
2017-10-24 08:46:02 +02:00
Mateusz Sip
620319f206 Type::convertToDatabaseValue is always called 2017-10-24 01:50:58 +02:00
Marco Pivetta
5f3afa4c4f Merge pull request #6778 from stevepetcu/clarify-embedded-embeddable-docs
Clarify docs for embedded and embeddable.
2017-10-19 12:40:50 +02:00
Aaron Scherer
99db207a9f getRepository actually returns ObjectRepository 2017-10-18 19:10:00 -07:00
Stefan Petcu
0bea6881da Clarify docs for embedded and embeddable. 2017-10-17 19:21:34 +02:00
Guilherme Blanco
e279dfaa91 Merge pull request #6772 from greg0ire/disallow_many_to_one_orphan_removal
Disallow orphan removal attribute on many-to-one
2017-10-16 07:47:26 -04:00
Guilherme Blanco
87a6d0b77e Merge pull request #6774 from greg0ire/proove_orphan_removal_is_useless
Proove orphan removal is useless
2017-10-15 22:12:31 -04:00
Grégoire Paris
ffd3d34f34 Disable uuid generation
Apparently, setting a value by hand is not enough to avoid it.
2017-10-14 12:39:58 +02:00
Grégoire Paris
57e9feffb2 Avoid uuid generation
pg needs an extra module to do this, so let's spare us that and set them
manually.
2017-10-14 12:39:58 +02:00
Grégoire Paris
6b5c97055c Set null on delete, at database level 2017-10-14 12:39:57 +02:00
Grégoire Paris
30fccf8e83 Proove orphan-removal on many-to-one is useless 2017-10-14 12:39:57 +02:00
Grégoire Paris
2a865177b9 Disallow orphan removal attribute on many-to-one
It only makes sense for collections, and there is no collection here.
Plus the docs do not say it is supported.
See
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/working-with-associations.html#orphan-removal
2017-10-13 16:38:02 +02:00
Thomas Landauer
d560449661 Minor formating 2017-10-11 22:50:32 +02:00
Thomas Landauer
436b15e873 Moved explanation out of PHP-Codeblock...
...to make it visible for XML and YML too.
2017-10-11 22:45:42 +02:00
Marco Pivetta
aea970722e Merge pull request #6764 from AlessandroMinoccheri/fix_doc
fixed little typo inside documentation
2017-10-11 20:44:16 +02:00
Alessandro Minoccheri
b1466e6d3e fixed little typo inside documentation 2017-10-11 17:04:29 +02:00
Luís Cobucci
8e16748ff8 Merge pull request #6734 from ossinkine/issue-6734
Add DateInterval type parameter
2017-10-11 13:13:09 +02:00
Luís Cobucci
9e9e5628f5 Merge pull request #6755 from BenMorel/patch-2
EntityManager::getReference() can return null
2017-10-09 20:05:46 +02:00
Luís Cobucci
f2dc9a8f92 Merge pull request #6760 from doctrine/fix/#6759-showstopper-one-to-one-inverse-not-being-loaded-with-correct-identifier-restrictions
#6759 showstopper one-to-one inverse not being loaded with correct identifier restrictions when defining `joinColumn`
2017-10-08 14:47:15 +02:00
Marco Pivetta
66f903a38f #6759 remove # symbol from @group annotation as per @lcobucci's review
Ref: https://github.com/doctrine/doctrine2/pull/6760#discussion_r143353225
2017-10-08 14:26:45 +02:00
Marco Pivetta
3dd7eb5888 #6759 removing outdated comment as per @alcaeus' review
Ref: https://github.com/doctrine/doctrine2/pull/6760#discussion_r143347881
2017-10-08 10:57:33 +02:00
Marco Pivetta
dd12ba88ee #6759 avoiding reuse of the $identifier variable when constructing an identifier from the owning side value
Fixes #6759
2017-10-07 12:54:36 +02:00
Marco Pivetta
83e00d5010 #6759 cleaning up test case, using new models from the isolated namespace 2017-10-07 12:52:34 +02:00
Marco Pivetta
d831f4fd9f #6759 segregating test models into their own namespace 2017-10-07 12:48:19 +02:00
Marco Pivetta
6ba2d1c317 #6759 cleaning up test case body 2017-10-07 10:09:44 +02:00
Jan Langer
5f99cad669 Failing test - inverse side OneToOne loaded without identifier condition 2017-10-06 17:34:34 +02:00
Benjamin Morel
fb7a96caf9 EntityManager::getReference() can return null 2017-10-05 00:27:11 +02:00
Jonathan H. Wage
13f838f8be Merge pull request #6749 from KonstantinKuklin/patch2
sync type of property em with constructor value
2017-10-04 08:47:55 -04:00
Konstantin Kuklin
2d88e45240 sync type of property em with constructor value 2017-10-04 03:43:20 +03:00
Marco Pivetta
2ade863bca Merge pull request #6746 from doctrine/malarzm-patch-1
[DOCS] Emphasize that Embeddable can only contain simple fields
2017-10-03 17:42:31 +02:00
Maciej Malarz
19dcd629c0 [DOCS] Emphasize that Embeddable can only contains simple fields 2017-10-03 17:14:06 +02:00
Gocha Ossinkine
4fdbdabae4 Add DateInterval type parameter 2017-09-28 13:15:40 +05:00
Marco Pivetta
53245e8a73 Merge pull request #6731 from guiajlopes/master
#6723 Remove  variable from UnitOfWork#createEntity()
2017-09-26 13:10:39 +02:00
Guilherme Lopes
a7e13f89cc #6723 Remove variable from UnitOfWork#createEntity() 2017-09-26 12:52:18 +02:00
Marco Pivetta
1d5c87ee4b Merge pull request #6714 from guiajlopes/master
Remove unnecessary else
2017-09-21 14:30:25 +02:00
Marco Pivetta
f96dc3ba91 Merge pull request #6715 from PowerKiKi/patch-3
Promote nullable types from PHP 7.1
2017-09-21 14:29:23 +02:00
Adrien Crivelli
3d3ecc77bd Drop PHP version specifics 2017-09-21 21:28:19 +09:00
Guilherme Lopes
df1250ee4b Fix negation clause and also adding both conditions in the same if 2017-09-21 13:42:51 +02:00
Adrien Crivelli
d995203ee1 Promote nullable types from PHP 7.1
Also don't show type hinting in a bad light with sentences such as "If you insist on type-hinting"
2017-09-21 17:29:54 +09:00
Guilherme Lopes
8ecddc4fc1 Adding empty line between logic blocks 2017-09-21 10:13:19 +02:00
Guilherme Lopes
059cfd86df Remove unnecessary else 2017-09-21 10:02:43 +02:00
Benjamin Eberlei
0c4f9a8866 Clarify some assumptions the object hydration makes. 2017-09-16 17:15:08 +02:00
Marco Pivetta
6a86175617 Merge pull request #6695 from wshafer/prefix-update
Update table prefix docs
2017-09-11 20:58:11 +02:00
Marco Pivetta
bf8e27b422 Merge pull request #6690 from bitwombat/issue_6686
Clarify association mapping language
2017-09-11 08:51:50 +02:00
Marco Pivetta
80f7824b3d Merge pull request #6691 from keradus/php_syntax
Use newer PHP syntax
2017-09-11 08:50:05 +02:00
Westin Shafer
828bfdf4ae Update docs for deprecated setTableName()
Updated docs to remove deprecated setTableName() and replace it with setPrimaryTable()
2017-09-07 13:59:32 -06:00
Dariusz Ruminski
c7d6d62393 Use newer PHP syntax 2017-09-06 01:32:49 +02:00
Greg Bell
c429f1c38b Clarify association mapping language
- 5.3 was wrong - should really be 'inversedBy'
- 11.1 - change 'use' to 'have' for consistency.  A class has an attribute.

- See https://github.com/doctrine/doctrine2/issues/6686
2017-09-06 07:58:34 +10:00
Marco Pivetta
8b81691e77 Merge pull request #6685 from votemike/update-maxresult-docblocks
Updating `Query#$_maxResults` to allow for `null` (no limit)
2017-09-04 11:40:06 +02:00
Michael Gwynne
d0d1e557d1 Adding change to appease scrutinizer 2017-09-04 10:11:43 +01:00
Michael Gwynne
fd9f96c766 Updating _maxResults to allow for null 2017-09-04 09:26:11 +01:00
Marco Pivetta
4bc29d1049 Merge branch 'fix/#5796-catch-also-throwable-in-transactional-abstraction'
Close #5796
2017-09-02 13:58:08 +02:00
Marco Pivetta
c016e2d434 Adding minimal test to verify EntityManager behavior against #5796 2017-09-02 13:55:07 +02:00
Marco Pivetta
12043cd845 #5796 minor CS fixes (imported symbols) and removing last PHP5 compliance bits 2017-09-02 13:47:58 +02:00
Marco Pivetta
a1c93bfd48 #5796 replacing Exception catching with Throwable catching, removing PHP5 compliance code 2017-09-02 13:44:12 +02:00
Benjamin Morel
874a5e3547 Catch Throwable in PHP 7 2017-09-02 13:41:53 +02:00
Marco Pivetta
68706034e5 Merge pull request #6658 from Majkl578/fix/allow-stable-yaml
Drop explicit conflict with stable symfony/yaml
2017-08-30 22:43:28 +02:00
Michael Moravec
bfc76adce0 Drop explicit conflict with stable symfony/yaml
As per discussion in #6639, conflict with versions below 3.4
of the YAML component is superfluous, previous versions
would work just fine even with bb994b9e70.
2017-08-30 22:06:19 +02:00
Marco Pivetta
8c7052c99c Merge pull request #6652 from doctrine/fix/allow-batch-insert-test-to-run-in-multiple-revolutions
Correcting the `SimpleInsertPerformanceBench` duplicate record issues when run with multiple revolutions/iterations
2017-08-26 16:42:51 +02:00
Marco Pivetta
e1e7485e58 Correcting the SimpleInsertPerformanceBench, which was running into duplicate record integrity constraint violations when run with >1 revs 2017-08-26 16:41:03 +02:00
Marco Pivetta
7a0385634f Merge pull request #6651 from doctrine/fix/use-quote-model-set-when-available
Replacing direct `quote` model-set schema creation with actually existing model-set setup
2017-08-26 14:23:26 +02:00
Marco Pivetta
922c55f5dd Replacing direct quote model-set schema creation with actually existing model-set setup 2017-08-26 14:15:05 +02:00
Marco Pivetta
61404e2d6d Merge pull request #6640 from doctrine/fix/#6284-#6217-avoid-passing-l2-cache-information-internals-to-the-uow
#6217 #6284 when hydrating an entity with a composite primary key that is both an `EAGER` and a `LAZY` association and also cached, the `DefaultQueryCache` tries to pass L2 cache implementation detail objects to the `UnitOfWork`
2017-08-25 09:22:45 +02:00
Marco Pivetta
660f164568 #6284 #6217 s/$this->assert/self::assert as per @lcobucci's review 2017-08-25 09:21:12 +02:00
Marco Pivetta
acfc890dbd Merge pull request #6644 from AlessandroMinoccheri/fix_documentation_typo
fixed typo into native-sql documentation
2017-08-24 11:29:17 +02:00
Alessandro Minoccheri
a708d4076e fixed typo into native-sql documentation 2017-08-24 11:27:54 +02:00
Marco Pivetta
aac0204611 Merge pull request #6642 from radmax/patch-1
Fixed typo in DQL docs
2017-08-24 10:57:11 +02:00
radmax
ed047520c3 fixed typo 2017-08-24 10:55:29 +02:00
Marco Pivetta
caa008b61d #6284 #6217 removing hacks around the ClassMetadata details - invalid fix that was actually fixing the symptom 2017-08-23 00:25:29 +02:00
Marco Pivetta
07b397f341 #6284 fixing actual issue, which comes from an extremely tricky L2 caching issue.
We are not hydrating some of the cached association data into entities due to keys missing in the cache association definition.
Since this is an extreme edge case that is just a mismatch between db and cache, a detailed explanation was provided in the fix snippet as well
2017-08-23 00:19:49 +02:00
Marco Pivetta
c9d1f852de #6284 removing unused lazy entity 2017-08-22 21:41:04 +02:00
Marco Pivetta
c29a1e96b7 #6284 removing unused separate class 2017-08-22 21:40:42 +02:00
Marco Pivetta
a2f4053a81 #6284 renaming variables, classes and properties to fit tested behavior 2017-08-22 21:38:44 +02:00
Marco Pivetta
3f09e20955 #6284 correcting alignment, removing stuff that isn't strictly needed 2017-08-22 21:31:01 +02:00
Marco Pivetta
220dc79ebf #6284 renaming entities to match the scope of this test 2017-08-22 21:29:27 +02:00
Marco Pivetta
6f6e88cfb6 #6284 adding assertions about equality of the loaded classes 2017-08-22 21:27:46 +02:00
Marco Pivetta
dac1ce4172 #6284 removing profile entity, since it is not needed to reproduce the issue 2017-08-22 21:21:53 +02:00
Marco Pivetta
ca39abcd71 #6284 reducing annotation mapping clutter 2017-08-22 21:17:14 +02:00
Marco Pivetta
4e0b76ce69 #6284 eager fetching is strictly required to verify the issue 2017-08-22 21:14:38 +02:00
Marco Pivetta
805ba041ef #6284 reducing annotation mapping clutter 2017-08-22 21:12:45 +02:00
Marco Pivetta
3842ad8ea1 #6284 simplifying tests to a minimum, removing unused auto-generated id field 2017-08-22 21:11:03 +02:00
Marco Pivetta
c7281f6ade #6284 simplifying tests to a minimum, removing unused auto-generated id field 2017-08-22 21:08:06 +02:00
Marco Pivetta
a8453dda89 #6284 removing the "WTF" part of the logic - an association cache entry should never ever reach metadata 2017-08-22 21:03:14 +02:00
Waleed Gadelkareem
309b286ed3 Add tests for #6217 2017-08-22 19:45:26 +02:00
Marco Pivetta
8ad3dfd3bd Merge branch 'fix/#1521-DDC-2922-defer-checking-non-persisted-entities-through-multiple-differently-mapped-cascading-associations'
Close #1521
Close DDC-2922
2017-08-22 10:26:15 +02:00
Marco Pivetta
645cccf2db #1521 DDC-2922 adapting test so the UnitOfWork stops bragging about previous inconsistent states 2017-08-22 10:24:46 +02:00
Marco Pivetta
2be32f249c #1521 DDC-2922 adapting UoW and exception implementation to the new specification 2017-08-22 09:57:57 +02:00
Marco Pivetta
4a007c76f5 #1521 DDC-2922 spec for a new exception endpoint that produces a multi-new-non-cascaded-entities error message 2017-08-22 09:56:43 +02:00
Marco Pivetta
a754eae0f0 #1521 DDC-2922 verifying that persistence operations will resume normally after a crash due to invalid new values detected on associations - tweaked test to make it fail 2017-08-22 08:51:27 +02:00
Marco Pivetta
89fbb6a060 #1521 DDC-2922 verifying that persistence operations will resume normally after a crash due to invalid new values detected on associations 2017-08-22 08:49:42 +02:00
Marco Pivetta
2751c0fff2 #1521 DDC-2922 minor code cleanup - renaming internal private methods, variables, removing redundant if/else 2017-08-21 20:08:20 +02:00
Marco Pivetta
87e8bccb11 #1521 DDC-2922 removed redundant integration test that was replaced by a unit test 2017-08-21 19:58:52 +02:00
Marco Pivetta
f39614136f #1521 DDC-2922 reproducing test scenarios within the UnitOfWorkTest 2017-08-21 19:58:16 +02:00
Marco Pivetta
a3208f8d08 #1521 DDC-2922 removed unrelated model usage from test - using minimal models only 2017-08-21 19:47:16 +02:00
Marco Pivetta
e21b29c264 #1521 DDC-2922 simplified test case to a minimum reproducible unit 2017-08-21 19:44:38 +02:00
Darien Hager
b456cffa2d Move final cascade-persist-checking so that it covers not just normal flushes, but also flushes where specific entities are singled out. 2017-08-21 09:08:31 +02:00
Darien Hager
17b996da8c Speculative fix: Defer any errors for missing cascade-persist until object graph has been better-explored 2017-08-21 09:08:31 +02:00
Darien Hager
92dc39bfb9 Add extra assertions to test to ensure that flush actually succeeded in saving all items 2017-08-21 09:08:31 +02:00
Darien Hager
997000352a Add another test to demonstrate the bug doesn't appear if everything is flushed at once. 2017-08-21 09:08:31 +02:00
Darien Hager
6f8a80be79 Move failing unit test into ticket-specific case 2017-08-21 09:08:31 +02:00
Darien Hager
c4465abaa0 Initial failing test-case to demonstrate cascade-persist problem. 2017-08-21 09:08:12 +02:00
Marco Pivetta
ddccd42bb1 Merge pull request #6636 from Kwadz/annot-ref-update
Mention the nullable default value for @column
2017-08-20 08:17:41 +02:00
Richard
9eaf23a5e0 Mention the nullable default value for @column
Related to #6632
2017-08-20 05:57:00 +02:00
Marco Pivetta
a30d8d85ea Merge branch 'fix/#6303-#6304-check-for-null-discriminator-before-hydrating-inheritance-rows'
Close #6303
Close #6304
ge aborts
2017-08-19 18:37:04 +02:00
Marco Pivetta
44f2e22f14 #6303 #6304 documenting why collisions in field name hydration in STI/JTI require additional information and checks in the hydration process 2017-08-19 18:30:33 +02:00
Marco Pivetta
4cbcdb761a #6303 #6304 documenting that the discriminator map order is extremely important for this test 2017-08-19 18:25:44 +02:00
Marco Pivetta
b66643d52e #6303 #6304 removing useless union type usage 2017-08-19 17:49:14 +02:00
Marco Pivetta
42d9162bd5 #6303 #6304 re-enabling disabled test code data 2017-08-19 17:47:12 +02:00
Marco Pivetta
8af68614fc #6303 #6304 correcting type mapping. For simple_array, [] == null (which is bullshit), so we use array here 2017-08-19 17:45:26 +02:00
Marco Pivetta
764ab59882 #6303 #6304 making unnecessary visible fields private 2017-08-19 17:06:27 +02:00
Marco Pivetta
468496be1a #6303 #6304 using strict types in the tests 2017-08-19 17:05:44 +02:00
Marco Pivetta
e18fb6607d #6303 #6304 removing duplicate test details 2017-08-19 17:04:26 +02:00
Marco Pivetta
2ab363ab82 #6303 #6304 adding void hints where applicable 2017-08-19 16:53:41 +02:00
Marco Pivetta
0882b10213 #6303 #6304 simplified tests, removing references to contract naming 2017-08-19 16:51:31 +02:00
Marco Pivetta
328467c226 #6303 #6304 simplified tests, removing references to contract naming 2017-08-19 16:48:50 +02:00
Marco Pivetta
f6ce69fe29 #6303 #6304 minor CS fixes in the test code - alignment/formatting 2017-08-19 16:37:24 +02:00
Marco Pivetta
aaad25a061 #6303 #6304 reverting changes to the OrmFunctionalTestCase 2017-08-19 16:25:20 +02:00
Marco Pivetta
c503b81421 #6303 #6304 removing += operator usage on arrays (scary\!), CS (alignment) 2017-08-19 16:02:30 +02:00
Marco Pivetta
7e7921e32f #6303 #6304 documenting why the loose comparison is required 2017-08-19 15:58:50 +02:00
fullbl
8cc29e84a0 Update AbstractHydrator.php
revert strict comparison in hydration (fails on some dates)
2017-08-19 15:56:59 +02:00
Full
db9c12f1af comparison on discriminator value with !== 2017-08-19 15:56:59 +02:00
fullbl
82db643b4f clarified what's the problem in a comment 2017-08-19 15:56:59 +02:00
Full
4c7286f57b removed trailing spaces 2017-08-19 15:56:59 +02:00
Full
0072054020 moved all test models into test class 2017-08-19 15:56:59 +02:00
Full
0b8e468f06 fix wrong pharenthesis 2017-08-19 15:56:59 +02:00
Full
bf06b7dbbc check if array is set before assigning 2017-08-19 15:56:59 +02:00
Full
ad3b9de4b8 use dataMap also in first test function 2017-08-19 15:56:59 +02:00
Full
6d40859228 added tests on empty values 2017-08-19 15:56:59 +02:00
Full
aac523d155 tests with custom inheritance tree 2017-08-19 15:56:59 +02:00
Marco Pivetta
671fd50725 Merge pull request #6572 from bitwombat/doc_changes
Add additional detail and clarifications on SELECT
2017-08-18 21:45:17 +02:00
Marco Pivetta
1a0bb82e1d Merge pull request #6392 from Jean85/pr_1441_rebased
Correct DQL `INSTANCE OF` to filter all possible child classes
2017-08-18 21:35:54 +02:00
Marco Pivetta
a426808a16 Merge branch 'fix/#6633-#3788-avoid-xml-external-entity-loading-errors-in-xml-mapping-driver'
Close #6633
Close #3788
2017-08-18 21:12:37 +02:00
Marco Pivetta
492fb50744 #6633 #3788 documenting why simplexml_load_file() was not used 2017-08-18 21:08:14 +02:00
Alessandro Lai
c799c6da8b Add new functional test to check usage of INSTANCEOF with multiple parameters 2017-08-18 14:49:56 +02:00
Aljosha Papsch
eb762dea23 XmlDriver: Avoid PHP bug #62577 by avoiding simplexml_load_file.
Doctrine is affected by PHP bug #62577. simplexml_load_file is not
able to load files if libxml_disable_entity_loader(true) has been
called. simplexml_load_file fails with the message:

I/O warning : failed to load external entity "/my/mappings/my_entity.dcm.xml"
in /path-to/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php on line 711

This error occurs even if there are no external entities in the XML file.

Waiting for the PHP bug to be resolved is infeasible, because it is
unresolved since years. Therefore Doctrine needs to circumvent the bug
by replacing simplexml_load_file with simplexml_load_string while getting
the file contents itself. simplexml_load_string is not affected by the
PHP bug.
2017-08-18 14:23:43 +02:00
Alessandro Lai
19bc4991ae Add more CS fixes 2017-08-18 12:35:51 +02:00
Alessandro Lai
9864a5a9b9 Add unit test for HierarchyDiscriminatorResolverTest 2017-08-18 12:11:09 +02:00
Alessandro Lai
5224a89549 Apply various and CS fixes as per review 2017-08-18 11:02:28 +02:00
Alessandro Lai
d4db126bb0 Remove code duplication of the getAllDiscriminators method 2017-08-18 10:17:52 +02:00
Marco Pivetta
60e29b40a0 Merge branch 'fix/#5579-fix-performance-of-single-entity-flush-with-notify-tracking-policy'
Close #5579
2017-08-18 09:30:43 +02:00
Marco Pivetta
496c22db0e #5579 completely removing a changeset when cleaning up 2017-08-18 09:27:47 +02:00
Marco Pivetta
1bf8465f43 #5579 correcting assertion static/instance method usage 2017-08-18 09:25:47 +02:00
Marco Pivetta
ff15a2bc79 #5579 correcting visibility of clearEntityChangeSet, which should be reverted to public 2017-08-18 09:23:28 +02:00
Marco Pivetta
9d7be0f927 #5579 s/clear/cleanup 2017-08-18 09:22:23 +02:00
Marco Pivetta
2921f068b7 #5579 cleaning up postCommitClear implementation 2017-08-18 09:21:53 +02:00
Marco Pivetta
9707701d10 #5579 isolating multi-entity-commit and single-entity-commit scenarios for the tracking policy changeset clearing 2017-08-18 09:15:48 +02:00
Marco Pivetta
df1577db0c #5579 cleaning up test case, adding assertions critical to the understanding of the code 2017-08-18 09:13:56 +02:00
xhuberty
866a424963 Fix issue when using notify tracking policy with multiple flush on entity 2017-08-18 09:07:40 +02:00
Greg Bell
74c83f3cec Fix format and content as-per discussion in PR 2017-08-18 15:20:17 +10:00
Marco Pivetta
5770459bfc #6441 moving expected exception annotations into explicit method calls 2017-08-18 04:44:17 +02:00
Marco Pivetta
94640aca88 Merge pull request #6441 from sensorario/remove-loosely-comparison
Verify that the `fileLockRegionDirectory` passed to the `DefaultCacheFactory` cannot be empty
2017-08-18 04:38:20 +02:00
Marco Pivetta
fda770700a Merge pull request #6579 from Nek-/patch-1
Add string type as possible parameter for between
2017-08-18 04:33:04 +02:00
Marco Pivetta
da109c36b7 Merge pull request #6630 from doctrine/fix/remove-reliance-on-yaml-deprecated-constants
Remove reliance on Symfony\Component\Yaml deprecated constants
2017-08-16 20:52:18 +02:00
Marco Pivetta
40515472c1 Bumping ORM YAML dependency to 3.4+, explicitly forbidding compatibility with older YAML component versions 2017-08-16 20:21:26 +02:00
Marco Pivetta
bb994b9e70 Removing reference to deprecated YAML component constant that is ignored after symfony 3.4 2017-08-16 20:20:22 +02:00
Marco Pivetta
76e2155fb3 Merge branch 'feature/#6593-#5864-export-metadata-should-contain-entity-listeners'
Close #6593
Close #5864
ge aborts
2017-08-16 19:58:23 +02:00
Marco Pivetta
894490c2a0 #6593 #5864 removing incorrect null return value in API marked as string 2017-08-16 19:57:26 +02:00
Marco Pivetta
e1acba3ae4 #6593 #5864 reverted all public/protected API parameter and return type changes
That's still to be considered a BC break, since child classes are broken if incompatible.

Sorry @tPl0ch :-(
2017-08-16 19:53:32 +02:00
Marco Pivetta
9005c5afdd Merge branch 'fix/#6626-skip-proxy-generation-for-embeddable-classes'
Close #6626
Close #6625
2017-08-16 15:23:46 +02:00
Marco Pivetta
71218b66b9 #6626 #6625 minor CS fixes (removed useless assignments) 2017-08-16 15:23:20 +02:00
Issei.M
0bc91f8733 Replace double quote with single quote 2017-08-16 15:23:20 +02:00
Issei.M
de6d932e8c Fix CS / Add annotation 2017-08-16 15:23:20 +02:00
Issei.M
9e837dc53c Skip embeddable classes proxy generation 2017-08-16 15:23:20 +02:00
Marco Pivetta
57a9509dec Merge branch 'fix/#6623-#1515-ensure-abstracthydrator-hydrateall-cleans-up-on-unit-of-work-clear'
Close #6623
2017-08-16 15:10:38 +02:00
Marco Pivetta
ff3c89d8b1 #6623 minor code cleanups (removing useless assignments, array callback syntax) 2017-08-16 15:10:27 +02:00
Marco Pivetta
7024926f10 #6623 splitting test scenario into two bits 2017-08-16 15:07:48 +02:00
Thomas Ploch
e4006e533c [FX] Use single quotes for XML root in XmlExporter 2017-08-16 12:26:33 +02:00
Thomas Ploch
b1e091b0e1 [FX] Looking up PHP internal functions from the root namespace is faster 2017-08-16 12:25:31 +02:00
Thomas Ploch
599865528e [CS] Remove obsolete doc blocks #2 2017-08-16 12:24:37 +02:00
Thomas Ploch
fe88422e68 [CS] Remove obsolete doc blocks 2017-08-16 12:24:00 +02:00
Thomas Ploch
741819f060 Revert "Minor coding style fixes and more docblock removal"
This reverts commit ec3eed68ca.
2017-08-15 10:28:43 +02:00
Thomas Ploch
ec3eed68ca Minor coding style fixes and more docblock removal 2017-08-15 10:17:20 +02:00
Thomas Ploch
b7ae5b4afb Entity listeners are now processed by exporters
The current implementation of the exporters are not taking the entity
listeners into account. I have added test cases for most of the edge
cases I could think of and implemented the Exporter handling.

This PR originates from https://github.com/doctrine/doctrine2/pull/5864,
I was overwhelmed by the amount of conflicts I had to resolve so I
started anew on a clean master HEAD.

Squashed commits:

- Code review aftermath
- Add even more return type declarations
- Added `return null` to methods declared with nullable return types
- Removed unneeded docblocks when types are self-explanatory
2017-08-15 10:08:50 +02:00
Nikolas Tsiongas
f0ed4e87b5 fix AbstractHydrator addEventListener on hydrateAll()
# Conflicts:
#	tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3146Test.php
2017-08-14 00:45:50 +02:00
Marco Pivetta
a0c0d3bf2a Revert "Merge branch 'fix/#6499-#6533-fix-commit-order-calculation-consider-all-join-column-fields'"
This reverts commit 2a58645cb5, reversing
changes made to 6d428c90e2.
2017-08-11 22:29:45 +02:00
Marco Pivetta
2a58645cb5 Merge branch 'fix/#6499-#6533-fix-commit-order-calculation-consider-all-join-column-fields'
Close #6499
Close #6533
2017-08-11 22:17:02 +02:00
Marco Pivetta
1ede3c514f #6499 #6533 simplifying nullable column check - null coalesce operator makes it *SOMEWHAT* more readable (no miracles) 2017-08-11 22:13:20 +02:00
Marco Pivetta
166c5816b6 #6499 #6533 calibrating test so that the association is populated after persistence in some edge cases 2017-08-11 22:10:02 +02:00
Marco Pivetta
25829ea450 #6499 #6533 simplifying test scenario to the bone, adding description of what happened at persistence-level 2017-08-11 22:05:00 +02:00
Marco Pivetta
ebd521c56e #6499 #6533 minor CS fixes in the test 2017-08-11 21:55:02 +02:00
Marco Pivetta
b352cd3e22 #6499 #6533 minor CS fixes in the test 2017-08-11 21:54:30 +02:00
Gabe van der Weijde
da3cd04993 -- Transformed into a minimal example.
-- Processed Ocramius' feedback.
2017-08-11 21:51:17 +02:00
Gabe van der Weijde
db2530d6fd -- Proposed fix due to logic error. 2017-08-11 21:51:17 +02:00
Gabe van der Weijde
16a14f2238 -- Created test for validation issue #6499. 2017-08-11 21:51:17 +02:00
Marco Pivetta
6d428c90e2 Merge branch 'fix/#6464-#6475-correct-SQL-generated-with-JTI-and-WITH-condition'
Close #6464
Close #6475
2017-08-11 21:45:34 +02:00
Marco Pivetta
9ad91ddc1c #6464 #6475 using PHP 7.1 void and string return hints where available 2017-08-11 21:45:23 +02:00
Marco Pivetta
91a5091612 #6464 #6475 cleaning up test - removed invalid fetch join, CS 2017-08-11 21:39:13 +02:00
Stefan Siegl
025ed1147b #6464 code review updates 2017-08-11 21:36:33 +02:00
Stefan Siegl
99fdbf550d generate nested join sql for CTIs, closes #6464 2017-08-11 21:36:33 +02:00
Stefan Siegl
55882ca7a6 #6464 add test 2017-08-11 21:36:33 +02:00
Marco Pivetta
633c8461c8 Merge branch 'fix/#6614-clean-modified-collection-causing-double-dirty-object-persistence'
Close #6613
Close #6614
Close #6616
2017-08-11 21:29:16 +02:00
Marco Pivetta
352b3ba6f6 #6613 #6614 #6616 adding void return type to newly introduced test methods 2017-08-11 21:28:18 +02:00
Marco Pivetta
c2dd274c42 #6613 #6614 #6616 adding void return type 2017-08-11 21:27:09 +02:00
Marco Pivetta
004ac51869 #6613 #6614 #6616 minor performance optimisations around the new restoreNewObjectsInDirtyCollection implementation 2017-08-11 21:14:05 +02:00
Marco Pivetta
3579997531 #6613 #6614 #6616 removing DDC6613 test, which was fully ported to unit tests 2017-08-11 21:11:31 +02:00
Marco Pivetta
a2ca6bbfaf #6613 #6614 #6616 ensuring that the collection is marked as non-dirty if all new items are contained in the initialized ones 2017-08-11 21:09:34 +02:00
Andreas Braun
1174ec6e8a Add failing test for dirty flag 2017-08-11 20:39:03 +02:00
Marco Pivetta
b064fe3d86 #6613 #6614 #6616 removing repeated PersistentCollectionTest chunks of code 2017-08-11 19:08:24 +02:00
Marco Pivetta
93c4064679 #6613 #6614 #6616 initializing a dirty collection that has new items that are also coming from initialization data de-duplicates new and persisted items 2017-08-11 19:02:39 +02:00
Marco Pivetta
04a5b122b0 #6613 #6614 #6616 moved integration test basics to a unit test that verifies basic dirty collection initialization semantics 2017-08-11 18:58:05 +02:00
Marco Pivetta
345cf1acf8 #6613 #6614 correcting broken test that isn't using objects against a PersistentCollection 2017-08-11 15:15:57 +02:00
Marco Pivetta
031e79e726 #6613 #6614 correcting broken test that isn't using objects against a PersistentCollection 2017-08-11 15:14:42 +02:00
Marco Pivetta
d44e6e1a9e #6613 #6614 ensuring that only newly added items that weren't loaded are restored in the dirty state of the collection 2017-08-11 15:13:39 +02:00
Marco Pivetta
1fc7f81741 #6613 #6614 after initialization, the collection should be dirty anyway 2017-08-11 14:47:51 +02:00
Marco Pivetta
5e2257db04 #6613 #6614 adding assertions about collection initialization and dirty status 2017-08-11 14:46:11 +02:00
Marco Pivetta
d2c9b22397 #6613 #6614 removing IDE-generated header 2017-08-11 14:44:28 +02:00
Marco Pivetta
8c4b5a4b71 #6613 #6614 removing phone/user specifics, using ORM naming for associations 2017-08-11 14:44:04 +02:00
Marco Pivetta
80f12ed490 #6613 #6614 correcting column mapping (was integer, should be string), segregating phone creation away 2017-08-11 14:41:32 +02:00
Marco Pivetta
a4e547b691 #6613 #6614 remove superfluous mappings 2017-08-11 14:34:35 +02:00
Marco Pivetta
eca1d6b3ea #6613 #6614 rewrote test logic to be less magic-constant-dependent 2017-08-11 14:27:34 +02:00
Marco Pivetta
c195064ba4 #6613 #6614 CS - applying @group annotation to the test 2017-08-11 14:23:21 +02:00
Marco Pivetta
625f792290 #6613 #6614 removing dedicated DDC6613 model directory 2017-08-11 14:22:31 +02:00
Marco Pivetta
112a402016 #6613 #6614 smashing entity definitions into the test 2017-08-11 14:21:56 +02:00
Marco Pivetta
0a1a84163e #6613 #6614 better test specification - removing useless assertions 2017-08-11 14:20:07 +02:00
Marco Pivetta
594e60d3f7 #6613 #6614 simplifying entity definition - using auto-assigned string identifiers to reduce moving parts 2017-08-11 14:19:01 +02:00
Uladzimir Struts
874d60d8c7 It added the unit test #6613 2017-08-11 13:46:21 +03:00
Marco Pivetta
bbe005837e Merge pull request #6607 from lcobucci/be-strict-with-risky-tests
Be strict with risky tests
2017-08-06 14:40:16 +02:00
Luís Cobucci
b960170fe1 Move test to the right place and add assertions
That test was removed from "performance" group but we forgot to move it
to the correct namespace.

It was also not doing any assertion, which is quite bad.

More info:
- https://github.com/doctrine/doctrine2/issues/3333
2017-08-06 12:51:58 +02:00
Luís Cobucci
27300bf4af Make PHPUnit strict about risky tests 2017-08-06 12:51:16 +02:00
Luís Cobucci
aa13e49fdf Merge pull request #6606 from lcobucci/add-exception-msg
Add message to NonUniqueResultException
2017-08-06 12:28:58 +02:00
Jean Carlo Machado
c2167664fc add test of NonUniqueResultException message presence 2017-08-06 12:08:57 +02:00
Alfredo Costa
8952176c73 Add message to NonUniqueResultException 2017-08-06 12:07:47 +02:00
Marco Pivetta
2b8acb9907 Merge pull request #6601 from martin-georgiev/master
Fix double spacing in "cascade persist missing" exception message
2017-08-03 21:36:58 +02:00
Martin Georgiev
30088fe529 Fix double spacing in exception's message 2017-08-03 11:52:06 +01:00
Marco Pivetta
6744b48bc2 Merge pull request #6598 from mikeSimonson/xml-dtd-improvements2
More refinement of the xml dtd
2017-08-02 23:30:52 +02:00
mike
a54a258866 More refinement of the xml dtd 2017-08-02 22:58:05 +02:00
Marco Pivetta
97914c0f3e Merge pull request #6588 from reypm/master
Updating docs to support for APCu as a cache driver
2017-07-31 17:00:36 +02:00
reypm
40ee7af9c8 Fixing issue in APC driver 2017-07-30 15:31:42 -04:00
reypm
0c30bab776 Adding extra tilde and updating APC references to APCu (APC is deprecated as per http://php.net/manual/en/intro.apc.php) 2017-07-30 14:40:19 -04:00
reypm
5d8dc1757f Updating docs to support for APCu as a cache driver 2017-07-30 12:51:39 -04:00
Marco Pivetta
8149a1dd83 Merge pull request #6581 from Majkl578/travis-stages
Travis enhancements: Use Build Stages, added PHP 7.2
2017-07-25 04:44:41 +02:00
Michael Moravec
dbb0cdea51 Travis enhancements: Use Build Stages, added PHP 7.2 2017-07-25 03:54:04 +02:00
Maxime Veber
03d33ec900 Add string type as possible parameter for between
People may want to enter a date, or simply the parameter name. Linter may report an error while it's a good usage.
2017-07-24 14:23:16 +02:00
Luís Cobucci
84079572f7 Merge pull request #6575 from lcobucci/improvement/move-performance-tests-to-phpbench
Move performance tests to phpbench
2017-07-23 10:46:26 +02:00
Luís Cobucci
e07c90df44 Add PHPBench to Travis-CI matrix
Also separating the execution of the tests from other tools.
2017-07-23 10:30:19 +02:00
Marco Pivetta
cfa9d787fe Removing old ProxyPerformanceTest 2017-07-23 10:16:51 +02:00
Marco Pivetta
f1bc1bbf12 Mocks required by the proxy performance benchmarks 2017-07-23 10:16:50 +02:00
Marco Pivetta
d8140d700a Benchmarking proxy initialization logic 2017-07-23 10:16:49 +02:00
Marco Pivetta
d658364b59 Benchmarking instantiation of proxies 2017-07-23 10:16:48 +02:00
Marco Pivetta
77ce354f18 Removing old UnitOfWorkPerformanceTest 2017-07-23 10:16:47 +02:00
Marco Pivetta
b1bbad3b15 Unit of work changeset computation test 2017-07-23 10:16:46 +02:00
Marco Pivetta
7515dd20f2 Removing old PersisterPerformanceTest 2017-07-23 10:16:45 +02:00
Marco Pivetta
8ec186f095 Removing old inheritance persister test 2017-07-23 10:16:44 +02:00
Marco Pivetta
52402917a0 Benchmarking hydration of a STI 2017-07-23 10:16:43 +02:00
Marco Pivetta
c5a636ebfb Corrected benchmark name: benchmark affects a STI 2017-07-23 10:16:42 +02:00
Marco Pivetta
2692435705 Benchmarking insert operations for a JTI 2017-07-23 10:16:41 +02:00
Marco Pivetta
29f55eaef9 Removing instantiation overhead from benchmark 2017-07-23 10:16:40 +02:00
Marco Pivetta
5401cb5329 Removed old InsertPerformanceTest (moved to benchmark) 2017-07-23 10:16:39 +02:00
Marco Pivetta
d51235f200 Removing useless imports 2017-07-23 10:16:37 +02:00
Marco Pivetta
cbb0c1bd04 Corrected class name - needs to end with Bench 2017-07-23 10:16:36 +02:00
Marco Pivetta
ef0edc8929 Benchmarking simple insert operations (batched) 2017-07-23 10:16:35 +02:00
Marco Pivetta
fd27b22ad1 Removing old HydrationPerformanceTest 2017-07-23 10:16:34 +02:00
Marco Pivetta
93dc028194 Benchmarking full object hydration with fetch joins and mixed values 2017-07-23 10:16:33 +02:00
Marco Pivetta
608b3ed6a4 Benchmarking mixed fetch-join with partial hydration 2017-07-23 10:16:32 +02:00
Marco Pivetta
131aac531a Removing unused $entityManager variable 2017-07-23 10:16:31 +02:00
Marco Pivetta
1e16cb83f8 Full object hydration benchmark 2017-07-23 10:16:30 +02:00
Marco Pivetta
97735cdb68 Partial hydration bench 2017-07-23 10:16:29 +02:00
Marco Pivetta
f23359c1f3 Renaming bench methods, for clarity 2017-07-23 10:16:28 +02:00
Marco Pivetta
0fdcc71887 CS (alignment) 2017-07-23 10:16:27 +02:00
Marco Pivetta
8774b02c88 Testing mixed array hydration (with scalars and fetch-joined results) 2017-07-23 10:16:26 +02:00
Marco Pivetta
d8ddc47f83 Array hydration benchmark 2017-07-23 10:16:25 +02:00
Marco Pivetta
88ea1d33fa Full hydration + query benchmark 2017-07-23 10:16:24 +02:00
Marco Pivetta
f95c81b210 Simple array hydration benchmark 2017-07-23 10:16:23 +02:00
Marco Pivetta
94adf97550 Factory used to create a new entity manager 2017-07-23 10:16:22 +02:00
Marco Pivetta
37cb2c0722 Benchmark autoloading definitions 2017-07-23 10:16:20 +02:00
Marco Pivetta
25669c51b6 PHPBench base config 2017-07-23 10:16:17 +02:00
Marco Pivetta
c8a41598c9 Not a performance test 2017-07-23 10:16:04 +02:00
Luís Cobucci
9826d9c29a Merge pull request #6485 from elt/versionWithCustomTypePrimaryKey
#5804 Versioning doesn't work with a custom type primary key
2017-07-22 23:29:12 +02:00
Luís Cobucci
6bf9f6f72f Remove unnecessary annotation from test 2017-07-22 22:41:07 +02:00
Luís Cobucci
eba8fec1fb Move identifier types extraction to a method 2017-07-22 22:39:47 +02:00
Alessandro Frangioni
60a2628f9d Iteration simplified 2017-07-22 22:26:31 +02:00
Alessandro Frangioni
82c87081b4 Changed SQL declaration for custom type 2017-07-22 22:26:31 +02:00
Alessandro Frangioni
f6907b9503 Applied patches as for #6496 2017-07-22 22:26:31 +02:00
Alessandro Frangioni
4ef0a238bf Inferring id's field types 2017-07-22 22:26:31 +02:00
Alessandro Frangioni
af3591fbca Fixes #5804 2017-07-22 22:26:31 +02:00
Marco Pivetta
1d8c7f9bac Merge pull request #6556 from lcobucci/fix/command-list
Update ConsoleRunner's command list
2017-07-22 22:19:57 +02:00
Luís Cobucci
5109322f7d Make explicit the design decisions of ConsoleRunner 2017-07-22 21:56:59 +02:00
Luís Cobucci
d4b94e097a Ensure that ConsoleRunner has the right command list 2017-07-22 21:56:56 +02:00
Luís Cobucci
2b824ea9df Update ConsoleRunner command list
Adding L2C commands and DBAL reserved words command.
2017-07-22 21:56:42 +02:00
Marco Pivetta
2fb3cfdba2 Merge pull request #6143 from chihiro-adachi/patch-1
fixed #5622 - mysql 5.7 ONLY_FULL_GROUP_BY
2017-07-22 21:41:51 +02:00
Luís Cobucci
5389ad7261 Make LimitSubqueryOutputWalker a bit more readable
Also simplifying the REGEX to remove the ORDER BY type (ASC/DESC) with a
substr() since OrderByItem#type is always defined.
2017-07-22 20:34:18 +02:00
Luís Cobucci
3d5acd607b Bump up doctrine/instantiator version 2017-07-22 19:30:47 +02:00
Luís Cobucci
4a736f48f8 Add MySQL 5.7 to Travis configuration
Following the same setup of doctrine/dbal#2764.
2017-07-22 19:28:29 +02:00
chihiro-adachi
60601a9323 fix query and tests 2017-07-22 19:28:28 +02:00
Martin Kirilov
854ff17ab9 Should fix MySQL 5.7 issues caused by ONLY_FULL_GROUP_BY
Should fix MySQL 5.7 issues caused by ONLY_FULL_GROUP_BY
2017-07-22 19:28:28 +02:00
Greg Bell
624af3df22 Add note clarifying WHERE, WITH and HAVING
- A per Ocramius' explanation in #6563
2017-07-22 17:40:56 +10:00
Greg Bell
80573038ed Add additional detail and clarifications on SELECT
- Also the effect of WHERE on result array.
2017-07-22 17:28:48 +10:00
Marco Pivetta
668ad4cc29 Merge pull request #6550 from alcaeus/fix-persistent-collection-return
Fix return value of removeElement for extra lazy collections
2017-07-22 09:26:15 +02:00
Marco Pivetta
fb3ec7648d Merge pull request #6569 from stoccc/patch-1
Added a test case for postLoad on fetch-joined entities - fetch joined entities should have lifecycle events fired as well
2017-07-21 18:30:38 +02:00
Luís Cobucci
39572a8b6e Merge pull request #6570 from stloyd/patch-1
Prevent Travis-CI failure if xdebug is not available
2017-07-21 11:19:30 +02:00
Joseph Bielawski
247fb6ef0d Prevent Travis-CI failure if xdebug is not available 2017-07-21 11:03:05 +02:00
stoccc
17892bb327 added named parameter and LifecycleCallbackCascader::getId() 2017-07-21 10:47:32 +02:00
stoccc
c47cf1de34 Added a test case for postLoad on fetch-joined entities
see https://github.com/doctrine/doctrine2/issues/6568
2017-07-21 10:33:28 +02:00
Marco Pivetta
63519be69c Merge pull request #6562 from bitwombat/doc_changes
Make minor English fixes.
2017-07-21 02:15:19 +02:00
Greg Bell
34c25a3ee3 Make minor English fixes.
- Remove the apparently dangling text at the bottom of
reference/query-builder.rst
2017-07-19 11:14:46 +10:00
Andreas Braun
45e1817f6f Add test for removing element not in collection 2017-07-13 16:39:06 +02:00
Andreas Braun
260cc6e3e0 Fix return of removeElement on collections
Fixes #5745
2017-07-13 08:16:00 +02:00
Marco Pivetta
e3ecec36ad Merge pull request #6545 from Landerstraeten/patch-1
Fix newline in annotation example in documentation
2017-07-12 08:23:18 +02:00
Lander Vanderstraeten
c678577f8f Fix newline 2017-07-11 13:18:52 +02:00
Luís Cobucci
c32ba8f5d1 Merge pull request #6535 from Majkl578/phpstan
[master] PHPStan integration - levels 0 + 1
2017-07-07 10:36:08 +02:00
Michael Moravec
74c48c201d Push PHPStan to level 1 2017-06-30 00:27:50 +02:00
Ondrej Mirtes
1231861b09 Initial PHPStan integration (level 0) 2017-06-30 00:27:49 +02:00
Alessandro Lai
c7ef9085fb Merge additional fix (and master changes) from taueres/fix-instance-of-subclasses 2017-06-26 09:45:44 +02:00
Sergio Santoro
e91dcf8fb4 Fix discriminator resolution when using parameters 2017-06-24 13:35:44 +02:00
Alessandro Lai
b1f7c59ed5 Adding a failing test case for parameter binding using metadata with INSTANCE OF 2017-06-24 10:58:18 +02:00
Alessandro Lai
2fd8752818 Simplify stubs used in tests 2017-06-24 10:58:18 +02:00
Alessandro Lai
d2f7514248 Put all tests classes in a single namespace 2017-06-24 10:58:18 +02:00
Alessandro Lai
167dfde00f Apply additional fixes to the SqlWalker to fix tests 2017-06-24 10:58:18 +02:00
Alessandro Lai
5181eae8d6 Refactor a bit the SqlWalker modifications 2017-06-24 10:58:18 +02:00
Alessandro Lai
31d2d84160 Fix test 2017-06-24 10:58:18 +02:00
Alessandro Lai
bd47ec95a1 Move tests to ticket namespace (and rename them) 2017-06-24 10:58:18 +02:00
Alessandro Lai
0e88f1b654 Split SqlWalker::walkInstanceOfExpression method 2017-06-24 10:58:18 +02:00
Alessandro Lai
aa233f8e57 Fix small CS issues as per review 2017-06-24 10:58:18 +02:00
Alessandro Lai
04acde667a Fix as per review 2017-06-24 10:58:18 +02:00
Sergio Santoro
7d98135084 [QUERY] "INSTANCE OF" now behaves correctly with subclasses
There was a bug in the "INSTANCE OF" operator as described in
https://groups.google.com/forum/#!topic/doctrine-user/B8raq8CNMgg

"INSTANCE OF" was not taking into account subclasses.
It was merely translating the class to its discriminator.
This is not correct since the class can have subtypes and those
are, indeed, still instance of the superclass.
Also, classes may not have a discriminator (e.g. abstract classes).

This commit also provides useful tests to avoid regression.
2017-06-24 10:58:18 +02:00
Marco Pivetta
388afb46d0 Merge pull request #6245 from lcobucci/l2c-use-getMultiple
Use `getMultiple()` to fetch associations as well in L2 cache fetch operations
2017-06-24 09:17:55 +02:00
Marco Pivetta
5d98247178 Merge pull request #5756 from whyte624/master
s/__tostring()/__toString() in Expr\OrderBy
2017-06-24 04:12:55 +02:00
Marco Pivetta
b66dd0b6fa Merge pull request #5787 from iBet7o/patch-doc
Fix bug: orderBy documentation
2017-06-24 04:05:41 +02:00
Marco Pivetta
807f1422a3 Merge branch 'fix/#1515-clean-hydrator-listeners-on-hydration-end'
Close #1515
2017-06-24 03:41:00 +02:00
Marco Pivetta
995054d884 #1515 dropping DDC-3146 test, which was moved to the hydration tests 2017-06-24 03:40:46 +02:00
Marco Pivetta
0b5d877d5f Migrating #1515 tests to AbstractHydratorTest 2017-06-24 03:40:12 +02:00
Marco Pivetta
067e01e0d7 #1515 cleaning up test case, since the PHPUnit 5.4+ API is much nicer 2017-06-24 03:32:58 +02:00
Marco Pivetta
aba486ea2d #1515 removing redundant assignment, short array notation 2017-06-24 03:27:12 +02:00
Emiel Nijpels
9eb2d6139e DDC-3146 remove event listener from event listener in abstract hydrator in cleanup function 2017-06-24 03:22:12 +02:00
Marco Pivetta
41bcdb3268 Merge pull request #6494 from astepin/gh-6356
Add failing test for #6314  and PR #6356
2017-06-23 12:54:29 +02:00
Marco Pivetta
95b30c1d40 Merge pull request #6515 from lcobucci/use-updated-environment
Use the Travis' Trusty build environment
2017-06-23 11:33:15 +02:00
Luís Cobucci
21ad7a1913 Create schema based on config file (on MySQL & MariaDB) 2017-06-23 11:21:36 +02:00
Alessandro Lai
d4cdc6e1fe Adding a failing test case for parameter binding using metadata with INSTANCE OF 2017-06-22 09:50:53 +02:00
Marco Pivetta
af1ea1ae1d Merge pull request #5623 from Jean85/patch-1
[DOCUMENTATION] Update tests README
2017-06-22 08:03:42 +02:00
Marco Pivetta
379acd9dfd Merge pull request #5734 from amerryma/master
Update tools.rst
2017-06-22 08:02:40 +02:00
Luís Cobucci
e8332a45de Use the Travis' Trusty build environment
To see if that solves the XML validation issues (since the issues are
possibly happening due to old libxml versions).
2017-06-22 08:01:13 +02:00
Luís Cobucci
3df6b7316b Merge pull request #6243 from enumag/patch-3
Fix CountOutputWalker for queries with GROUP BY
2017-06-22 07:16:38 +02:00
Jáchym Toušek
fc609271e0 Fix CountOutputWalker for queries with GROUP BY 2017-06-22 07:09:20 +02:00
Alessandro Lai
ba69cc8f7a Simplify stubs used in tests 2017-06-21 13:25:31 +02:00
Alessandro Lai
8b9c29738d Put all tests classes in a single namespace 2017-06-21 10:26:31 +02:00
Alessandro Lai
11c54b7715 Apply additional fixes to the SqlWalker to fix tests 2017-06-21 10:11:31 +02:00
Alessandro Lai
30256e7a08 Refactor a bit the SqlWalker modifications 2017-06-21 09:34:16 +02:00
Marco Pivetta
b925cce6c4 Merge branch 'docs/#5677-upgrade-getting-started-documentation'
Close #5677
2017-06-21 08:29:31 +02:00
NateC
b446afd937 Updating the Getting Started guide's documentation 2017-06-21 08:29:20 +02:00
Marco Pivetta
9cfdf1ef81 #6325 documenting minor BC break introduced by adding a required parameter to the exception named constructor 2017-06-21 08:20:20 +02:00
Marco Pivetta
9b9128ae77 Merge branch 'improvement/#6325-improve-dql-exception-message-for-single-valued-inverse-association-path'
Close #6325
2017-06-21 08:16:49 +02:00
Marco Pivetta
b21cb3e2a0 #6325 adding IDE hints, type hints, replacing double quotes with single quotes 2017-06-21 08:16:24 +02:00
Tomasz Darmetko
633a442046 Add path expresion to QueryException::associationPathInverseSideNotSupported() 2017-06-21 08:12:04 +02:00
Marco Pivetta
33cee11e6f Merge pull request #6389 from mikeSimonson/xml-dtd-improvements
XSD definition improvements
2017-06-21 08:08:14 +02:00
Marco Pivetta
98aa25b0ea Merge branch 'fix/#5798-undefined-schema-tool-index'
Close #5798
2017-06-21 06:34:57 +02:00
Marco Pivetta
6e9c1d8a4b #5798 adding void test method return declaration, using ::class reference over string reference 2017-06-21 06:34:45 +02:00
Sergey Fedotov
d13327eca2 Fix undefined index for discriminator column in SchemaTool 2017-06-21 06:27:15 +02:00
Marco Pivetta
fe8259a094 Merge branch 'fix/#5715-fix-metadata-filtering-in-cli-tools'
Close #5715
2017-06-21 06:21:52 +02:00
Marco Pivetta
01d226aff0 #5715 removed superfluous mapping information 2017-06-21 06:21:22 +02:00
Marco Pivetta
29fe76cced #5715 short array notation 2017-06-21 06:20:30 +02:00
Marco Pivetta
2ce40a6aeb #5715 s/CLASSNAME/class 2017-06-21 06:18:24 +02:00
Marco Pivetta
f0e403211b #5715 adding return hints \(void\) to test methods 2017-06-21 06:17:18 +02:00
Guilliam Xavier
a9cc522e8a Add regex tests for MetadataFilter (PR #507) 2017-06-21 06:14:01 +02:00
Guilliam Xavier
1afa8a915d Add more basic tests for MetadataFilter 2017-06-21 06:14:01 +02:00
Guilliam Xavier
87e9879edd Fix MetadataFilter not testing filters after first 2017-06-21 06:14:01 +02:00
Guilliam Xavier
652358a4de Add failing test for #5715 (unit test for MetadataFilter) 2017-06-21 06:14:01 +02:00
Marco Pivetta
07a9b10f36 Merge branch 'fix/#6168-#6167-force-nextval-selection-on-the-master-server'
Close #6167
Close #6168
2017-06-21 06:04:34 +02:00
Marco Pivetta
a97c2659fc #6167 #6168 rewrote SequenceGeneratorTest for better readability and error messages 2017-06-21 06:04:06 +02:00
Marco Pivetta
462481ebbe #6167 #6168 - better connection mock documentation/docblocks/return-types 2017-06-21 05:47:19 +02:00
Marco Pivetta
d2be4a2b48 #6167 #6168 - clarifying on the reasoning why query is used instead of fetchColumn 2017-06-21 05:44:58 +02:00
Michał Kurzeja
571115cf18 #6167 Code review updates, better readability 2017-06-21 05:42:26 +02:00
Michał Kurzeja
71b040c849 #6167 - tests - throw exception if wrong method used to get sequence nextval 2017-06-21 05:42:26 +02:00
Michał Kurzeja
edffb4d449 #6167 - fixed tests and added info why query is used in SequenceGenerator 2017-06-21 05:42:26 +02:00
Michał Kurzeja
60b6073643 Fixes #6167 - nextval issue on master-slave PostgreSQL setup 2017-06-21 05:42:26 +02:00
Marco Pivetta
1e3bf6562e Merge branch 'feature/#6162-report-that-subqueries-are-not-allowed-in-from-and-join'
Close #6162
2017-06-21 05:39:01 +02:00
Marco Pivetta
3260d220e8 #6162 adding @group annotation, spacing 2017-06-21 05:38:42 +02:00
Marco Pivetta
a7dcdd8d48 Documenting thrown exception type, spacing #6162 2017-06-21 05:36:13 +02:00
SimonHeimberg
1dbc67cce1 Tests for Subqueries set expectations directly before their occurrence 2017-06-21 05:34:12 +02:00
SimonHeimberg
5b6d766961 Tests for not supported Subqueries in FROM and JOIN 2017-06-21 05:33:28 +02:00
SimonHeimberg
f5d4db7d9c Report that FROM and JOIN do not support Subqueries 2017-06-21 05:31:25 +02:00
Marco Pivetta
7523513be5 Merge pull request #6511 from lcobucci/make-scrutinizer-more-strict
Define build failure conditions on scrutinizer
2017-06-20 17:34:46 +02:00
Luís Cobucci
aa9f34b600 Configure build failure conditions
So that contributors receive some automated feedback in case maintainers
are not fast enough.
2017-06-20 14:06:40 +02:00
Luís Cobucci
1bdc61f932 Remove tools that are not supported anymore 2017-06-20 09:43:43 +02:00
Marco Pivetta
93f617536b Merge pull request #6501 from mpdude/patch-1
Clarify the impact of changing the fetch mode
2017-06-20 07:31:36 +02:00
Marco Pivetta
256091282e Merge pull request #6500 from SamKnows/feature/override-aggregate-functions
Allow internal functions to be overridden.
2017-06-20 07:29:51 +02:00
Mathew Davies
747c1857d6 Make the new aggregate function definitions final. 2017-06-20 07:27:32 +02:00
Mathew Davies
05758f4564 Documented changes in UPGRADE.md 2017-06-20 07:27:30 +02:00
Mathew Davies
49e4b1004c Update LimitSubqueryOutputWalkerTest 2017-06-20 07:27:29 +02:00
Mathew Davies
3e3751cfd9 Remove aggregate function conditional in SqlWalker. 2017-06-20 07:27:27 +02:00
Mathew Davies
966f9a84c2 phpDoc and type hint changes. 2017-06-20 07:27:26 +02:00
Mathew Davies
e4847534a4 Remove @throws in Configuration where necessary. 2017-06-20 07:27:25 +02:00
Mathew Davies
866418e40f No longer treat aggregate functions as a special case. 2017-06-20 07:27:24 +02:00
Mathew Davies
e4ff7a35a8 Write a test case for a custom function override. 2017-06-20 07:27:22 +02:00
Mathew Davies
914c400a7d Check for custom functions first. 2017-06-20 07:27:20 +02:00
Marco Pivetta
e80cd74c3e Merge pull request #6507 from lcobucci/upgrade-dependencies
Upgrade dependencies
2017-06-20 07:18:28 +02:00
Luís Cobucci
ad5014decc Merge pull request #6508 from magnetik/patch-1
[Doc] Fix links to api doc in the second level cache documentation page
2017-06-20 07:09:42 +02:00
Luís Cobucci
9fa456b9f0 Bump versions of some dependencies 2017-06-19 17:43:38 +02:00
Luís Cobucci
e123f16ec9 Require PHP 7.1 2017-06-19 17:43:37 +02:00
Luís Cobucci
99dc8aa2a9 Drop HHVM support 2017-06-19 17:43:16 +02:00
Baptiste Lafontaine
177c48107d Fix links to api doc 2017-06-19 13:31:10 +02:00
Matthias Pigulla
8f9f41ea89 Fix typo 2017-06-15 01:03:38 +02:00
Matthias Pigulla
5a2a771173 Clarify the impact of changing the fetch mode
Seems to work for one-to-many as well, but with a negative performance impact.
2017-06-15 01:02:45 +02:00
Marco Pivetta
fc67b398a1 Merge pull request #6479 from lcobucci/fix-risky-tests
Fix all risky tests
2017-06-13 01:20:57 +03:00
Luís Cobucci
5c02e0c1e8 Remove APC dependency on tests
By using a shared array cache so that we can reproduce different cache
instances that shares the stored data.
2017-06-12 23:05:58 +02:00
Luís Cobucci
a9c711ad7e Register custom types to not skip model set validation
Also removing an empty and unused model set.
2017-06-12 23:05:57 +02:00
Luís Cobucci
ee5f222c58 Rename data provider so that it doesn't get executed as test 2017-06-12 23:05:56 +02:00
Luís Cobucci
8dccd27b52 Add the correct assertions for tests that don't have any 2017-06-12 23:05:55 +02:00
Luís Cobucci
d8663cd9ee Use a more appropriate assertion on some tests 2017-06-12 23:05:54 +02:00
Luís Cobucci
8796e2d938 Expect an exception instead of failing the test
Since that's the assertion we're actually doing.
2017-06-12 23:05:53 +02:00
Luís Cobucci
19fc91482e Validate if optimistic locks are released properly
By trying to update an entry using a different connection.
2017-06-12 23:05:52 +02:00
Luís Cobucci
99df158fc8 Allow passing a connection while creating an entity manager
Also removing unsed arguments.
2017-06-12 23:05:51 +02:00
Luís Cobucci
1bf884970f Increment assertion count manually
Which is needed to test void methods that shouldn't raise any exception
on a certain condition. If the interpreter gets to the point where the
assertion count is incremented it means that no exceptions have been
thrown and our test is successful.

Important to note that some tests were slighly refactored to simplify
things a bit.
2017-06-12 23:04:56 +02:00
Luís Cobucci
8d144daf01 Remove duplicated tests (keeping them on unit test suite only) 2017-06-12 23:04:55 +02:00
Luís Cobucci
043ca69f0b Fix some code style issues in tests 2017-06-12 23:04:54 +02:00
Benjamin Eberlei
3dc0f471fe Merge pull request #6481 from lcobucci/improve-build-extensions
Improve build extensions
2017-06-12 20:45:25 +02:00
Marco Pivetta
c0c08d92ba Merge pull request #6493 from astepin/small-code-improvements
Minor fixes: typos, documentation, etc.
2017-06-11 12:14:30 +03:00
Artem Stepin
799190d5e4 - fixed columnPrefix generator for the embedded annotation 2017-06-09 22:25:19 +02:00
Artem Stepin
351b6972a4 Merge branch 'original-pr-6356' into gh-6356 2017-06-09 21:58:57 +02:00
Artem Stepin
7a63e81c94 Add failing test for gh-#6314 (gh-#6356) 2017-06-08 23:18:47 +02:00
Artem Stepin
43009682a4 minor code work:
- method calls with incorrect case
- removed unused imports
- typos and some other minor code smells
- documentation update (wrong return types etc. )
2017-06-08 22:04:07 +02:00
Marco Pivetta
049ad1e079 Merge pull request #6491 from SamKnows/fix/mock-implementations
Fix Mock Implementations.
2017-06-08 19:06:25 +02:00
Mathew Davies
b42c36f472 Update phpDoc 2017-06-08 16:43:18 +01:00
Mathew Davies
9f13557d14 Be consistent with the rest of the file. 2017-06-08 16:42:11 +01:00
Mathew Davies
633b821e18 Update StatementArrayMock to implement the right interface. 2017-06-08 16:31:59 +01:00
Mathew Davies
a59367423a Update StatementMock to implement the right interface. 2017-06-08 16:25:57 +01:00
Mathew Davies
1559db7ac1 Update HydratorMockStatement to implement the right interface. 2017-06-08 16:25:03 +01:00
Marco Pivetta
971c400025 Merge pull request #6462 from mkosiedowski/proxy-embedded-fields-fix
Fix #6460 - \Doctrine\ORM\Mapping\ClassMetadataInfo::hasField should return true for embedded fields
2017-06-01 15:52:07 +02:00
Luís Cobucci
2359360149 Disable XDebug based on PHPUnit flags instead
Then we don't need to keep changing versions information.
2017-06-01 07:40:28 +02:00
Marco Pivetta
22ecc2d58c Merge pull request #5938 from Ma27/feature/DDC5934-allow-fetch-override
#5934 - add `fetch` option to `AssociationOverride` in order to override fetch strategy for subclasses of entities
2017-05-31 20:24:57 +02:00
Maximilian Bosch
49bb345533 #5934 - #5938 - fix accidentally introduced regression with wrong target of ::class expression 2017-05-31 15:01:25 +02:00
Maximilian Bosch
fcfaa13df9 #5934 - #5938 - use ClassMetadata::class expression rather than FQCN in config drivers as of @Ocramius's review 2017-05-31 14:52:55 +02:00
Maximilian Bosch
92476b5953 #5934 - add fetch option to AssociationOverride in order to override fetch strategy for subclasses of entities 2017-05-30 18:19:48 +02:00
Marco Pivetta
205ee72e33 Merge pull request #6478 from lcobucci/fix-yaml-tests
Fix YAML related tests
2017-05-30 14:05:19 +02:00
Luís Cobucci
f9062d9931 Force YAML parser to convert keys to string
Since Symfony 3.3 implicit conversion is not enabled by default so we
need to pass that flag manually.

Related to: https://github.com/symfony/symfony/pull/21774
2017-05-30 13:53:45 +02:00
Luís Cobucci
f18e178960 Fix wrong YAML mapping
We had duplicated keys and that's no longer valid on symfony/yaml 3.3.
2017-05-30 12:51:51 +02:00
Luís Cobucci
2a239be45e Merge pull request #6466 from fmagnan/patch-1
Update QueryBuilder.php
2017-05-23 18:44:10 +02:00
Franck Magnan
db528a44b1 Update QueryBuilder.php
Hello,

thank you very much for your work, it's awesome!
I found a minor error in PHPDOC for method setParameter. Argument "type" can be a string or null but can be also an int if it comes from \PDO::PARAM_*. So I've changed typehint "string" into "mixed".
2017-05-23 18:42:01 +02:00
Simone Gentili
4bf2e890fb remove loosely comparison 2017-05-23 10:28:45 +02:00
Maciej Kosiedowski
76f0fe45af fixes in tests 2017-05-22 15:52:19 +02:00
Maciej Kosiedowski
f304685c68 Fix #6460 - \Doctrine\ORM\Mapping\ClassMetadataInfo::hasField should return true for embedded fields 2017-05-22 14:41:06 +02:00
Marco Pivetta
6ea30f0354 Merge pull request #6456 from bitwombat/doc_changes
Fixes and clarifications to Association Mapping document
2017-05-21 15:17:40 +02:00
Greg Bell
00aba32c67 Resolve conflicts 2017-05-21 16:56:16 +10:00
Greg Bell
46cebfb33d Clarify concepts, fix minor English issues.
- Globally change 'Shipping' to 'Shipment' - shipment is a noun and thus a clearer name for an object.
- Add definition of unidirectional to the top of the document.
- Explain inversedBy and mappedBy the first time they are used.
- Clarify some ownership and bidirectionality text.
- Minor English and punctuation fixes.
2017-05-21 16:39:06 +10:00
Greg Bell
89bf6152a6 Merge branch 'doc_changes' of https://github.com/bitwombat/doctrine2 into doc_changes 2017-05-21 14:14:52 +10:00
Greg Bell
75821e75f5 Clarify English and a few concepts
- Globally change 'Shipping' to 'Shipment' - shipment is a noun and thus a
clearer name for an object.
- Move definition of unidirectional from example to the top of the document.
- Explain inversedBy and mappedBy the first time they are used.
- Clarify some ownership and bidirectionality text.
- Minor English and punctuation fixes.
2017-05-21 14:14:28 +10:00
Greg Bell
7bfd172156 Clarify English and a few concepts
- Globally change 'Shipping' to 'Shipment' - shipment is a noun and thus a
clearer name for an object.
- Move definition of unidirectional from example to the to of the document.
- Explain inversedBy and mappedBy the first time they are used.
- Clarify some ownership and bidirectionality text.
- Minor English and punctuation fixes.
2017-05-21 14:10:38 +10:00
Marco Pivetta
ee066cc5de Merge pull request #6451 from nicolas-grekas/sf4
Allow Symfony 4.0
2017-05-18 12:59:19 +02:00
Nicolas Grekas
7ce2381bdd Allow Symfony 4.0 2017-05-18 12:57:36 +02:00
Marco Pivetta
334b7e68a7 Merge pull request #6442 from sensorario/performance-improvement
Compute size of loaders in the test suite beforehand, and not on each iteration
2017-05-16 13:40:17 +02:00
Marco Pivetta
95c60219d5 Merge pull request #6446 from eibt/update-docs-theme-submodule
Update theme submodule
2017-05-16 13:21:34 +02:00
Ivan
73770ac090 Update git submodule "docs/en/_theme"
- This fixes the broken image at the footer of Doctrine 2 ORM's docs
2017-05-15 14:53:23 -06:00
Simone Gentili
0a801b895e compute size of loaders beforehand and not on each iteration 2017-05-15 07:43:15 +02:00
Luís Cobucci
e9b54de488 Merge pull request #6439 from sensorario/align-equals-signs
align equals signs
2017-05-14 10:21:42 +02:00
Simone Gentili
fac7e8facb align equals signs 2017-05-13 23:05:37 +02:00
Marco Pivetta
c222c1d17a Merge pull request #6433 from mpdude/patch-1
Remove dead code in the schema tool
2017-05-10 19:31:40 +02:00
Luís Cobucci
2695f5e3a5 Merge pull request #6436 from lcobucci/fix-result-set-cache-eviction
Pass the connections parameters for cache key generation
2017-05-10 18:07:12 +02:00
Luís Cobucci
885c431bd9 Pass the connection parameters for cache key generation
That argument was added to not have key collisions for different
connections.

More info: https://github.com/doctrine/dbal/pull/713
2017-05-10 17:52:38 +02:00
Matthias Pigulla
5c1908d82f Remove dead code
Hopefully this does not do anything...?
2017-05-09 19:21:49 +02:00
Marco Pivetta
7bb02d0dbd Merge pull request #6417 from lcobucci/fix-expire-result-cache
Fix expire result cache
2017-05-03 12:40:33 +02:00
Alessandro Lai
96bcee4fa9 Fix test 2017-05-03 11:42:51 +02:00
Alessandro Lai
21e12ef4a9 Move tests to ticket namespace (and rename them) 2017-05-03 11:06:43 +02:00
Alessandro Lai
11c84c7b20 Split SqlWalker::walkInstanceOfExpression method 2017-05-03 11:00:26 +02:00
Alessandro Lai
3219fe5316 Fix small CS issues as per review 2017-05-03 10:46:24 +02:00
Luís Cobucci
e71272e2b4 Evict result set cache if Query#expireResultCache() was called 2017-05-02 23:25:56 +02:00
bruno da silva
85a52d781e add a not weel writend/nammed test testing Query::expireResultCache() 2017-05-02 23:25:56 +02:00
Marco Pivetta
2c1ebc4ef1 Merge pull request #6416 from lcobucci/fix-quote-on-inheritance
Fix quoting when using inheritance as well
2017-05-02 09:42:03 +02:00
Marco Pivetta
77ee69f1a8 Merge pull request #6367 from SirWaddles/fix-inheritance-alias
Fix inheritance alias
2017-05-02 09:25:18 +02:00
Timothy Clissold
0a10f347d3 Fix inheritance join alias 2017-05-02 00:17:16 +02:00
Luís Cobucci
6c0654c144 Merge pull request #6274 from Necsord/issue/5887-one-to-one-with-custom-id-object-relationship-fix
Fixing #5887 - lazy loading of one-to-one relationship with custom id object
2017-04-30 20:10:37 +02:00
Marcin Szulc
a360da5a7e Fix lazy loading of 1-to-1 relationship with custom id object
Fixing case when lazy loading of entity in one-to-one relationship on the side without foreign key
did not return eht entity because of custom type not being detected and properly formatted before
applying to database query.

Closes https://github.com/doctrine/doctrine2/issues/5887
2017-04-30 19:53:28 +02:00
Luís Cobucci
0aef63b350 Fix quoting also when using inheritance 2017-04-30 19:36:41 +02:00
Luís Cobucci
4ebf27de35 Use "quoted" from existing data if exists
In order to keep that information for inheritance mapping.
2017-04-30 19:36:40 +02:00
Luís Cobucci
942bb6cb1f Remove dead code from OrmFunctionalTestCase 2017-04-30 19:36:39 +02:00
lemartin
7c6c5d87c8 Fix quoting issues related to ticket #6402
Apply quoting strategy to foreign key columns of one-to-one relation so
that correct select statements are generated. And use unquoted column
names in result mapping instead of quoted ones, as consumers (namely
IdentifierFlattener) expect unquoted column names.
2017-04-30 13:51:49 +02:00
Luís Cobucci
ccaa4b8ce1 Use getMultiple() to fetch associations as well 2017-04-30 13:43:29 +02:00
Vytautas Stankus
a557c97a93 Add support for STARTS_WITH and ENDS_WITH comparison operators 2017-04-30 13:19:51 +02:00
Jarek Jakubowski
38bfcc6a7a Fix notice in ClassMetadata when there is no ID Column defined
When you forget about defining the ID/PK Column, then this ugly Notice appear.
Now it will throw nice Exception.
2017-04-30 11:38:47 +02:00
Marco Pivetta
03972c9c3a Merge pull request #6410 from PowerKiKi/patch-2
Minor typo naming strategy documentation
2017-04-23 14:25:39 +02:00
Adrien Crivelli
692a1afa86 Minor typo naming strategy documentation 2017-04-22 00:05:57 +09:00
Alessandro Lai
4eb4465169 Fix as per review 2017-04-18 11:57:49 +02:00
Marco Pivetta
318e9a5596 Merge pull request #6400 from neobyteUK/master
Fix incorrect YAML datetime version field.
2017-04-15 02:23:56 +02:00
Richard Henry
e44a83fc7b Fix incorrect YAML datetime version field. 2017-04-15 01:18:44 +01:00
Marco Pivetta
b88480212a Merge pull request #6399 from neobyteUK/master
Fix incorrect YAML example for versioning a field.
2017-04-15 01:24:06 +02:00
Richard Henry
6b6c300319 Fix incorrect YAML example for versioning a field. 2017-04-15 00:12:53 +01:00
Marco Pivetta
7c5b27da2c Merge pull request #6395 from yannickl88/master
Updated broken links
2017-04-12 23:14:30 +02:00
Yannick de Lange
7e50a965fa Updated broken links
Updated all links pointing to
http://www.doctrine-project.org/documentation/* to their
http://docs.doctrine-project.org counterparts
2017-04-12 23:09:48 +02:00
Sergio Santoro
e798bfe34a [QUERY] "INSTANCE OF" now behaves correctly with subclasses
There was a bug in the "INSTANCE OF" operator as described in
https://groups.google.com/forum/#!topic/doctrine-user/B8raq8CNMgg

"INSTANCE OF" was not taking into account subclasses.
It was merely translating the class to its discriminator.
This is not correct since the class can have subtypes and those
are, indeed, still instance of the superclass.
Also, classes may not have a discriminator (e.g. abstract classes).

This commit also provides useful tests to avoid regression.
2017-04-11 17:50:01 +02:00
mike
0865181702 Do not force an order of definition in the entity elements 2017-04-11 09:43:50 +02:00
mike
b43325760d Add a type for the class FQCN 2017-04-11 09:43:31 +02:00
mike
f537eb2915 Add a table name type that accept quoted table name 2017-04-11 09:43:25 +02:00
chihiro-adachi
2c5e76c961 fix class name. 2017-04-07 14:33:41 +02:00
Marco Pivetta
03b4397557 Merge pull request #6378 from Sam-Burns/phpunit6
PHPUnit 6
2017-04-01 06:49:33 +02:00
Sam-Burns
3d7a7346f7 Quieting risky test warnings where tests do actually perform assertions 2017-03-31 23:23:22 +01:00
Sam-Burns
5bd7bd8d48 Updating to PHPUnit 6 2017-03-31 21:59:02 +01:00
Marco Pivetta
904f4d5021 Merge pull request #6377 from Sam-Burns/minimum-dependencies
Minimum dependencies
2017-03-31 20:46:14 +02:00
Sam-Burns
7aab261c24 Switching to a PHPUnit version that doesn't throw a stty-related PHP warning on Travis 2017-03-31 15:46:04 +01:00
Sam-Burns
f5b4e8c823 Specifying minimum version of doctrine/annotations with which tests pass 2017-03-31 15:24:07 +01:00
Sam-Burns
60cc11461d Bumping doctrine/cache minimum version, to make tests pass 2017-03-31 15:07:53 +01:00
Sam-Burns
f2edf36248 Bumping doctrine/collections minimum version, to make tests pass 2017-03-31 15:07:53 +01:00
Sam-Burns
d6049f8631 Adding breaking build testing with minimum Composer dependencies 2017-03-31 15:07:29 +01:00
Adam Gąsowski
5507e0be29 Fix wrong variable name
Fix $fieldMapping to $embeddedClass in generateEmbeddedPropertyDocBlock
2017-03-23 19:12:40 +01:00
Marco Pivetta
1aa02f9afc Merge pull request #6326 from SenseException/check-option
[Documentation] Add column check-option to documentation
2017-03-12 11:53:13 -04:00
Boris Yonchev
bd1efaf528 DDC-2780 - Fixed issue with IS NULL on join aliases 2017-03-07 18:34:50 +01:00
Claudio Zizza
504e701020 Add existing column check-option to documentation 2017-03-06 00:34:18 +01:00
Marco Pivetta
e4704beaf9 Merge pull request #6287 from lcobucci/fix-test-suite
Fix EntityManagerDecorator tests
2017-02-13 01:46:01 +01:00
Luís Cobucci
dcc80af7d9 Fix EntityManagerDecorator tests
We were expecting a return value for all methods but on 6a56df9a24
we changed some methods to be void and of course that affected the
ORM.
2017-02-12 18:38:21 +01:00
Marco Pivetta
10935dd843 Merge pull request #6285 from svencan/doc-typos
Fix typos and wording in NamingStrategy documentation
2017-02-10 18:55:05 +01:00
Sven Cannivy
260c8d0113 Fix typos and wording in NamingStrategy documentation 2017-02-10 18:48:57 +01:00
Marco Pivetta
23ae83e351 Merge pull request #6268 from enumag/patch-4
Fix annotation
2017-01-31 12:00:42 +01:00
Jáchym Toušek
64ab53a243 Fix annotation 2017-01-31 11:57:01 +01:00
mikeSimonson
e42d0bdda5 Merge pull request #6262 from mikeSimonson/doc
Fix a link to a ref in another page
2017-01-27 09:30:38 +01:00
mike
f3df000d29 Fix a link to a ref in another page 2017-01-27 09:27:25 +01:00
mikeSimonson
5989ea1752 Merge pull request #6260 from mikeSimonson/doc
Document the Custom option of the generated value annotation
2017-01-26 14:12:34 +01:00
Marco Pivetta
888f1be7c9 Merge pull request #6257 from weaverryan/add-criteria-note
Adding a note about the `Doctrine\ORM\QueryBuilder#addCriteria()` method
2017-01-25 16:56:12 +01:00
Ryan Weaver
63bd6c359c [Docs] Adding a note about the addCriteria method on QueryBuilder 2017-01-25 10:52:17 -05:00
mike
773af5b306 Document the Custom option of the generated value annotation 2017-01-25 15:54:03 +01:00
Marco Pivetta
9c76c3766f Merge pull request #6251 from mbeccati/ddc2660-test-fix
Add missing group to DDC2660Test.php
2017-01-24 13:43:59 +01:00
Matteo Beccati
c816d375e8 Add missing group to DDC2660Test.php
With the current PHPUnit version and PHP 7.2/master, the test fails with:

1) Doctrine\Tests\ORM\Functional\Ticket\DDC2660Test::testIssueWithExtraColumn
array_flip(): Can only flip STRING and INTEGER values!

2) Doctrine\Tests\ORM\Functional\Ticket\DDC2660Test::testIssueWithoutExtraColumn
array_flip(): Can only flip STRING and INTEGER values!

Due to the group being NULL vs "" on older PHP versions.

I will also file a bug report or fix to PHPUnit and/or PHP itself, but it sounds
like the missing group was just a typo.
2017-01-24 12:46:19 +01:00
Marco Pivetta
b181228d69 Merge pull request #6250 from johndodev/patch-1
Note on Entity listeners
2017-01-23 09:57:58 +01:00
John
57f560401b Note on Entity listeners
As requested here https://github.com/doctrine/doctrine2/issues/6247#issuecomment-274123780 I thought it should be interesting to note that.
The note could be longer, like "You should avoid to have multiple methods for the same event (e.g. multiple @PrePersist) since the execution order is not guaranteed".
2017-01-23 09:35:26 +01:00
Luís Cobucci
119aa4e46c Merge pull request #6244 from lcobucci/l2c-ensure-root-classname-everywhere
Make sure we're using the rootEntityName on all places
2017-01-20 00:05:48 +01:00
Luís Cobucci
1f53afa9cd Make sure we're using the rootEntityName on all places
Otherwise we might end up with duplicated cache entries and weird
results (specially regarding associations).
2017-01-19 17:24:47 +01:00
Luís Cobucci
4f28aaa206 Refactor to use class_map() instead 2017-01-16 23:22:52 +01:00
Mikhail Polyanin
bb943afabe Optimization. Multiple get in QueryCache 2017-01-16 23:02:23 +01:00
mikeSimonson
247b085fce Merge pull request #6239 from mikeSimonson/travis-update
Travis update
2017-01-16 18:17:36 +01:00
mike
5968b9e62f Removing php 7.1 from the allowed failure 2017-01-16 17:09:49 +01:00
mike
a831bb82ce Adding hhvm as allowed to fail in the test matrix 2017-01-16 17:08:47 +01:00
Marco Pivetta
41a377948b Documenting BC Break introduced by the removal of Doctrine\ORM\Query\SqlWalker#walkCaseExpression()
Ref: https://github.com/doctrine/doctrine2/pull/5600
2017-01-15 23:56:44 +01:00
Marco Pivetta
09cbb9ff48 Merge pull request #5600 from billschaller/remove-dead-code-walk-case-expression
Remove dead code SQLWalker::walkCaseExpression
2017-01-15 23:52:38 +01:00
Marco Pivetta
730db5fd2e Merge pull request #6232 from gadelkareem/patch-3
Allow gearman env vars
2017-01-14 01:18:13 +01:00
Marco Pivetta
3d7ddc89b4 Merge pull request #6231 from gadelkareem/patch-2
Allow gearman environment vars
2017-01-14 01:15:46 +01:00
Waleed Gadelkareem
109ac5f827 Allow gearman env vars 2017-01-13 18:11:10 +01:00
Waleed Gadelkareem
d137ffe0a4 Allow gearman environment vars 2017-01-13 18:09:36 +01:00
Marco Pivetta
31c40f8342 Merge pull request #6216 from malukenho/enhancement/remove-unused-param
Remove unused "$className" argument
2017-01-12 17:04:01 +01:00
Jefersson Nathan
5208187f1a rewording upgrade sentence 2017-01-12 13:02:10 -03:00
Marco Pivetta
9e35d9712d Merge pull request #6227 from ThomasLandauer/patch-3
Minor formatting improvements
2017-01-12 16:13:59 +01:00
Thomas Landauer
4fccf84c82 Added link
Sorry, I don't know how to link to the exact section 8.8
2017-01-12 14:23:55 +01:00
Thomas Landauer
38636e7db4 Minor formatting improvements
Numbered lists aren't displayed nicely, see e.g. http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/working-with-associations.html#persistence-by-reachability-cascade-persist - is this a rendering bug?
2017-01-12 13:59:24 +01:00
Thomas Landauer
63e4eea9e2 Complete re-write of "Transitive persistence / Cascade Operations" (#6219)
Follow-up of https://github.com/doctrine/doctrine2/pull/6171
2017-01-12 12:49:46 +01:00
Jefersson Nathan
df5f480b4c document change as minor BC Break 2017-01-11 17:35:28 -03:00
Marco Pivetta
4e304df495 Merge pull request #6223 from lcobucci/fix-l2c-region-namespace
Appends cache namespace when it exists (for L2C regions)
2017-01-11 11:33:41 +01:00
Luís Cobucci
eaedc37d7b Fix alignment issues on DefaultCacheFactoryTest.php 2017-01-11 11:04:43 +01:00
Luís Cobucci
5a562b3571 Appends cache namespace when it exists (for L2C regions)
We're overriding the namespace without even checking if it was previously
set, what causes problems when people uses that feature 😉
2017-01-11 11:01:39 +01:00
Marco Pivetta
4e573038be Merge pull request #6220 from enumag/patch-2
Fix annotations
2017-01-10 12:50:39 +01:00
Jáchym Toušek
617ec9219e Fix annotations 2017-01-10 09:12:18 +01:00
Marco Pivetta
ce4abdea55 Merge pull request #6171 from ThomasLandauer/patch-3
Include example of a cascaded "persist" operation
2017-01-09 14:08:31 +01:00
Thomas Landauer
7c168c2047 Update working-with-associations.rst
As requested: https://github.com/doctrine/doctrine2/pull/6171#pullrequestreview-15695400
2017-01-09 14:07:17 +01:00
Marco Pivetta
145c44630e Merge pull request #6215 from malukenho/doc/#2190-add-link
Added link to `Transitive Persistence`
2017-01-05 22:22:07 +01:00
Jefersson Nathan
eaeecc3857 Remove unused arguments 2017-01-05 18:21:49 -03:00
Jefersson Nathan
f570eb5922 #2190 — Refer link to proper section and links more occurrence from Transitive Persistence 2017-01-05 12:46:01 -03:00
Jefersson Nathan
a1839048dd #2190 — added link to Transitive Persistence 2017-01-05 11:48:16 -03:00
Luís Cobucci
c86865aa71 Merge pull request #6212 from malukenho/hotfix/#1808-fix-sql-example
Fix wrong DQL example
2017-01-04 07:34:18 +01:00
Jefersson Nathan
8b499a4791 #1808 — Fix wrong DQL example 2017-01-03 21:37:07 -03:00
Marco Pivetta
06691e0150 Merge pull request #6207 from gabidavila/master
Documentation: Fixes missing namespaces on class call
2017-01-02 19:40:44 +01:00
gabidavila
fc8ede844d Fixes missing namespaces on class call 2017-01-02 16:11:46 -02:00
Marco Pivetta
443902f9f9 Merge pull request #6205 from railto/master
Remove support for PHP 5.x
2017-01-02 09:42:07 +01:00
Mark Railton
563c79bd80 Removes support for PHP 5.x 2017-01-02 08:36:42 +00:00
Marco Pivetta
d0c3f961ef Merge pull request #6204 from alcohol/rip-5.6
rip 5.6
2017-01-02 09:28:08 +01:00
Rob Bast
a8d7b327ef rip 5.6 2017-01-02 09:27:34 +01:00
Marco Pivetta
c24a89f4a3 Merge pull request #6197 from BenMorel/patch-2
getSingleScalarResult() returns NULL when the query yields no results
2016-12-26 04:41:20 +01:00
Benjamin Morel
3ce833fb62 getSingleScalarResult() returns NULL when the query yields no results
`NoResultException` is not thrown in this case.
2016-12-26 02:11:50 +01:00
Thomas Landauer
f3909ae885 Update working-with-associations.rst 2016-12-23 20:09:25 +01:00
Marco Pivetta
22b5fb1ad4 Merge pull request #6179 from biggianteye/getting-started-fixes
Minor fixes to the 'getting started' page
2016-12-23 04:03:05 +01:00
Burhan Ali
f64d543d0c Add minor fixes to the 'getting started' page 2016-12-19 03:34:51 +00:00
Thomas Landauer
eecf4382b0 Update working-with-associations.rst 2016-12-18 23:05:10 +01:00
Thomas Landauer
a8a3a8c9e7 Update working-with-associations.rst 2016-12-18 21:58:44 +01:00
Thomas Landauer
1a8eeacfba Update working-with-associations.rst 2016-12-18 21:42:08 +01:00
Marco Pivetta
cd1a5fcadc Merge pull request #6177 from doctrine/fix/#6174-#5570-merging-new-entities-should-also-trigger-prepersist-lifecycle-callbacks
Fix #6174 #5570: merging new entities should also trigger prepersist lifecycle callbacks with merged entity data
2016-12-18 16:42:44 +01:00
Marco Pivetta
21a5d8ca1b #6174 #5570 removed modifications applied to the CompanyContractListener, since UnitOfWorkTest now completely encapsulates the scenarios being covered 2016-12-18 15:48:10 +01:00
Marco Pivetta
cfd595b699 #6174 #5570 removed unused imports 2016-12-18 15:46:49 +01:00
Marco Pivetta
018a5db08f #6174 #5570 renamed entity for better fitting the use-cases it's in 2016-12-18 15:46:34 +01:00
Marco Pivetta
f39f1a2e11 #6174 #5570 removed unused test class 2016-12-18 15:45:03 +01:00
Marco Pivetta
262d13a047 #6174 #5570 adding group annotations to newly introduced test 2016-12-18 15:44:48 +01:00
Marco Pivetta
f4595d3a2f #6174 #5570 prePersist listeners should never be called when entities are merged, but are already in the UoW 2016-12-18 15:43:29 +01:00
Marco Pivetta
30cd2d172b #6174 #5570 started moving tests around prePersist event subscriber triggering on UnitOfWork into the UnitOfWorkTest 2016-12-18 15:37:49 +01:00
Marco Pivetta
9582ffc982 #6174 #5570 CS fixes around the EntityListenersOnMergeTest 2016-12-18 14:53:54 +01:00
Marco Pivetta
00c67ba2db #6174 #5570 adding group annotation to newly introduced tests 2016-12-18 14:47:55 +01:00
Marco Pivetta
0c2edcd08a #6174 #5570 CS - spacing/variable naming 2016-12-18 14:47:16 +01:00
Marco Pivetta
a22f165026 #6174 #5570 removed unused/dead code 2016-12-18 14:45:08 +01:00
Marco Pivetta
ab0e854830 #6174 #5570 CS - spacing 2016-12-18 14:39:46 +01:00
Marco Pivetta
85e2dc8f22 #6174 #5570 CS - spacing 2016-12-18 14:38:10 +01:00
Marco Pivetta
3ce262a61a #6174 #5570 flattened nested conditionals 2016-12-18 14:36:39 +01:00
Marco Pivetta
81d44d4d6e #6174 #5570 documenting thrown exception types 2016-12-18 14:32:31 +01:00
Marco Pivetta
754f36ef65 #6174 #5570 CS - alignment 2016-12-18 14:27:35 +01:00
bilouwan
1be226cf63 Rename test 2016-12-15 15:12:29 +01:00
bilouwan
7f4de25a26 Cherry pick unit test from PR #5570 (Fix PrePersist EventListener when using merge instead of persist) 2016-12-15 13:03:53 +01:00
bilouwan
493d39f5df doMerge will mergeEntityStateIntoManagedCopy BEFORE persistNew to let lifecyle events changes be persisted 2016-12-15 12:49:11 +01:00
bilouwan
d1c8d378cf Create failing test to reveal the issue 2016-12-15 12:47:45 +01:00
Thomas Landauer
879d4e7df0 Update working-with-associations.rst 2016-12-14 21:46:18 +01:00
Thomas Landauer
29062fb42e Update working-with-associations.rst 2016-12-14 21:39:47 +01:00
Thomas Landauer
a06f8d4759 Update working-with-associations.rst 2016-12-14 21:38:10 +01:00
Thomas Landauer
6aa81d1d36 Include example of a cascaded "persist" operation
Following up on https://github.com/doctrine/doctrine2/issues/2943 I started to clarify how it's supposed to be done.

Please check if this would be necessary (at line 511):
`$myFirstComment->setUser($user);`
...and add it (in case).
2016-12-14 00:10:39 +01:00
Marco Pivetta
6e6be3fdd9 Merge pull request #6164 from eyepin/patch-1
Update EntityGenerator.php
2016-12-12 08:30:16 +01:00
Marco Pivetta
24377156b4 Merge pull request #6166 from lcobucci/use-php56-features
Normalise codebase with PHP 5.6 features
2016-12-12 08:03:43 +01:00
Luís Cobucci
ba9fecc43f Remove commented code that seems to not be important 2016-12-08 18:16:11 +01:00
Luís Cobucci
62d122bd54 Remove old "CLASSNAME" constants from test models 2016-12-08 18:15:48 +01:00
Luís Cobucci
fda6fdd9fb Use "::class" syntax on "tests" directory 2016-12-08 18:13:39 +01:00
Luís Cobucci
512aa8a3c7 Use "::class" syntax on "lib" directory 2016-12-08 17:09:35 +01:00
Luís Cobucci
234989d069 Use short-array syntax on "lib" directory 2016-12-08 00:31:12 +01:00
Luís Cobucci
c609072ce1 Use short-array syntax on "bin" directory 2016-12-07 23:34:14 +01:00
Luís Cobucci
74c8a08828 Use short-array syntax on "tests" directory 2016-12-07 23:33:41 +01:00
Luís Cobucci
1d5e16e9d9 Use short-array syntax on "tools" directory 2016-12-07 23:32:17 +01:00
eyepin
521588f498 Update EntityGenerator.php
orm:generate:entities genrates 2 blank lines
PSR2: All PHP files MUST end with a single blank line.

this worked for me
2016-12-07 13:13:21 +01:00
Marco Pivetta
6af1d2843f Bumping doctrine/common dependency to allow ^2.7.1 2016-12-04 06:55:26 +01:00
Marco Pivetta
555e8ae641 Merge branch 'fix/#6017-check-entity-name-in-clear-call-should-be-a-string'
Close #6017
2016-11-27 18:39:55 +01:00
Marco Pivetta
dc3b166811 #6017 replaced random_int() with rand(), since we still support oldstable PHP (5.6.x) 2016-11-27 18:38:57 +01:00
Marco Pivetta
44a6141235 #6017 removed clear($entityName) tests from UnitOfWorkTest: now covered in EntityManagerTest 2016-11-27 18:37:45 +01:00
Marco Pivetta
53c5824a6b #6017 removed clear($entityName) parameter validity checks
The `UnitOfWork` is advanced stuff: don't touch if you don't know what you are doing.
2016-11-27 18:37:45 +01:00
Marco Pivetta
1d7397caf0 #6017 moving entity name validity checks into the EntityManager API, documenting newly thrown exception types 2016-11-27 18:37:45 +01:00
Marco Pivetta
92274124f9 #6017 moving tests around clear() into the EntityManager tests
`UnitOfWork` assumptions are OK, since we don't want to clutter the API even more down there
2016-11-27 18:37:45 +01:00
Marco Pivetta
49333867f8 FQCN reference correction 2016-11-27 18:36:49 +01:00
Marco Pivetta
9894dcb4b0 #6017 clear($proxyClassName) should behave like clear($realClassName) 2016-11-27 18:36:49 +01:00
Marco Pivetta
fdb2af07e7 #6017 hardened clear() logic, which now ensures that persisted entries are correctly cleared 2016-11-27 18:36:49 +01:00
Marco Pivetta
dffd765b1e #6017 requesting clear('nonExistingEntityName') now raises a MappingException 2016-11-27 18:36:48 +01:00
Marco Pivetta
c1038096e0 #6017 requesting clear('nonExistingEntityName') should raise a MappingException 2016-11-27 18:36:48 +01:00
Marco Pivetta
8f77afdc34 #6017 removed unused ORMException::invalidEntityName 2016-11-27 18:36:48 +01:00
Marco Pivetta
754e1f5d42 #6017 throwing an ORMInvalidArgumentException when clearing with non-string data. Also removing duplicate null checking 2016-11-27 18:36:48 +01:00
Marco Pivetta
c97799f151 #6017 expecting an ORMInvalidArgumentException when clearing with invalid data 2016-11-27 18:36:48 +01:00
Marco Pivetta
56598596a4 #6017 adding @group annotation to newly introduced tests 2016-11-27 18:36:48 +01:00
Marco Pivetta
6ad9c9ea04 #6017 test coverage for ORMInvalidArgumentException::invalidEntityName 2016-11-27 18:36:48 +01:00
Marco Pivetta
c4d41fe56a #6017 moved ORMException::invalidEntityName to ORMInvalidArgumentException::invalidEntityName 2016-11-27 18:36:48 +01:00
Jeremy Benoist
6b1d64d484 Remove unecessary persist in tests 2016-11-27 18:36:48 +01:00
Jeremy Benoist
be4aafd4f6 Use ORMException instead of a default exception 2016-11-27 18:36:48 +01:00
Jeremy Benoist
2a7d21ad18 Throw an exception instead of a workaround 2016-11-27 18:36:48 +01:00
Jeremy Benoist
4a87f00fab Avoid error when entityName isn't a string 2016-11-27 18:36:48 +01:00
Marco Pivetta
77a338e0fd Merge branch 'fix/#5935-#5684-#6020-#6152-id-generator-convert-to-custom-dbal-id-type'
Close #5935
Close #5684
Close #6020
Close #6152
2016-11-27 17:49:54 +01:00
Marco Pivetta
cff5c07014 #5935 #5684 #6020 #6152 removed useless NAME constant from the test 2016-11-27 17:49:09 +01:00
Marco Pivetta
73ea0ba8f3 #5935 #5684 #6020 #6152 adding description to the test scenario 2016-11-27 17:45:50 +01:00
Marco Pivetta
e736d19677 #5935 #5684 #6020 #6152 extracted identifier conversion to a private method 2016-11-27 17:42:12 +01:00
Christian Hammerl
0a86c324ad Add test case for autoincremented id of custom type 2016-11-27 01:45:56 +01:00
Renan Gonçalves
52badf1cdd Convert generated id value to its PHP representation.
According to the conversion rules of a specific DBAL mapping type.
2016-11-27 01:43:50 +01:00
Marco Pivetta
4c59ec9282 Merge pull request #5834 from ismailbaskin/patch-1
Fix custom-id-generator class attribute type
2016-11-26 07:04:02 +01:00
Marco Pivetta
dc7c6ed72c Merge pull request #5897 from mikaelz/patch-1
Check for Xcache from INI setting
2016-11-26 06:48:55 +01:00
Marco Pivetta
28025b8230 Merge branch 'cleanup/#5914-cleanup-sql-walker-code'
Close #5914
2016-11-26 06:45:16 +01:00
Marco Pivetta
0ed18fb062 #5914 removed unused conditional inside EntityGenerator, replaced with array_filter() instead 2016-11-26 06:44:53 +01:00
Marco Pivetta
5d477cdbbc #5914 ClassMetadataInfo#$lifecycleCallbacks is a multi-dimensional array 2016-11-26 06:42:46 +01:00
ReenExe
b2f5da19a4 clear code 2016-11-26 06:40:56 +01:00
ReenExe
401300b295 decrease nested if 2016-11-26 06:40:56 +01:00
ReenExe
12465e08ad agree with scrutinizer 2016-11-26 06:40:32 +01:00
Marco Pivetta
89a00860e4 Merge branch 'fix/#6068-docblock-entity-generation-for-nullable-types'
Close #6068
2016-11-26 06:35:33 +01:00
Marco Pivetta
f8002ca27e #6068 hardened test logic to verify that nothing is present after the |null in @var and @return types 2016-11-26 06:35:23 +01:00
Marco Pivetta
a4f76bda34 #6068 corrected nullable field expression generator, made it private to avoid misuse 2016-11-26 06:26:53 +01:00
Marco Pivetta
1d2baedfd5 #6068 simplified variable docblock codegen for nullable instance properties 2016-11-26 06:22:25 +01:00
Marco Pivetta
3341781f52 #6068 inlined code generating expression 2016-11-26 06:20:12 +01:00
Javier Spagnoletti
1dfadef221 Removed surplus semicolon at EntityGenerator::generateFieldMappingPropertyDocBlock() 2016-11-26 06:12:31 +01:00
Javier Spagnoletti
ad6469b64a Update tests 2016-11-26 06:12:31 +01:00
Javier Spagnoletti
087d081601 Fix CS 2016-11-26 06:12:31 +01:00
Javier Spagnoletti
d3c604567b Update docblock generation for nullable fields 2016-11-26 06:12:31 +01:00
Marco Pivetta
c148059593 Merge branch 'fix/#6110-collection-clear-should-also-clear-keys'
Close #6110
2016-11-26 06:06:59 +01:00
Marco Pivetta
20190605a0 #6110 CS (whitespace removal) 2016-11-26 06:06:49 +01:00
Marco Pivetta
9acf170292 #6110 split test into multiple sub-scenarios involving PersistentCollection key checking 2016-11-26 06:02:16 +01:00
Steevan BARBOYON
fa09a95023 Clear $this->collection even when empty, to reset indexes 2016-11-26 05:57:56 +01:00
Marco Pivetta
b06dcb89b3 Merge pull request #5947 from alexryderwhytewaters/patch-1
Missing `ClassMetadataExporter` instantiation in the reverse engineering code samples
2016-11-26 05:47:34 +01:00
Marco Pivetta
f11697361d Merge pull request #5948 from Michal-sk/patch-1
Update association-mapping.rst to ease understanding of what associations mean
2016-11-26 05:46:39 +01:00
Marco Pivetta
a9c2778f30 Merge pull request #6085 from arjank/fix/Call_correct_method_in_test
More specific named native query throw exceptions test
2016-11-26 05:28:28 +01:00
Marco Pivetta
be1fd130f1 Merge pull request #6025 from ywarnier/ywarnier-patch-1
Fix typo in batch-processing doc
2016-11-26 05:26:20 +01:00
Marco Pivetta
a9230b8546 Merge branch 'cleanup/#5987-code-simplifications'
Close #5987
2016-11-26 05:25:01 +01:00
Marco Pivetta
3cd7b8c951 #5987 CS: spacing after ! (not) operator 2016-11-26 05:23:04 +01:00
Marco Pivetta
24da9061b9 #5987 inlined check for boolean 'true' literal 2016-11-26 05:22:43 +01:00
Javier Spagnoletti
e2b198112e [minor] Add missing type hints, add strictness for some checks, remove some useless calls 2016-11-26 05:18:46 +01:00
Marco Pivetta
e7f2e35383 Merge pull request #5977 from gadelat/cleanup-1
Remove unneeded ternary operator from Query::contains
2016-11-26 05:05:37 +01:00
Marco Pivetta
979fede80c Merge pull request #6038 from ReenExeContributor/cleanup-UnitOfWork
remove excess `check`
2016-11-26 04:59:16 +01:00
Marco Pivetta
8c38f5775d Merge pull request #6121 from kalessil/sca
Static Code Analysis with Php Inspections (EA Extended)
2016-11-26 04:57:48 +01:00
Marco Pivetta
899393d3bb Merge pull request #6142 from mbeccati/php72-count-fix
Fix incompatibility w/ PHP7.2+
2016-11-26 04:56:39 +01:00
Marco Pivetta
bfa9a31ad7 Merge pull request #6145 from lcobucci/improve-test-documentation
Improving the documentation of enums as discriminators test
2016-11-23 19:35:20 +01:00
Luís Cobucci
6344fd34cb Improving the documentation of enums as discriminators test
@Ocramius was too eager to merge stuff

Related to: https://github.com/doctrine/doctrine2/pull/6141
2016-11-23 19:20:47 +01:00
Marco Pivetta
7789df39c5 Merge pull request #6141 from lcobucci/object-as-discriminators
Allow using objects as discriminators
2016-11-23 19:14:53 +01:00
Luís Cobucci
1b39cd87ad Allow using objects as discriminators 2016-11-23 18:56:36 +01:00
Marco Pivetta
86fd0c5aa9 Merge pull request #6028 from lcobucci/fix/l2c-inheritance-query-cache
Make child entity share the timestamp region with parent class
2016-11-23 18:06:52 +01:00
Matteo Beccati
39dcf3e4c6 Fix incompatibility w/ PHP7.2+
Mock_ParserResult_*::getParameterMappings() was returning null, which
was then passed to count() on Query.php:308, causing a "Parameter must
be an array or an object that implements Countable" error.
2016-11-22 07:42:06 +01:00
Luís Cobucci
317e86802d Make child entity share the timestamp region with parent class 2016-11-20 19:27:53 +00:00
Marco Pivetta
95d9c64aec Merge pull request #6138 from WhiteEagle88/version-docs
Added examples for version column in the xml and yml formats
2016-11-19 23:04:47 +01:00
Dmytro Boiko
53cd9c4ca8 Added examples for version column in the xml and yml formats 2016-11-19 23:34:10 +02:00
Marco Pivetta
e7856f90d8 Merge branch 'feature/#6136-better-exception-message-on-invalid-connection-object'
Close #6136
2016-11-18 09:21:18 +01:00
Marco Pivetta
d2643eeb8b #6136 Removed regex assertion - constant assertion is sufficient 2016-11-18 09:19:27 +01:00
SpacePossum
e37041aa94 Update message. 2016-11-18 08:06:11 +01:00
Marco Pivetta
f1bf045af3 Merge pull request #6130 from kalimatas/fix-xml-option-boolean
#6129 Added unit test for boolean option values.
2016-11-17 21:24:44 +01:00
Alexander Guz
8d433cdb39 #6129 Fixed code style and @depends in test. 2016-11-17 21:05:58 +01:00
SpacePossum
f9a605f6ca Add details about invalid Connection passed at creation. 2016-11-17 17:23:22 +01:00
Alexander Guz
7bf206adb4 #6129 Moved test to AbstractMappingDriverTest. 2016-11-16 20:01:11 +01:00
Alexander Guz
8580f02c6a #6129 Use User::class to get metadata instead of string. 2016-11-16 18:07:58 +01:00
Alexander Guz
cdf4af5f27 Added unit test for boolean option values.
It fail now. In `XmlDriver::_parseOptions` we need somehow to maintain
a list of options, that are supposed to be boolean, and then call
`$this->evaluateBoolean()` on them.
2016-11-16 17:56:07 +01:00
Marco Pivetta
05e77868ab Merge pull request #6120 from mschroeder/patch-3
Fixed typos regarding the strategy for composite keys (xml mapping)
2016-11-06 18:50:00 +01:00
Vladimir Reznichenko
db375a22cc Static Code Analysis with Php Inspections (EA Extended): revert unsets 2016-11-06 17:58:45 +01:00
Vladimir Reznichenko
0bf3d7f84c Static Code Analysis with Php Inspections (EA Extended) 2016-11-06 14:22:47 +01:00
Martin Schröder
155672af40 Fixed typos regarding the strategy for composite keys (xml mapping reference)
The strategy for composite primary keys must be "NONE" although the id generator class is \Doctrine\ORM\Id\AssignedGenerator. Calling the strategy "ASSIGNED" is misleading.
2016-11-06 14:05:50 +01:00
Marco Pivetta
bd58e4de4f Merge pull request #6119 from mschroeder/patch-2
Fixed typo regarding the id generator mandatory for composite keys
2016-11-06 13:38:50 +01:00
Martin Schröder
3e98fdb082 Fixed typo regarding the id generator mandatory for composite primary keys
The strategy for composite primary keys must be "NONE" although the id generator class is \Doctrine\ORM\Id\AssignedGenerator. Calling the strategy "ASSIGNED" is misleading.
2016-11-06 13:37:07 +01:00
Marco Pivetta
3b6309318b Merge pull request #6014 from photodude/patch-1
As of HHVM 3.15 pgsql is supported, add php 7.1 to tests
2016-11-05 10:03:49 +01:00
mikeSimonson
60a967bb1d Merge pull request #6113 from mikeSimonson/master
Fix documentation
2016-11-03 21:10:41 +01:00
mike
b8b5c2d686 Merge branch 'master' of github.com:doctrine/doctrine2 2016-11-03 20:42:59 +01:00
mike
11c2d815ef Correcting a use statment in the documentation 2016-11-03 20:40:48 +01:00
Marco Pivetta
56741a3fee Merge pull request #6063 from kormik/patch-1
Fix PHP version in readme.
2016-10-27 02:11:19 +02:00
Marco Pivetta
c8df209409 Merge pull request #6065 from adiq/patch-1
Update Autoloader namespace [docs]
2016-10-27 02:10:43 +02:00
Marco Pivetta
fb95116a26 Merge pull request #6101 from malukenho/add-license-checker
Add license checker to the build
2016-10-27 01:16:18 +02:00
Jefersson Nathan
83da3d4b04 Revert "composer require --dev malukenho/docheader"
This reverts commit 81fefb40db.
2016-10-26 13:27:38 -03:00
Jefersson Nathan
5c6ecdcf1b Revert "add license template file"
This reverts commit e4050edb4e.
2016-10-26 13:27:29 -03:00
Jefersson Nathan
dc07fc609e Revert "add license checker to the build"
This reverts commit ca1a9473d3.
2016-10-26 13:27:18 -03:00
Jefersson Nathan
dbe843fc4b remove license from header of test files 2016-10-26 13:24:33 -03:00
Jefersson Nathan
b8a18cd0a1 fix license header inconsistencies 2016-10-25 23:58:42 -03:00
Jefersson Nathan
ca1a9473d3 add license checker to the build 2016-10-25 23:53:17 -03:00
Jefersson Nathan
e4050edb4e add license template file 2016-10-25 23:52:07 -03:00
Jefersson Nathan
81fefb40db composer require --dev malukenho/docheader 2016-10-25 23:51:31 -03:00
Marco Pivetta
26cf90e1c5 Merge pull request #6095 from mschroeder/patch-1
Fixed typo in annotations reference
2016-10-25 05:56:54 +02:00
Marco Pivetta
cf1ba3183d Merge pull request #6089 from damour/master
Remove duplicated enum type comment from declaration.
2016-10-25 05:48:57 +02:00
Garanzha Dmitriy
3861cbf317 Remove duplicated enum type comment from declaration. 2016-10-21 11:30:27 +03:00
Martin Schröder
cdad5a82c5 Fixed typo in annotations reference 2016-10-20 13:32:59 +02:00
Marco Pivetta
d6eddab94f Revert "Merge pull request #6092 from ThomasLandauer/patch-2"
This reverts commit ade3f3a7f3, reversing
changes made to a6e44d9305.
2016-10-18 10:00:10 -07:00
Marco Pivetta
ade3f3a7f3 Merge pull request #6092 from ThomasLandauer/patch-2
Updated a link (hopefully :-)
2016-10-18 09:46:53 -07:00
Thomas Landauer
d3c2c40452 Updated a link (hopefully :-) 2016-10-18 18:21:46 +02:00
Marco Pivetta
a6e44d9305 Merge pull request #6087 from chihiro-adachi/fix-namespace
Fix namespace
2016-10-18 07:12:22 -07:00
chihiro-adachi
42c4938a8b cache -> cached 2016-10-18 12:09:43 +09:00
chihiro-adachi
fb1136cc9a adjust the appearance of the table 2016-10-15 15:47:49 +09:00
chihiro-adachi
03da85e19e fix namespace 2016-10-15 15:41:10 +09:00
Arjan
a4379cc9e2 Fixes named native query test
- Makes sure the correct method is called in the test
- Verifies that the correct method is called by checking the exception message
2016-10-13 22:54:32 +02:00
Marco Pivetta
a353cb81a3 Merge pull request #6080 from ThomasLandauer/patch-1
Fixed typo + added link
2016-10-11 17:02:07 +02:00
Thomas Landauer
277833b487 Fixed typo + added link 2016-10-11 16:59:03 +02:00
Marco Pivetta
47cb963731 Merge pull request #6070 from Dreamlex/master
Update events.rst
2016-10-06 02:40:04 +02:00
alexndlm
fc81760b54 Update events.rst
https://github.com/doctrine/doctrine2/pull/169
2016-10-05 14:16:47 +03:00
Adrian Zmenda
96b3797ad6 Update Autoloader namespace 2016-10-03 12:25:49 +02:00
Tomas Kormanak
974a9f4b9e Fix PHP version in readme. 2016-10-02 22:38:40 +02:00
ReenExe
2ee56a595b remove excess check 2016-09-15 19:41:34 +03:00
Yannick Warnier
05db15f7ee Fix typo in batch-processing doc
See http://www.dictionary.com/misspelling?term=apparant&s=t
2016-09-12 12:22:49 -05:00
Marco Pivetta
cd11723e63 Merge branch 'fix/#5768-#5755-clone-proxy-private-properties-in-multi-level-inheritances'
Close #5768
Close #5755
2016-09-10 20:51:27 +02:00
Marco Pivetta
3fca33bdc4 #5768 #5755 cleaned up test scenario, using new mocking logic as per PHPUnit 5.4+ 2016-09-10 20:45:01 +02:00
Ed Hartwell Goose
67e205b36a Fixes #5755, uses '->getReflectionProperties()' instead of '->getReflectionClass()->getProperties()' to ensure all fields are copied, and adds test to confirm behaviour 2016-09-10 20:37:20 +02:00
Marco Pivetta
22105058fa Merge branch 'fix/#5689-avoid-object-hash-conflicts-due-to-merge-operations'
Close #5689
2016-09-10 20:22:52 +02:00
Marco Pivetta
503b211a22 #5689 removed unused reflection access 2016-09-10 20:19:15 +02:00
Marco Pivetta
f8436b2165 #5689 removed OidReuseTest, which was moved to UnitOfWork tests 2016-09-10 20:15:59 +02:00
Marco Pivetta
75bf197e11 #5689 moved OidReuseTest contents into the UnitOfWork tests 2016-09-10 20:15:33 +02:00
Walt Sorensen
99d704ff45 Drop mariadb: 5.5 tests
reorder matrix so all HHVM tests are at the bottom
2016-09-10 12:15:25 -06:00
Walt Sorensen
29f51b4a26 Remove the last hhvm3.15 tag 2016-09-09 18:00:40 -06:00
Walt Sorensen
1f521d26f3 Set to HHVM latest (currently 3.15 until next release)
Move sudo: false to the top line to be more clear about use of containers as default vs the trusty builds for HHVM
2016-09-09 17:21:03 -06:00
Walt Sorensen
fda2cd7d0e Set all HHVM-3.15 to allowed failure 2016-09-09 15:59:23 -06:00
Walt Sorensen
a879811b6c Fast finish to avoid waiting on allowed failures
Also Allow HHVM 3.15 with pgsql to fail
2016-09-09 15:51:34 -06:00
Walt Sorensen
e52ca954f0 fixing the xdebug error with php 7.1, nightly and HHVM-3.15 2016-09-09 15:42:31 -06:00
Walt Sorensen
d7a0ed0611 pin to HHVM 3.15 and add PHP 7.1
Stop testing against old HHVM 3.9 and test against current LTS 3.15
2016-09-09 15:35:33 -06:00
Mathieu De Zutter
44af69c5d2 Additional assertion to check that unreferenced objects are not in UOW. 2016-09-09 23:22:31 +02:00
Mathieu De Zutter
b8c7d871be Remove old code in comments. 2016-09-09 23:22:31 +02:00
Mathieu De Zutter
01d51bfca3 Avoid conflicts due to spl_object_hash().
When merging an entity with a to-many association, it will store the
original entity data using the object hash of the to-be-merged entity
instead of the managed entity. Since this to-be-merged entity is not
managed by Doctrine, it can disappear from the memory. A new object
can reuse the same memory location and thus have the same object hash.
When one tries to persist this object as new, Doctrine will refuse it
because it thinks that the entity is managed+dirty.

This patch is a very naive fix: it just disables storing the original
entity data in case of to-many associations. It may not be the ideal
or even a good solution at all, but it solves the problem of object
hash reuse.

The test case relies on the immediate reusing of memory locations by
PHP. The variable $user has twice the same object hash, though referring
a different object. Tested on PHP 5.6.17

Without the fix, the test fails on the last line with:
A managed+dirty entity Doctrine\Tests\Models\CMS\CmsUser@[...] can not
be scheduled for insertion.
2016-09-09 23:22:31 +02:00
Walt Sorensen
48dcbe9d35 As of HHVM 3.15 pgsql is supported 2016-09-09 15:18:48 -06:00
Marco Pivetta
3e3bfbf6d8 Merge pull request #6013 from guhelski/fix_typo
Documentation - Fix typo
2016-09-09 21:31:41 +02:00
guhelski
60346e0046 Fix typo 2016-09-09 16:46:35 +02:00
Guilherme Blanco
81f4d3b0fb Merge pull request #6011 from lcobucci/refactor/use-method-instead
Use `ClassMedatada#isIdGeneratorIdentity()` instead of constant to add the ID on query
2016-09-09 10:25:00 -04:00
Luís Cobucci
e43b9e9e3a Use isIdGeneratorIdentity() to add the ID on query
It's quite handy when creating CUSTOM id generators that should also
rely on AUTO_INCREMENT stuff (one can just extend the `ClassMedatadaFactory`
and create a different instance of `ClassMetadata` that overrides that
method).
2016-09-09 07:52:44 +00:00
Marco Pivetta
e7e142ea4a Merge pull request #6010 from phansys/entity_repo_count
Update exception message at `EntityRepository::__call()`
2016-09-08 19:21:06 +02:00
Javier Spagnoletti
5353137617 Update exception message at EntityRepository::__call() 2016-09-08 13:32:06 -03:00
Marco Pivetta
009e94720b Merge branch 'fix/#6001-second-level-cache-query-cache-timestamp-from-region'
Close #6001
2016-09-08 14:02:16 +02:00
Marco Pivetta
d27cffa8e6 #6001 documenting minor BC break in QueryCacheEntry#time type - specific version used 2016-09-08 13:51:21 +02:00
Luís Cobucci
dd476094af The timestamp verification is now done by the validator
So it's useless to keep it here too.
2016-09-08 13:50:06 +02:00
Luís Cobucci
b431332cef Evict query cache when entities are updated 2016-09-08 13:50:06 +02:00
Luís Cobucci
b49026b657 Add timestamp key to QueryCacheKey 2016-09-08 13:50:06 +02:00
Luís Cobucci
16a3a2a132 Use microtime to have more precision on cache time 2016-09-08 13:50:06 +02:00
Marco Pivetta
5eebdcf630 Merge branch 'fix/#6004-#5989-fix-hydration-in-a-joined-inheritance-with-simple-array-or-json-array'
Close #6004
Close #5989
2016-09-08 13:39:10 +02:00
Carl Vuorinen
43d22984ae Add unit test for SimpleObjectHydrator 2016-09-08 13:37:00 +02:00
Carl Vuorinen
d2cbd5e872 PR fixes (public properties & correct letter case in annotations) 2016-09-08 13:37:00 +02:00
Carl Vuorinen
00bbf4f523 Use yoda condition in the null check 2016-09-08 13:37:00 +02:00
Carl Vuorinen
95546d68c5 Fix hydration in a joined inheritance with simple array or json array
SimpleArrayType and JsonArrayType convert NULL value to an empty array, which fails the null check that is used to prevent overwrite
Fixes issue #5989
2016-09-08 13:37:00 +02:00
Carl Vuorinen
12b5e79ff2 Create a failing test for issue #5989
Field with type=simple_array in a joined inheritance gets overridden by empty array in the hydrator
2016-09-08 13:37:00 +02:00
Marco Pivetta
8a87fa2d01 Merge branch 'feature/#6003-count-on-repositories'
Close #6003
2016-09-08 00:56:34 +02:00
Marco Pivetta
c5c56a9dad #6003 clarifying thrown exception 2016-09-08 00:55:49 +02:00
Marco Pivetta
36e9904082 #6003 inlined persister retrieval 2016-09-08 00:55:09 +02:00
Marco Pivetta
e2cba87662 #6003 corrected return type definition 2016-09-08 00:54:49 +02:00
Marco Pivetta
7bf4a65c92 #6003 imported used symbol 2016-09-08 00:53:35 +02:00
Marco Pivetta
de4c854ac9 #6003 removed useless count() call 2016-09-08 00:48:52 +02:00
Marco Pivetta
5e51a985b7 #6003 no default parameter needed 2016-09-08 00:47:39 +02:00
Marco Pivetta
6f79a378d5 #6003 removed useless method parameter count checking duplication 2016-09-08 00:43:29 +02:00
Javier Spagnoletti
61f6b667c0 Remove default clause at EntityRepository::resolveMagicCall() 2016-09-08 00:32:15 +02:00
Javier Spagnoletti
591bae0855 Swap logic from EntityRespository::__call() 2016-09-08 00:32:15 +02:00
Javier Spagnoletti
bea3c653bc Updated docs 2016-09-08 00:32:15 +02:00
Javier Spagnoletti
a90035e81a Expose EntityPersister::count() through EntityRepository::count() 2016-09-08 00:32:15 +02:00
Marco Pivetta
35341769ea Merge pull request #5972 from giginos/patch-1
Wrong return type of getResult()
2016-09-07 23:31:19 +02:00
Marco Pivetta
2814d6e2fa Merge branch 'fix/#5975-fix_hydrating_fetch_join_with_composite_pk'
Close #5975
Close #5762
Close #5776
2016-09-07 23:22:51 +02:00
Marco Pivetta
50f321f2e9 #5975 minor test cleanups 2016-09-07 23:18:39 +02:00
Marco Pivetta
140960ebb1 #5975 short array syntax 2016-09-07 23:17:40 +02:00
Alexander Kurilo
74ec055d57 Use ::class const instead of FQCN string (#5762) 2016-09-07 23:15:00 +02:00
Alexander Kurilo
c6ea8b1129 Remove irrelevant accessors (#5762) 2016-09-07 23:15:00 +02:00
John Keller
3bec698fed add functional test and bug fix for issue #5762 2016-09-07 23:15:00 +02:00
Marco Pivetta
a90f23dfc7 Merge pull request #6005 from cvuorinen/fix-functional-test-query-logger
Improve functional test query logger
2016-09-07 22:35:00 +02:00
Carl Vuorinen
0da6669fac Fix functional test query logger
DebugStack starts queries array from index 1 rather than 0 so the last query was never printed.
Also array params caused an 'Array to string conversion' error
2016-09-03 23:52:34 +03:00
Gabriel Potkány
75f44008d6 Remove unneeded ternary operator from Query::contains 2016-08-16 01:31:46 +02:00
giginos
eb62ae5933 Wrong return type of getResult()
@see https://github.com/doctrine/doctrine2/issues/5971
2016-08-12 16:26:08 +02:00
Marco Pivetta
31a0c02b06 Merge pull request #5713 from OndraM/remove-coveralls
Cleanup no longer used coveralls settings; use scrutinizer badges
2016-07-31 03:19:42 +02:00
Michal-sk
f18d279710 Update association-mapping.rst
Added spoken word examples of the relationship methods
2016-07-21 13:41:21 +02:00
Michal-sk
718ee42e8e Update association-mapping.rst
Added pointers on how to interpret the method names. This helped me to quicker grasp the concept of the Relations and there methods. Added a @var annotation to the `Collection` interface to make it clear that the `$groups` is a child of the `Collection` interface.
2016-07-21 07:39:07 +02:00
Alex Ryder
20fb340375 missing $cme under reverse eng code sample 2016-07-21 13:52:27 +12:00
Marco Pivetta
184f7d3285 Merge pull request #5942 from Erikvv/patch-1
Add @CustomIdGenerator to documentation
2016-07-20 15:25:22 +02:00
Erik van Velzen
b785a8dc02 Add @CustomIdGenerator to documentation 2016-07-18 18:16:34 +02:00
Marco Pivetta
2b47670831 Merge pull request #5931 from bitwombat/tutorial_fix
Clarify language regarding ArrayCollections.
2016-07-12 08:08:26 +02:00
Greg Bell
da43aa2d49 Clarify language regarding ArrayCollections.
See https://groups.google.com/forum/#!topic/doctrine-user/yJ8ABqBP5mI
2016-07-12 16:05:20 +10:00
Marco Pivetta
44feacd327 Corrected SLC test expected query count: since the identity map is now consistently hashing identifiers 2016-07-07 23:46:09 +02:00
Steve Müller
355d2c3d19 Merge pull request #5924 from doctrine/fix/allow-empty-identifier-string-as-proxy-identifier
Allow empty string identifiers
2016-07-07 23:11:54 +02:00
Marco Pivetta
d330da898f Correcting order of deletes: cache_token relies on cache_complex_action 2016-07-07 22:24:37 +02:00
Marco Pivetta
5d12593e70 Rewrote ManyToOne SLC tests to not rely on multi-level auto-generated identifiers
Background:

Test relied on an `A->B->C` association:

 * `A#id` being `B`
 * `B#id` being `C`
 * `C#id` being an auto-generated identifier (post-insert)

This cannot work, because it breaks the UnitOfWork's identity map.
Specifically, no entries for `A` and `B` can exist in the identity map until `C` entries
are persisted (post-insert).

That means that the identifier generator for `A` and `B` should not be an "assigned"
generator, but should instead be a post-insert generator waiting for other entities
to be persisted.

We cannot fix this in ORM 2.x, but we'll need to invent something for 3.x in order to
fix that (directed graph, or caching the order of operations in the metadata graph).
2016-07-07 21:29:10 +02:00
Marco Pivetta
dbcdc1d42a Empty identifiers must be disallowed 2016-07-07 20:57:49 +02:00
Marco Pivetta
0d82128b2e Registering a managed entity with an empty identifier is to be disallowed 2016-07-07 20:57:02 +02:00
Marco Pivetta
7544934158 Removing note that is not valid anymore 2016-07-07 20:39:52 +02:00
Marco Pivetta
1cb8d790b6 Disallowing null as part of the entity identifier 2016-07-07 20:29:00 +02:00
Marco Pivetta
2829174267 Simplified test: invalid entities must make it in the UnitOfWork manually, via registerManaged 2016-07-07 20:28:21 +02:00
Marco Pivetta
5b8b548bd4 When invalid (null) identifiers are provided, an exception should be thrown 2016-07-07 20:08:24 +02:00
Marco Pivetta
9abccba109 When invalid (null) identifiers are provided, an exception should be thrown 2016-07-07 19:58:43 +02:00
Marco Pivetta
da7582d329 Typo fix: s/$booleanTrue/$booleanFalse (C&P mistake) 2016-07-07 19:43:03 +02:00
Marco Pivetta
aa1fda6d5f Checking for boolean true/false identifiers 2016-07-07 19:38:48 +02:00
Marco Pivetta
29d9f344e8 Non-empty composite key identifiers should also be supported 2016-07-07 19:35:39 +02:00
Marco Pivetta
549bfe127c Correcting test case: expecting identifier hashes to support empty strings 2016-07-07 19:34:24 +02:00
Marco Pivetta
12789ee6ca Basic tests around addToIdentityMap with valid string identifiers (empty string allowed) 2016-07-07 19:27:49 +02:00
Marco Pivetta
5761d07c46 Merge pull request #5918 from tonynelson19/master
Make setSQL and setDQL function calls case-sensitive.
2016-07-05 19:50:59 +02:00
Tony Nelson
cd36407f28 Update EntityManager.php 2016-07-05 12:48:00 -05:00
Tony Nelson
1880cbd8b6 Update dql-doctrine-query-language.rst 2016-07-05 12:46:16 -05:00
Marco Pivetta
27e9b49215 Merge pull request #5911 from ReenExeContributor/scrutinizer-clear-code
Scrutinizer clear code
2016-07-05 18:21:08 +02:00
ReenExe
bcc7983934 after review 2016-07-05 19:15:47 +03:00
Marco Pivetta
ab4b761110 Merge pull request #5913 from ReenExeContributor/clear-code-metadata-info
Clear code metadata info
2016-07-05 18:09:18 +02:00
ReenExe
f7c16ab364 remove else 2016-07-03 00:21:00 +03:00
ReenExe
99b1eaaabb clear code - double condition after isset 2016-07-03 00:17:51 +03:00
ReenExe
1dba0b8545 clear code 2016-07-03 00:14:33 +03:00
ReenExe
0e8491a474 clear code 2016-07-03 00:11:44 +03:00
ReenExe
511b27517a refactoring: extract method 2016-07-03 00:10:43 +03:00
ReenExe
a81458a0aa 1. merge conditions
2. convert `if` to `condition`
2016-07-03 00:05:31 +03:00
ReenExe
b108a2af52 merge conditions 2016-07-03 00:01:07 +03:00
ReenExe
f7317d700c logical remove double condition 2016-07-02 23:58:29 +03:00
ReenExe
2301fb3ff2 move common cascades 2016-07-02 23:53:23 +03:00
ReenExe
eccec87796 clear code 2016-07-02 23:47:21 +03:00
ReenExe
c0fc4f1158 use internal function 2016-07-02 23:02:13 +03:00
ReenExe
52b2d9022a use ternary 2016-07-02 23:00:40 +03:00
ReenExe
a7c4ca82fd use ternary 2016-07-02 22:59:16 +03:00
ReenExe
6bf6bae219 clear code 2016-07-02 22:51:44 +03:00
ReenExe
c6675b0ce3 use ternary 2016-07-02 22:42:46 +03:00
ReenExe
db6c593463 clear code 2016-07-02 22:37:12 +03:00
ReenExe
347d1625bc merge conditions 2016-07-02 22:33:23 +03:00
ReenExe
16cddd4693 claar code from Scrutinizer 2016-07-02 22:13:06 +03:00
Marco Pivetta
ffd1465af2 Merge pull request #5910 from ReenExeContributor/clear-code
Code cleanups: early return/internal function usage
2016-07-01 01:05:16 +02:00
ReenExe
8eef0beacb clear code 2016-07-01 01:20:52 +03:00
ReenExe
015ec444c5 use PHP common functions 2016-07-01 01:17:25 +03:00
Marco Pivetta
32ea9112fa Merge pull request #5898 from radmax/patch-1
Typo
2016-06-30 15:08:18 +02:00
Marco Pivetta
b55ef58025 Merge pull request #5902 from holtkamp/patch-1
Fixed typo (serves => servers)
2016-06-26 09:15:21 +02:00
Menno Holtkamp
a3e9529c02 Fixed typo (serves => servers) 2016-06-25 17:29:04 +02:00
radmax
2ab752bfc3 typo 2016-06-22 17:06:16 +02:00
Michal Zuber
7ef3e3a60c Check for Xcache from INI setting
On a shared webhosting the Xcache module is loaded, but it can be disabled with .htaccess `php_flag xcache.cacher Off` which causes issues.
2016-06-22 08:50:36 +02:00
Marco Pivetta
04b48ae12b Merge pull request #5892 from BreiteSeite/5882-documentation
#5882 recommend using latest stable PHP version in the getting started guide
2016-06-20 22:10:15 +02:00
Michael Kühn
58d8b86bd5 #5882 recommend using latest stable PHP version in the getting started guide 2016-06-20 21:17:36 +02:00
Marco Pivetta
8237760c1b Merge pull request #5891 from Chrisp1tv/master
Fix typo in PHPDoc block of QueryBuilder.php
2016-06-20 15:11:54 +02:00
Christopher Anciaux
76badc296a Fix typo in PHPDoc block of QueryBuilder.php 2016-06-20 14:20:36 +02:00
Marco Pivetta
1162440d55 Merge pull request #5837 from foaly-nr1/patch-1
Use constant consistently
2016-06-19 19:41:37 +02:00
Marco Pivetta
8c49ba6128 Merge pull request #5886 from gadelat/remove-unused-variables
removed some unused variables
2016-06-19 18:35:24 +02:00
Gabriel Potkány
56a6505294 removed some unused variables 2016-06-19 14:46:02 +02:00
Marco Pivetta
3dfc180720 Merge branch 'fix/#5867-allow-embeddable-usage-in-inheritance'
Close #5867
Close #4097
Close #4277
2016-06-19 12:44:37 +02:00
Marco Pivetta
18e3cb4440 #5867 @group annotations, describing scenario 2016-06-19 12:44:19 +02:00
Marco Pivetta
aa8cf7bae9 #5867 simplifying test case by inlining all required models into the test case 2016-06-19 12:42:49 +02:00
Luís Cobucci
27f3bc1e2c Allow the usage of embedded objects on parent classes.
The `ClassMetadataInfo` was always using the "current class" to
fetch the reflection of a property even when a field is declared
on the parent class (which causes `ReflectionProperty` to throw
an exception).
2016-06-19 12:35:57 +02:00
Marco Pivetta
b59b966cc2 Merge pull request #5884 from doctrine/cleanup/drop-php-5.5-support
Drop PHP 5.5 support
2016-06-19 09:37:40 +02:00
Marco Pivetta
a9bca86d4d Merge pull request #5885 from doctrine/fix/proxy-failure-fixes
Partially reverting #5860 due to type juggling horrors
2016-06-19 09:37:25 +02:00
Marco Pivetta
d00069e38b Reverting 741da7806c, which was causing issues due to loose type checking
See this example on why the revert is needed: https://3v4l.org/8T34v

Code copied for reference:

```php
<?php

$a = 1;

switch ($a) {
    case "1";
        echo "FUCK YOU, STUPID LANGUAGE!";
        break;
    case 1;
        echo __LINE__;
        break;
}
```
2016-06-19 09:28:12 +02:00
Marco Pivetta
e409c10209 Requiring at least PHP 5.6 as minimum installed PHP version 2016-06-19 08:51:48 +02:00
Marco Pivetta
1610d916a4 Stop testing against PHP 5.5 2016-06-19 08:51:24 +02:00
Marco Pivetta
765e102d01 Merge pull request #5856 from doctrine/fix/#5854-default-query-cache-test-using-wrong-reflection-instance
#5854 workaround to avoid populating Second Level Cache from DQL queries with multiple nested DQL aliases
2016-06-19 08:48:38 +02:00
Marco Pivetta
ed7f658437 Testing against PHP nightly, but allowing it to fail 2016-06-19 08:41:00 +02:00
Marco Pivetta
659f6a3864 Merge pull request #5883 from sebastianbergmann/phpunit-5.4
Make test suite compatible with PHPUnit 5.4.
2016-06-18 16:44:00 +02:00
Sebastian Bergmann
9da83cfae8 Make test suite compatible with PHPUnit 5.4.
* Use createMock() and getMockBuilder() instead of getMock()
* Use expectException() and expectExceptionMessage() instead of setExpectedException()
2016-06-18 13:01:59 +02:00
FabioBatSilva
163dac4a91 #5854 - Fix SLC queries with multiple nested DQL aliases 2016-06-17 00:11:18 -04:00
Marco Pivetta
c834ccf3fa #5854 added PHP 7.1 to the build matrix 2016-06-16 23:00:59 -04:00
Marco Pivetta
be090e2f75 #5854 removing failure caused by a ReflectionProperty being instantiated against the wrong class name in a test 2016-06-16 23:00:59 -04:00
Marco Pivetta
288e3191ce #5854 - simple workaround to avoid populating SLC cache from DQL queries with multiple nested DQL aliases 2016-06-16 23:00:59 -04:00
Marco Pivetta
d3f6c5ec70 Merge pull request #5873 from vudaltsov/patch-1
Update query-builder.rst
2016-06-14 04:39:57 +02:00
Valentin Udaltsov
6ac7480df4 Update query-builder.rst
Removed one brace
2016-06-14 04:32:20 +03:00
Marco Pivetta
81fe6a82b3 Merge branch 'fix/#5858-yaml-exporter-should-only-introspect-join-column-on-owning-association-side'
Close #5858
2016-06-08 13:33:43 +02:00
Thomas Ploch
ea788fb734 Exporters should only inspect joinColumns for owning side in bi-directional OneToOne
rebased commits:

- Added test case for bi-directional OneToOne in YamlExporter
- Only inspect joinColumns for owning side in bi-directional OneToOne in YamlExporter
- Adding bi-directional test case without joinColumn to XmlExporter test
- Same testcase also applied to PhpExporter
- Fixing bi-directional issue in PhpExporter when inspecting joinColumns index
- Implemented @Ocramius suggestions
2016-06-08 13:24:43 +02:00
Marco Pivetta
7e4106d47c Merge pull request #5860 from peter-gribanov/master
Removed hacky switch/case, migrated to if/else and early return statements
2016-06-08 12:39:03 +02:00
Marco Pivetta
9b902263d5 Merge pull request #5863 from tPl0ch/feature-drop-54
Remove EOL PHP 5.4 from `.travis.yml` and `composer.json` - Fixes #5862
2016-06-08 12:36:21 +02:00
Thomas Ploch
650d49ee81 Tightened PHP version constraint in composer.json 2016-06-08 12:19:31 +02:00
Thomas Ploch
68b0060595 Fixing PHP version constraint in composer.json 2016-06-08 12:11:11 +02:00
Thomas Ploch
649ff94b38 Remove EOL PHP 5.4 from .travis.yml - Fixes #5862 2016-06-08 12:08:50 +02:00
Peter Gribanov
fa7799cec1 return check EventManager 2016-06-08 12:24:41 +03:00
Peter Gribanov
c0a87597fa correct code style 2016-06-08 11:47:09 +03:00
Peter Gribanov
0b5b7190d7 not check EventManager 2016-06-08 11:29:43 +03:00
Peter Gribanov
fadd0a338f add createConnection static method 2016-06-08 10:58:44 +03:00
Peter Gribanov
741da7806c change switch/case to if/else 2016-06-08 10:29:39 +03:00
Marco Pivetta
3bc61d5f5e Merge branch 'fix/#5850-clearing-specific-entity-name-should-clear-also-its-entity-insertions'
Close #5850
Close #5849
2016-06-06 00:35:44 +02:00
Marco Pivetta
68c5d761a8 #5849 #5850 minor performance optimization - avoiding get_class() calls on all entity insertions 2016-06-06 00:25:48 +02:00
Marco Pivetta
b9b952ce8a #5849 #5850 renamed clearEntityInsertions to clearEntityInsertionsForEntityName, for clarity 2016-06-06 00:13:39 +02:00
Marco Pivetta
20d86c5b27 #5849 #5850 refactored clearIdentityMapForEntityName to remove useless looping 2016-06-06 00:11:19 +02:00
Marco Pivetta
14e0800293 #5849 #5850 renamed clearIdentityMap to clearIdentityMapForEntityName, for clarity 2016-06-06 00:10:18 +02:00
Marco Pivetta
34d8e00df7 #5849 #5850 correcting test scenario: identity map could not be built with auto-generated identities+persist 2016-06-06 00:08:26 +02:00
Marco Pivetta
313e4a33e5 #5849 #5850 adding group annotations to the newly introduced test case 2016-06-05 23:54:16 +02:00
Rico Humme
beb2641492 Correct naming convention of function. Was confusing otherwise 2016-06-05 23:16:09 +02:00
Rico Humme
4d48781e2b Split of functionality in separate functions 2016-06-05 23:16:09 +02:00
Rico Humme
3df494ddc8 Test Case for Clear entityInsertions for specific entityName 2016-06-05 23:16:09 +02:00
Rico Humme
70603ee3db Clear entityInsertions for specific entityName 2016-06-05 23:16:09 +02:00
Marco Pivetta
90b7450747 Merge pull request #5853 from lcobucci/patch-1
Fix typo
2016-06-05 22:34:07 +02:00
Luís Otávio Cobucci Oblonczyk
2c1818d513 Fix typo 2016-06-05 10:25:08 +00:00
Marco Pivetta
1c2b7c9685 Merge pull request #5813 from jeanCarloMachado/issue_5786
Add embedded and embeddable annotations in annotations reference index
2016-05-26 00:58:40 +02:00
Jonny Schmid
a6eb7f7c96 Use constant consistently 2016-05-25 10:23:03 +01:00
ismail BASKIN
fafb8166f4 Fix custom-id-generator class attribute type
custom-id-generator tag's attribute type must be FQCN. But NMTOKEN type doesn't support backslash character.
2016-05-22 19:36:15 +03:00
Marco Pivetta
b3aa8254e4 Merge pull request #5823 from munkie/unused-code
Optimize imports. Remove full qualified class names. Remove dead code.
2016-05-13 04:47:26 +02:00
Marco Pivetta
2f60d6a1f8 Merge pull request #5817 from primozcigler/master
Added missing - in the in getting started docs.
2016-05-12 07:27:03 +02:00
Primoz Cigler
964d510357 Added missing - in the in getting started docs. 2016-05-11 09:11:55 +02:00
Mikhail Shamin
b173763bbb Remove full qualified class names in tests 2016-05-11 03:00:44 +07:00
Mikhail Shamin
bf322b903d Optimize imports. Remove full qualified class names 2016-05-11 01:55:12 +07:00
Jean Carlo Machado
56daa67f94 add embedded and embeddable annotations in annotations reference index 2016-05-09 22:25:22 -03:00
Maks Rafalko
c5283eea87 Fix typo
`cached` -> `catched`
2016-05-01 15:03:40 +03:00
Guilherme Blanco
59a0410951 Merge pull request #5729 from funivan/patch-1
Fix typo
2016-04-21 11:26:15 -04:00
iBet7o
165722cf05 Fix bug: orderBy documentation 2016-04-17 17:31:48 -05:00
Marco Pivetta
76a5229fac Merge pull request #5771 from teohhanhui/patch-1
Remove note on findBy not supporting entity
2016-04-12 13:39:55 +02:00
Teoh Han Hui
6c2463b905 Remove note on findBy not supporting entity 2016-04-12 15:05:16 +08:00
Andrei Sozonov
2f2236a1d6 fix typo 2016-04-01 15:54:17 +03:00
Guilliam Xavier
60e2224e6b Fix PHP syntax error in composite-primary-keys.rst
Add missing semicolon after `private $year` on line 12 of `Car` class example code to fix `Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting ',' or ';' in [...]/VehicleCatalogue/Model/Car.php on line 14`
2016-03-24 18:08:58 +01:00
Aaron Merryman
b3df49b2f3 Update tools.rst 2016-03-23 18:54:20 -07:00
ivan
01e53ba44a Fix typo 2016-03-21 14:16:07 +02:00
Ondřej Machulda
f06f383a38 Cleanup no longer used coveralls settings 2016-03-12 01:24:56 +00:00
Marco Pivetta
c1943624ab Merge pull request #5686 from mbeccati/build-fix
Fixed test failing due to changes in AnnotationReader
2016-03-04 19:37:47 +01:00
Matteo Beccati
82588c0af9 Fixed test failing due to changes in AnnotationReader
Doctrine\Tests\ORM\Mapping\AnnotationDriverTest::testLoadMetadataForNonEntityThrowsException
Argument 1 passed to Doctrine\Common\Annotations\AnnotationReader::__construct() must be an instance of Doctrine\Common\Annotations\DocParser, instance of Doctrine\Common\Cache\ArrayCache given, called in .../tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php on line 19 and defined

See: https://revive.beccati.com/bamboo/browse/PHP-DOCTR-PHP55-646/test/case/11813971
2016-02-29 11:06:23 +01:00
mikeSimonson
4b45183dbd Merge pull request #5670 from mikeSimonson/doc
Add precision on the time units
2016-02-23 17:15:24 +01:00
Marco Pivetta
6ed05a9670 Merge pull request #5675 from jeanCarloMachado/fix_broken_links_doc
Fixed broken links on getting-started tutorial
2016-02-21 14:44:07 +01:00
Jean Carlo Machado
4c2ced8fee fixed broken links on getting-started tutorial 2016-02-21 10:31:14 -03:00
Marco Pivetta
aef8f63dd0 Merge pull request #5673 from svycka/patch-1
removed unused use statement
2016-02-19 11:38:00 +00:00
Vytautas Stankus
9c320ca64f removed unused use statement 2016-02-19 12:26:53 +02:00
mikeSimonson
1fa71f15d9 Merge pull request #5671 from mikeSimonson/jira-update
Removing section about jira as it has been removed.
2016-02-17 12:13:43 +01:00
mike
38efda33e1 Removing section about jira as it has been removed. 2016-02-17 11:02:19 +01:00
mike
13473e8b4e Add precision on the time units 2016-02-17 10:57:05 +01:00
Guilherme Blanco
9b4c50e81e Final work around entity changeset fix 2016-02-16 05:03:11 +00:00
Guilherme Blanco
b784a04cf7 Fixed only variables should be passed by reference issue 2016-02-16 04:46:34 +00:00
Guilherme Blanco
86cde3a9df Fixed #5605 2016-02-16 03:21:53 +00:00
Guilherme Blanco
d814ad7234 Merge pull request #5668 from petitchevalroux/many-to-many-criteria-fixes
Many to many criteria fixes
2016-02-15 21:07:17 -05:00
Patrick Poulain
9461839d42 Fix PostgreSql Tests 2016-02-15 21:07:09 +01:00
Patrick Poulain
e8296e8e7d Fix ORM Driver Tests 2016-02-15 21:06:34 +01:00
Patrick Poulain
cbde629bf0 Fix MySql Tests 2016-02-15 21:06:01 +01:00
Marco Pivetta
02eaf6a17a Merge pull request #5667 from JeroenDeDauw/ORMException
Add missing @throws tags
2016-02-15 15:38:44 +01:00
jeroendedauw
34dbefaf22 Add missing @throws tags 2016-02-15 15:15:32 +01:00
jeremygiberson@gmail.com
dd64161ece forgot to delete from relational table first 2016-02-14 18:00:15 -07:00
jeremygiberson@gmail.com
cc7ef71a13 added teardown for new cmstag table 2016-02-14 17:48:53 -07:00
jeremygiberson@gmail.com
1e660abeb8 cascade all operations on cmstags 2016-02-14 17:43:58 -07:00
jeremygiberson@gmail.com
3ed64dcec2 changed relation table column name to match 2016-02-14 17:37:25 -07:00
Jeremy Giberson
dd3f67d862 updated manytomany so it maps field names to column names in criteria ordering 2016-02-11 13:39:31 -07:00
Jeremy Giberson
0feaf92348 improve test readability 2016-02-10 20:27:43 -07:00
Jeremy Giberson
ae785757a1 Merge branch 'fix-many-many-criteria' of github.com:petitchevalroux/doctrine2 into many-to-many-criteria-fixes
Conflicts:
	lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php
2016-02-10 20:04:48 -07:00
Jeremy Giberson
0adeade045 merged git@github.com:SammyK/doctrine2.git:many-to-many-order-by-fix 2016-02-10 19:52:03 -07:00
Jeremy Giberson
f0accca99d Merge branch 'DDC-3719-fix' of github.com:jeanCarloMachado/doctrine2 into many-to-many-criteria-fixes 2016-02-10 19:40:45 -07:00
Patrick Poulain
cfeda903e3 Fix many-to-many matching ignoring offset/limit 2016-02-05 11:14:47 +01:00
Jean Carlo Machado
468fe315ba fixed indentation 2016-01-29 10:03:44 -02:00
Jean Carlo Machado
375b0369ae added test of matching non-owing side with criteria 2016-01-28 19:36:52 -02:00
Marco Pivetta
788143dc03 Merge pull request #5634 from alexislefebvre/travis-ci-remove-duplicate-condition
Remove duplicate code in .travis.yml
2016-01-26 23:00:55 +01:00
Alexis Lefebvre
a1ca73d1e1 Remove duplicate code in .travis.yml
The "$TRAVIS_PHP_VERSION != '7.0'" condition was duplicated

See #5580.
2016-01-26 22:28:56 +01:00
Alessandro Lai
1e97cf21e8 Reverting removal of lock tests paragraph; minor fixes 2016-01-20 16:52:13 +01:00
Alessandro Lai
2c70f4edf7 [DOCUMENTATION] Update tests README 2016-01-20 16:42:58 +01:00
Marco Pivetta
a4d84e0cd8 Merge pull request #5599 from zeroedin-bill/fix/5598-having-regression-fix
Fix #5598 issue with /, * in DQL not translating query components properly
2016-01-16 10:29:49 -06:00
Steve Müller
b491e75d64 Merge pull request #5612 from issei-m/patch-2
[Doc] Is it a typo?
2016-01-15 02:48:44 +01:00
Issei.M
5535690b75 [Doc] Fix typo 2016-01-14 19:39:16 +09:00
Bill Schaller
744c308337 Remove dead code SQLWalker::walkCaseExpression 2016-01-08 13:58:02 -05:00
Bill Schaller
55d4f515af Fix issue were identifier operands in /,* arithmetic terms were not checked to see if they're query components 2016-01-08 12:53:05 -05:00
Alessandro Lai
d7e7baf2a2 Regression test: HAVING clause does not translate variable name when used with * and / math operators 2016-01-08 17:56:41 +01:00
Marco Pivetta
196ea2d0c5 Merge pull request #5597 from deeky666/DDC-5596
Fix documentation of schema tool's "save mode"
2016-01-08 16:14:14 +01:00
Steve Müller
f9217cf6f2 fix documentation of schema tool's "save mode"
fixes #5596
2016-01-08 15:37:19 +01:00
Steve Müller
1697293591 Merge pull request #1563 from rawkode/bugfix/incorrect-rollback-method-name
Fixing method name 'rollBack', which was documented as 'rollback'
2016-01-06 11:49:32 +01:00
Steve Müller
22b9574a0f Merge pull request #5591 from doctrine/docs/remove-2-4-from-readme
Removing 2.4 from README
2016-01-06 00:49:59 +01:00
Marco Pivetta
5bd476209d Removing 2.4 from README 2016-01-06 00:48:26 +01:00
Marco Pivetta
ebe11c7bcf Merge pull request #5590 from zeroedin-bill/fix-discriminator-column-defaults
Fix discriminator column defaults
2016-01-05 23:42:56 +01:00
Bill Schaller
8bde0c8a90 Fix AnnotationDriver, XmlDriver, YamlDriver to properly set DiscriminatorColumn defaults for type and length.
Note: Even though the column definition generated for a discriminator column
would eventually default the type to string and length to 255, the docs specify
defaults that should be reflected explicitly in the discriminatorColumn mapping.
2016-01-05 12:32:25 -05:00
Bill Schaller
6963fd8f20 Update docs for @DiscriminatorColumn to indicate that it is optional. 2016-01-05 12:30:29 -05:00
Bill Schaller
d97fad26a5 Add tests to ensure DiscriminatorColumn is optional, and that optional params type and length have proper defaults. 2016-01-05 12:29:49 -05:00
Marco Pivetta
7f16e5bc51 Merge pull request #5585 from mikeSimonson/cpr-year
Replacing the hardcoded year with a function call
2016-01-04 11:06:01 +01:00
mike
50d7ed98ca Replacing the hardcoded year with a function call 2016-01-04 10:47:37 +01:00
Marco Pivetta
b792e959cd Merge pull request #5584 from harikt/patch-2
Fix broken links to blog post.
2016-01-02 18:03:26 +01:00
Hari K T
30eb4646f7 Fix broken links to blog post. 2016-01-02 22:30:32 +05:30
Marco Pivetta
b22cdab1bb Merge pull request #5580 from doctrine/hotfix/move-from-coveralls-to-scrutinizer-coverage
Move from coveralls to scrutinizer coverage
2015-12-29 20:18:34 +01:00
Marco Pivetta
43787447d6 Test suite is SLOOOOOOOOWWWWWW 2015-12-29 17:11:14 +01:00
Marco Pivetta
75957ee3e7 We can safely run coverage reporting on PHP7 only 2015-12-29 17:07:38 +01:00
Marco Pivetta
3e87a1c4b8 Uploading coverage information via ocular.phar 2015-12-29 16:54:36 +01:00
Marco Pivetta
e37e1818c6 Adding scrutinizer-ci config 2015-12-29 16:51:44 +01:00
Marco Pivetta
86e13f9c5d Removing coveralls dependency 2015-12-29 16:47:20 +01:00
Marco Pivetta
5849dec16f Shameless plug 2015-12-29 16:46:59 +01:00
Marco Pivetta
3ca6828544 Allowing doctrine/common 2.6 2015-12-25 15:58:57 +01:00
Marco Pivetta
5e53e92fc5 Merge branch 'hotfix/common-2.6-upgrade-compat' 2015-12-25 15:26:30 +01:00
Marco Pivetta
e0148f14e2 doctrine/common 2.6.0 compat
Less strict assertion - no need to check the exact file name
2015-12-25 15:20:35 +01:00
Marco Pivetta
6e6d3e27ab Common 2.6 compatibility
Internal structure of the ArrayCache has changed, therefore we should fix the tests depending on it instead
2015-12-25 15:10:21 +01:00
Marco Pivetta
eb62e4d6c3 Merge branch 'hotfix/#4884-support-proxy-php7-hints-generation'
Close #4884
2015-12-25 14:46:30 +01:00
Marco Pivetta
7057d3607e #4884 - allow installation of doctrine/common 2.6.x, which allows generating type-hints on proxies 2015-12-25 14:46:11 +01:00
Marco Pivetta
3260291aef Merge pull request #5572 from greg0ire/patch-2
Guess missing words
2015-12-25 14:40:29 +01:00
Grégoire Paris
f9715ac24a Guess missing words 2015-12-22 17:44:00 +01:00
Marco Pivetta
24e4215ab3 Merge pull request #5557 from malukenho/enhancement/remove-unecessary-namespace-use-and-import
Remove unnecessary namespaces imports and usage
2015-12-16 10:50:51 +01:00
Jefersson Nathan
156075682f Remove unnecessary namespaces imports and usage 2015-12-16 05:45:55 -03:00
Marco Pivetta
6099e45eef Merge branch 'hotfix/#1572-target-entity-resolver-dql-with-interfaces-support-2.6.x'
Close #1572
2015-12-11 21:34:57 +01:00
Marco Pivetta
0c6b510c2a #1572 - test coverage - interfaces should also resolve to target entities when in DQL 2015-12-11 21:34:11 +01:00
oprokidnev
e390dbd5ba Target entity resolver for DQL
Since we have target entity resolver in doctrine this class check is not enought.
To gain interface resolution it is better to add interface check in addition to class_check here.
2015-12-11 21:33:59 +01:00
Marco Pivetta
b341d5c453 Merge pull request #5548 from doctrine/cleanup/classmetadata-get-column-names-simplification
Cleanup - `ClassMetadataInfo#getColumnNames()` simplification
2015-12-11 21:20:12 +01:00
Marco Pivetta
044b202379 Simplifying getColumnNames logic (can be an array_map call) 2015-12-11 20:50:18 +01:00
Marco Pivetta
b2a6f8aa0e Adding test case for fetching column names by field names 2015-12-11 20:48:59 +01:00
Marco Pivetta
276a22fb6f Merge branch 'cs/#1228-minor-php-cs-fixes'
Close #1228
2015-12-11 20:32:28 +01:00
Jeroen Thora
6dcb97a20e Fixed many small phpcs issues 2015-12-11 20:30:41 +01:00
Marco Pivetta
0a1fa8920e Merge pull request #1396 from Padam87/embeddable_docs
[Documentation] Initializing embeddables doc
2015-12-11 20:24:44 +01:00
Marco Pivetta
3971e8c55b Merge branch 'hotfix/#1573-merge-associated-versioned-entity'
Close #1573
2015-12-11 20:17:05 +01:00
Marco Pivetta
996db42029 #1573 - correcting test asset namespace, removing unused properties and bi-directional association 2015-12-11 20:14:53 +01:00
Marco Pivetta
cf3a54ab95 Removing empty newline 2015-12-11 20:00:59 +01:00
Marco Pivetta
16baa8d60f #1573 - correcting docblock arguments/description 2015-12-11 20:00:08 +01:00
Marco Pivetta
41235f61de #1573 removing unused API 2015-12-11 19:59:08 +01:00
Marco Pivetta
21a250fc02 Merge pull request #1472 from PowerKiKi/mariadb
Add test for MariaDB 5.5 and 10.1 on Travis
2015-12-11 19:45:09 +01:00
Marco Pivetta
9ac7c3bf70 Merge pull request #5547 from doctrine/hotfix/php7-xdebug-incompatibility-fixes
Correcting minor test case incompatibility with XDebug 2.4.x
2015-12-11 19:39:43 +01:00
Marco Pivetta
342ab2f7f1 Correcting minor test case incompatibility with XDebug 2.4.x
In PHP 5.x + XDebug < 2.4, the output would be "string:..."
In PHP 7.x + XDebug >= 2.4, the output would be "the/file/name.php:11:string:..."

This is an improvement in XDebug that is quite annoying for our purposes, but is actually welcome to most users anyway.

This commit simply fixes that incompatibility
2015-12-11 19:15:48 +01:00
Marco Pivetta
84f2bf7204 Merge branch 'docs/#1497-update-orm-documentation-for-utc-datetime-type'
Close #1497
2015-12-11 18:53:28 +01:00
Marco Pivetta
8c086d1a6e #1497 - minor CS fixes 2015-12-11 18:53:18 +01:00
Marco Pivetta
df129635cf #1497 - simplifying UTC datetime handling logic in the examples
Highly performance sensitive code should avoid method calls, sadly
2015-12-11 18:52:26 +01:00
Marco Pivetta
a130ff96ba #1497 - Using a PHP code block to describe how a datetime+utc type can be set up 2015-12-11 18:48:23 +01:00
Marco Pivetta
5b22e59383 Removing symfony-specific documentation 2015-12-11 18:43:53 +01:00
Marco Pivetta
624fcb4486 Merge branch 'docs/#1496-docblock-fixes'
Close #1496
2015-12-11 18:27:36 +01:00
Marco Pivetta
00718f6bf7 #1496 s/$this/self 2015-12-11 18:27:19 +01:00
Damien Gavard
9b4dadade0 Use @return $this instead of @return static for consistency 2015-12-11 18:22:26 +01:00
Damien Gavard
5687347d60 Fix invalid return type documentation 2015-12-11 18:22:26 +01:00
Damien Gavard
15aafaa11d Use @return $this instead of return explicitly QueryBuilder 2015-12-11 18:22:26 +01:00
Damien Gavard
8d62aadf55 Fix invalid return type in docblock 2015-12-11 18:22:26 +01:00
Marco Pivetta
b1bf57db48 Merge pull request #1408 from baileylo/patch-1
[doc] Remove unused variable from sample code
2015-12-11 18:19:26 +01:00
Marco Pivetta
9e68a5adc7 Merge pull request #1579 from aschempp/proxy-initialized-cs
Reduce code duplication in ProxyFactory::createInitializer
2015-12-11 18:16:53 +01:00
Benjamin Eberlei
a6ddac0a96 Remove link to issue tracker 2015-12-08 22:51:45 +01:00
Marco Pivetta
bd94931201 Merge pull request #1574 from Ma27/patch-1
deduplication of internal UnitOfWork methods
2015-12-08 19:02:28 +01:00
Andreas Schempp
4df7699ced Reduce code duplication in ProxyFactory::createInitialized
The only difference between the ~30 lines in the IF-statement
is that the __wakup method is called on the proxy object.
2015-12-06 14:56:36 +01:00
bilouwan
fb4d02c69b Refactor testing Proxy not initilized 2015-12-04 14:49:01 +01:00
StoshSeb
da4a29c0e2 Fixed DDC-3740
The count must return an integer, not a string
2015-12-03 13:15:12 +01:00
bilouwan
d2cbdd1866 Fix superflous whitespaces & empty lines 2015-12-02 14:09:14 +01:00
Maximilian Bosch
f840f0d464 DDC-4022 execute callback parameter directly instead of using call_user_func 2015-12-01 22:31:27 +01:00
Maximilian Bosch
11f9b00d53 DDC-4022 method naming 2015-12-01 22:31:26 +01:00
Maximilian Bosch
33476d8c34 DDC-4022 minor improvements 2015-12-01 22:31:25 +01:00
Maximilian Bosch
c337f8f5c7 DDC-4022 deduplication of internal UnitOfWork methods
the methods UnitOfWork#afterTransactionRolledBack() and UnitOfWork#afterTransactionComplete do almost the same, so it can be abstracted into another private method.
2015-12-01 22:31:25 +01:00
Guilherme Blanco
3c3b7364ba Hotfix for missing reverse dependency in case of non-implicit change tracking policies 2015-12-01 20:24:16 +00:00
Guilherme Blanco
9b77ba2c1a Merge pull request #1570 from doctrine/DDC-2524
[RFC] Tests around reported cases over DDC-2524
2015-12-01 00:27:34 -05:00
David McKay
3c7d92e4cc Fixed incorrect case of another two references of rollback 2015-11-30 16:53:31 +00:00
bilouwan
e8f40f58a1 Fix compatibility with php5.4 2015-11-30 10:35:42 +01:00
Guilherme Blanco
8ea62b95b8 Tests around reported cases over DDC-2524 2015-11-27 18:44:23 +00:00
bilouwan
832adae6b4 Unit test & fix for merge versionned entity 2015-11-27 17:28:45 +01:00
Guilherme Blanco
599f99471e Merge pull request #1571 from montaniasystemab/patch-1
Fixed typo in QueryBuilder->where() docblock
2015-11-26 15:30:56 -05:00
montaniasystemab
b48fca543c Fixed typo in QueryBuilder->where() docblock 2015-11-26 10:01:29 +01:00
Guilherme Blanco
57b22bd646 Merge pull request #1568 from guiwoda/patch-ddc-3967
Identifier is cached with wrong type
2015-11-24 22:17:59 -05:00
Guido Contreras Woda
e3627f1886 Test that reflects the issue described in http://www.doctrine-project.org/jira/browse/DDC-3967 2015-11-24 10:35:31 -03:00
Marco Pivetta
b980e98ba3 Merge pull request #1566 from BenMorel/typofix
Fix typos in DQL doc
2015-11-23 14:27:26 +01:00
Benjamin Morel
6d8778fd69 Fix typos in DQL doc 2015-11-23 12:18:18 +01:00
David McKay
f8ba3a3434 Fixing method name 'rollBack', which was documented as 'rollback' 2015-11-21 18:18:56 +00:00
Guilherme Blanco
3cff0f88bd Merge pull request #1562 from deeky666/fix-empty-expression
Fix empty expression on PHP 5.4
2015-11-19 10:45:21 -05:00
Steve Müller
e0cb90d426 fix empty expression on PHP 5.4 2015-11-19 16:43:33 +01:00
Marco Pivetta
9c5cea3e95 Merge pull request #1561 from deeky666/DDC-4006
[DDC-4006] Inherit ID generator strategy mapping from embeddables
2015-11-19 16:34:32 +01:00
Guilherme Blanco
22e76e8624 Merge pull request #1559 from guiwoda/wrong-entity-cache-read-inheritance
Entity cache key is built differently on read than on write
2015-11-19 10:30:37 -05:00
Steve Müller
86c81da7ce inherit ID generator strategy mapping from embeddables 2015-11-19 16:10:48 +01:00
Guido Contreras Woda
6c96e23a47 Test to verify the bug and the fix 2015-11-19 12:02:51 -03:00
Guilherme Blanco
0b45d96c74 Merge pull request #1560 from gitname/patch-2
Fix broken links
2015-11-17 21:40:13 -05:00
gitname
001d5b7ed3 Fix relative links
Fix 2 relative links to other docs files
2015-11-17 12:30:32 -08:00
Guido Contreras Woda
427642aaba Entity cache key is built differently on read than on write 2015-11-17 16:10:17 -03:00
Guilherme Blanco
84eb175dbf Merge pull request #1436 from dadamssg/DDC-3785
allow ManyToManyPersister to handle custom identification types
2015-11-15 22:24:01 -05:00
Guilherme Blanco
50ee47cc70 Merge pull request #1492 from nicolas-grekas/doc-fix
Fix misleading docblock example
2015-11-15 22:19:27 -05:00
Guilherme Blanco
04789dfec7 Merge pull request #1443 from meeuw/unsigned
Unsigned
2015-11-15 22:16:15 -05:00
Guilherme Blanco
7fc36b4110 Merge pull request #1450 from davidfuhr/doc-version
Link annotation ref to locking explanation
2015-11-15 22:14:36 -05:00
Guilherme Blanco
cdfcca2ff2 Merge pull request #1455 from xoeoro/patch-1
Update ExprTest.php
2015-11-15 22:12:36 -05:00
Guilherme Blanco
9f93999758 Merge pull request #1487 from xxccdef/DDC-3864
[DDC-3864] Support any ordering of fields in partial object query with embeddable
2015-11-15 22:03:25 -05:00
Guilherme Blanco
e8acfb5891 Merge pull request #1481 from mikeSimonson/composer-bin-fix
Remove the execution bit on the bin/doctrine.php
2015-11-15 22:02:19 -05:00
Guilherme Blanco
5ec9a62e2b Merge pull request #1558 from doctrine/DDC-3922
[RFC] remove indexes overruled by primary key
2015-11-15 22:01:05 -05:00
vershnik
96398ba30f remove indexes overruled by primary key
There can be unique indexes automatically created for join column.
If join column is also primary key we should keep only primary key on this column.

Oracle does not allow having both unique index and primary key on the same column, it is useless for mysql too.
(Previously it was done by DBAL, but now it allows duplicate indexes)
2015-11-16 02:49:41 +00:00
Guilherme Blanco
c561223d1b Merge pull request #1557 from gitname/patch-1
Reduce ambiguity in Entities description
2015-11-15 21:25:30 -05:00
gitname
8192d5bb3e Reduce ambiguity in Entities description 2015-11-15 13:27:51 -08:00
Jan Langer
91ce78815f Second level cache stores identifier with correct type even if findById is called with wrong identifier type 2015-11-14 11:17:16 +01:00
Guilherme Blanco
71bb27a62f Merge pull request #1555 from doctrine/DDC-3979
[RFC] DDC-3979
2015-11-13 11:38:55 -05:00
Guilherme Blanco
e64f44ec9b Fix one to one inverse side cached entity association key generation 2015-11-13 15:58:52 +00:00
Marco Pivetta
802cc82c8d Merge pull request #1554 from tai2/fix_document_transactional
Fix a documentation error.
2015-11-13 07:00:30 +01:00
tai2
50d87bd111 Fix a documentation error. 2015-11-13 12:07:21 +09:00
Guilherme Blanco
3a44a3dada Merge pull request #1551 from doctrine/DDC-3976
[RFC] DDC-3976
2015-11-12 10:21:37 -05:00
Marco Pivetta
3452f5ccc3 Merge pull request #1553 from OskarStark/patch-1
doc fix
2015-11-12 11:50:15 +01:00
Oskar Stark
d49cd4aa1e doc fix 2015-11-12 11:45:37 +01:00
Guilherme Blanco
58992ad523 Fixed support for inverse side second level cache 2015-11-12 05:00:08 +00:00
Guilherme Blanco
089a0ac60b Merge pull request #1552 from guiwoda/l2-invalid-collection-cache-key
Collection cache key is built differently on read than on write
2015-11-11 10:22:46 -05:00
Guido Contreras Woda
d57ecc12c0 Collection cache key is built differently on read than on write 2015-11-11 12:10:29 -03:00
Guilherme Blanco
1187c51a89 Merge pull request #1529 from tkleinhakisa/2.1-upgrade
Update Upgrade.md after minor bc break in 2.5.0
2015-11-08 22:54:20 -05:00
Guilherme Blanco
46dec5478a Merge pull request #1505 from qu1m/master
Fixed issue with entity manager when using LockMode::NONE
2015-11-08 22:51:38 -05:00
Guilherme Blanco
49bb687aaf Merge pull request #1540 from pantelm/master
[DDC-3711] Correct Error on manyToMany with composite primary key + add Tests
2015-11-08 22:43:36 -05:00
Guilherme Blanco
664925d7f4 Merge pull request #1550 from doctrine/cache-for-travis
[RFC] Added composer cache on travis
2015-11-08 22:41:48 -05:00
Guilherme Blanco
370dbf12de Added composer cache on travis 2015-11-09 03:40:18 +00:00
Guilherme Blanco
3e0529db53 Merge pull request #1493 from alireza-m/master
Pass orderings, maxRresults and firstResult when call getHash
2015-11-08 22:36:06 -05:00
Guilherme Blanco
bad0f17c10 Merge pull request #1549 from doctrine/DDC-3697
[RFC] DDC-3697
2015-11-08 22:30:50 -05:00
Guilherme Blanco
443259f629 Some extra refinement over patch 2015-11-09 03:19:11 +00:00
Matthias Pigulla
b7bd42638d Fix for DDC-3697 and DDC-3701
Also fix Lexer::match() so it does not accept T_WHERE when T_WITH is supposed to be matched. (DDC-3701)
2015-11-09 03:19:11 +00:00
Guilherme Blanco
ada97d55ce Merge pull request #1375 from webimpress/fix/DDC-3671
DDC-3671 prevent duplicate unique index
2015-11-07 11:44:02 -05:00
Guilherme Blanco
6dfafad33c Merge pull request #1547 from doctrine/fix-result-cache
[RFC] fixes result cache setting query caching
2015-11-07 11:22:14 -05:00
Alex Vasilenko
c8d2ac40f4 fixes result cache setting query caching 2015-11-07 16:14:54 +00:00
Guilherme Blanco
d7a3154954 Merge pull request #1397 from giosh94mhz/concat_expr_variable_arguments
Add Expr::concat support for multiple arguments
2015-11-07 10:45:04 -05:00
Guilherme Blanco
d88cf97bef Merge pull request #1507 from deguif/fix-wrong-property
Fixed wrong property name
2015-11-07 10:09:06 -05:00
Marco Pivetta
28cebeca1c Merge pull request #1407 from aivus/patch-1
Add return to removeMethodTemplate
2015-11-06 23:11:42 -05:00
Marco Pivetta
e7685c89da Merge pull request #1405 from taueres/master
EntityManager#getReference throw ORMException for unrecognized id
2015-11-06 23:07:21 -05:00
Marco Pivetta
378f6546b4 Merge pull request #1545 from doctrine/general-fixes
[RFC] General fixes
2015-11-06 22:56:00 -05:00
Guilherme Blanco
843966ac50 General fixes across CS, type resolving, test fixes, etc 2015-11-07 03:55:05 +00:00
Marco Pivetta
9e085ca0b3 Merge pull request #1308 from z38/override-inversedby
[DDC-3579] Allow override of inversedBy
2015-11-05 15:10:43 -05:00
Marco Pivetta
2fa289edee Merge pull request #1514 from Metabor/patch-2
check if collection is empty without loading it
2015-11-05 14:46:15 -05:00
z38
ff28507b88 Allow override of inversedBy 2015-11-05 12:11:29 +01:00
Marco Pivetta
2383ccfba5 Merge branch 'feature/#1354-one-to-many-orphan-removal'
Close #1354
2015-11-05 00:24:29 -05:00
Marco Pivetta
f097478437 #1354 - DDC-3644 - short array syntax 2015-11-05 00:13:19 -05:00
Marco Pivetta
a7ded16204 #1354 - DDC-3644 - s/protected/private 2015-11-05 00:11:43 -05:00
Guilherme Blanco
1587aac4ff Added support for OneToMany with orphanRemoval. Replacing entire collection now deletes the replaced collection (scheduled for deletion). No event handling is done as it happens at DBAL level. 2015-11-05 00:08:44 -05:00
Marco Pivetta
06c194310a Merge pull request #1310 from nicolas-grekas/patch-1
Allow symfony 3.0 components
2015-11-04 23:23:06 -05:00
Marco Pivetta
d39a73cce6 Merge pull request #1541 from aleeeftw/master
Minor docblock correction
2015-11-01 12:07:35 +01:00
aleeeftw
5481e0fb8b Minor docblock correction
The documentation for the method ‘addJoinedEntityFromClassMetadata’ is
wrong. As we can see currently says you need to pass an object and that
is wrong. The $relation variable is passed to ‘addJoinedEntityResult’
which is using it as a ‘string’.
2015-11-01 10:43:03 +00:00
Pantel
43b2419a3c [DDC-3711] add Test that check if the association key are composite 2015-10-31 17:19:39 +01:00
Pantel
7de2e04ccd [DDC-3711] add Tests that check if the association key are composite 2015-10-31 17:15:06 +01:00
Pantel
96687e04a6 [DDC-3711] Correct Error on manyToMany with composite primary key 2015-10-31 16:02:14 +01:00
Steve Müller
b1451cda52 Merge pull request #1533 from sergeyz/patch-1
Fix argument type
2015-10-22 09:38:06 +02:00
Marco Pivetta
b15e8b79dc Merge pull request #1536 from AngelFQC/patch-1
Minor - Fix PHP Doc - Update Expr.php
2015-10-20 15:16:25 -07:00
Angel Fernando Quiroz Campos
47441666df Update Expr.php 2015-10-20 16:55:43 -05:00
Ilya Antipenko
60b80c95cc Add phpdoc tests for addXxx() and removeXxx() methods
Add tests for return types for addXxx() and removeXxx() methods
2015-10-17 17:14:56 +03:00
Marco Pivetta
290dc8989d Merge pull request #1534 from senkal/gramma-fix/start-sentence-with-capital-letter
Use capital letter at the beginning of a sentence
2015-10-11 21:49:07 +02:00
Marcin Sekalski
52817cedfc Use capital letter and the beginning of a sentence 2015-10-11 13:59:09 +01:00
Sergey Zhuravel
e354ebb162 Fix argument type 2015-10-09 13:53:25 +03:00
Klein Thomas
8535e01115 Move to 2.5 section 2015-10-09 07:12:28 +00:00
Klein Thomas
e682f48422 Update Upgrade.md after minor bc break in 2.5.1
The introduction of the second parameter in EntityRepository#createQueryBuilder generates a runtime notice if you have a sub-class of EntityRepository that has a second parameter in the createQueryBuilder method
2015-10-09 07:10:07 +00:00
Marco Pivetta
e91bce5f2a Merge pull request #1528 from sprain/fix-typo-doc
Fixed typo in 9.6.7 of docs
2015-10-05 16:45:19 -03:00
Manuel Reinhard
c86ab7d239 Fixed typo in 9.6.7 of docs 2015-10-05 21:43:03 +02:00
Marco Pivetta
88f43a947d Merge pull request #1518 from guiwoda/custom-generator-field-builder
Added custom ID generator definition to the FieldBuilder
2015-10-04 19:56:17 -03:00
Marco Pivetta
dd2068777c Merge pull request #1526 from zinovyev/break-on-autoloader-selected
Break on autoloader selected
2015-10-04 15:04:42 -03:00
Ivan Zinovyev
1ddb63c88a Break on autoloader selected 2015-10-04 19:58:57 +03:00
Guido Contreras Woda
3a7d2da2e5 Added custom ID generator definition to the FieldBuilder 2015-10-02 13:51:07 -03:00
Marco Pivetta
5c6f0edb23 Merge pull request #1516 from brabeji/patch-1
Clarify @DiscriminatorMap requirement
2015-10-02 05:30:09 -03:00
Marco Pivetta
b5799ae569 Merge pull request #1523 from BenMorel/expr
Documentation and case fixes in QueryBuilder
2015-10-01 15:49:29 -03:00
Benjamin Morel
7d4016a757 Documentation and case fixes in QueryBuilder 2015-10-01 20:04:16 +02:00
Marco Pivetta
61ad1bd137 Merge pull request #1520 from maqnouch/patch-1
Updated year range
2015-09-30 07:12:43 -03:00
AQNOUCH Mohammed
d02b059269 Updated year range 2015-09-29 22:52:45 +00:00
Jiří Brabec
4b87f5827f Clarify @DiscriminatorMap reqirement
When trying to setup MTI with doctrine, this was always the sentence where I stopped reading as it seems useless if you are forced to specify list of children when you don't even know them. Today I accidentaly read further and found out that this is not necessary.
2015-09-25 12:47:51 +02:00
Oliver Tischlinger
60beca3760 changes after code review 2015-09-25 10:44:30 +02:00
Oliver Tischlinger
03523c67d5 add Unit Test for isEmpty change in LazyCriteriaCollection 2015-09-24 11:39:14 +02:00
Oliver Tischlinger
3e26330c53 check if collection is empty without loading it
Actually isEmpty() is always loading the collection in LazyCriteriaCollection.
A lazy version should use the existing functionality of count() to check if there are no elements if the collection is not initialized.
2015-09-23 17:34:11 +02:00
Marco Pivetta
b055d78ea1 Merge pull request #1510 from webfactory/doctrine-cache-removed-DoctrineNamespaceCacheKey
Fix tests
2015-09-19 10:39:39 +02:00
Marco Pivetta
2242a4c652 Merge pull request #1511 from BlueM/master
Fix class name: AbstractCache -> CacheProvider
2015-09-19 10:22:44 +02:00
Carsten Blüm
42a500a73d Fix class name: AbstractCache -> CacheProvider 2015-09-19 08:34:00 +02:00
Matthias Pigulla
84f51b68af Fix tests
dd47003641 removes the 'DoctrineNamespaceCacheKey[]' entry from the cache. Thus, all tests counting cache entries were off by one.
2015-09-19 01:15:39 +02:00
François-Xavier de Guillebon
ae243643e5 Added test 2015-09-14 18:35:49 +02:00
François-Xavier de Guillebon
4b7d8511f8 Fixed wrong variable used as array key 2015-09-14 18:34:55 +02:00
François-Xavier de Guillebon
a18ff95fc4 Fixed wrong property name 2015-09-11 17:17:28 +02:00
Marco Pivetta
8b79fe9d9b Merge pull request #1506 from Tobion/patch-1
Fix variable reference in phpdoc of ClassMetadataInfo
2015-09-11 09:51:12 +01:00
Tobias Schultze
c03996d3b3 Fix variable reference in phpdoc of ClassMetadataInfo 2015-09-11 00:19:18 +02:00
Giorgio Premi
16172534bb Add Expr::concat support for multiple arguments 2015-09-10 17:01:09 +02:00
Quim Manrique
1dbacec0e4 Fixed issue with entity manager when using LockMode::NONE 2015-09-08 00:31:03 +02:00
Marco Pivetta
1b09bb75b0 Merge pull request #1504 from phansys/doc_uuid_generator_strategy_2
Updated docs for basic mapping
2015-09-06 02:08:52 +02:00
Javier Spagnoletti
2e2921690a Updated docs for basic mapping
Added note about UUID identifier generator strategy, which was added in 2.3 version:

0a83560
2015-09-05 15:40:37 -03:00
Marco Pivetta
a0a0c731bb Merge pull request #1457 from phansys/short_types
Updated syntax for "integer" and "boolean" types
2015-09-05 17:21:05 +02:00
Marco Pivetta
d1b24dfe12 Merge pull request #1500 from zeroedin-bill/docs-build-improvements
Update docs dependency install script and readme to target Ubuntu 14.04
2015-09-04 08:41:38 +01:00
Marco Pivetta
5c8cca2f44 Merge pull request #1485 from hasumedic/php-version-docs
Changed references from PHP6 to PHP7
2015-09-04 08:40:37 +01:00
Marco Pivetta
8aa0cdd0b9 Merge pull request #1483 from longkey1/fix-typo
Fix typo
2015-09-04 08:37:40 +01:00
Marco Pivetta
2d00a9bcbf Merge pull request #1482 from bocharsky-bw/patch-1
Add type hint for entity manager
2015-09-04 08:34:35 +01:00
Marco Pivetta
29c2b807ce Merge pull request #1474 from localheinz/fix/unused-imports
Fix: Remove unused imports
2015-09-04 08:30:46 +01:00
Marco Pivetta
41ee7e0f1a Merge pull request #1444 from cezarykluczynski/tutorial-opening-tags-fix
Missing opening tags added in one of the tutorials
2015-09-04 08:24:29 +01:00
Marco Pivetta
b062ffdead Merge pull request #1452 from TomasVotruba/patch-1
composer: dev is now by default
2015-09-04 08:22:29 +01:00
Bill Schaller
3e5bf819e3 Update docs dependency install script and readme to target Ubuntu 14.04 2015-09-03 13:58:40 -04:00
Steve Müller
233ebb0ba1 Merge pull request #1499 from issei-m/patch-2
minor: removed useless line breaks
2015-09-03 16:40:59 +02:00
Issei.M
df461601f7 removed useless line breaks 2015-09-03 17:55:14 +09:00
Benjamin Eberlei
2b3648c725 [DCOM-293] Fix security misconfiguration vulnerability allowing local remote arbitrary code execution. 2015-08-31 14:16:50 +02:00
Adrien Crivelli
93806a8036 Update DateTime cookbook code
It seems that existing code was outdated and lacked ``use`` statement in order to work correctly.
We also added instructions on how to configure the new type, since it may not be straightforward for newcomers.
2015-08-27 15:39:26 +09:00
Alireza Meskin
dfa874642a Pass orderings, maxRresults and firstResult when call getHash 2015-08-16 15:22:06 +04:30
Nicolas Grekas
df820a5695 Fix misleading docblock example 2015-08-14 14:35:25 +02:00
Bill Schaller
f88896cc9d Merge pull request #1463 from ehimen/paginate-order-by-subselect
Fixed issue when paginator orders by a subselect expression
2015-08-04 14:17:50 -04:00
Egidijus Jucevičius
d4d9a2ba3c Support any ordering of fields in partial object query with embeddable [DDC-3864] 2015-08-04 10:56:50 +03:00
Alex Salguero
5393bc9956 Removed outdated PHP6 reference in "best practices" docs.
Changed references from PHP6 to PHP7 in tests.
2015-07-31 12:25:19 +01:00
Bocharsky Victor
dbd3fa4501 Add type hint for entity manager 2015-07-30 15:32:04 +03:00
longkey1
a3b1f85fd4 typo 2015-07-30 13:16:55 +09:00
mike
1d6adcaf4a Remove the execution bit on the bin/doctrine.php 2015-07-29 08:41:33 +02:00
Marco Pivetta
71b1dde096 Merge pull request #1473 from ilyar/docs_fix_ref_and_title
Docs fix ref and title
2015-07-26 01:19:44 +03:00
Andreas Möller
8a9f6849a2 Fix: Remove unused imports 2015-07-24 12:48:34 +02:00
Ilya Rogov
f10f4b7c52 Fixed WARNING: Title underline too short 2015-07-24 11:09:33 +03:00
Ilya Rogov
bb8f1c77cc Pretty Ref and Fixed WARNING: Duplicate explicit target name 2015-07-24 11:02:42 +03:00
Adrien Crivelli
57ca849848 Add test for MariaDB 5.5 and 10.1 on Travis
This use the brand new supported addon mariadb (not yet officially announced).
This is unfortunately a bit verbose, but I don't think there is any
alternative because we cannot install the addon when testing against mysql
otherwise it would overwrite mysql install.
2015-07-23 12:51:21 +09:00
Andy Cook
26c295b06b Added non-functional tests for row number over function subselect expression fix; syntax fixes. 2015-07-17 13:24:19 +01:00
Marco Pivetta
f5e79fa0c0 Merge pull request #1466 from Majkl578/travis-container-infrastructure
Travis: Switch to container-based infrastructure
2015-07-16 22:18:33 +01:00
Michael Moravec
e87c94052d Travis: Switch to container-based infrastructure 2015-07-16 22:47:33 +02:00
Marco Pivetta
1370424fed Merge pull request #1400 from photodude/patch-1
mysqli is supported by HHVM
2015-07-16 21:08:32 +01:00
Marco Pivetta
ad056ebdc6 Merge pull request #1462 from DHager/document_transactional
Add a note to documentation for transactional()'s return values
2015-07-16 20:56:04 +01:00
Marco Pivetta
506df640b5 Merge pull request #1433 from goetas/slc-check-to-classmetadatainfo
Check for non-cacheable entities on metadata level, not at runtime
2015-07-16 20:41:30 +01:00
Asmir Mustafic
3a7b2991e8 PSR-2 CS improvements 2015-07-16 16:20:36 +02:00
Andy Cook
61488d955e Fixed issue when paginator orders by a subselect expression on platforms supporting ROW_NUMBER OVER() function. 2015-07-16 11:20:22 +01:00
Darien Hager
72d848901b Add reminder to README for initializing git submodules 2015-07-15 18:59:14 -07:00
Darien Hager
8503c1247f Document return-value substitution in EntityManager::transactional() 2015-07-15 18:58:18 -07:00
Marco Pivetta
6bf6db3533 Merge pull request #1451 from TomasVotruba/psr-4
composer: autoload via PSR-4
2015-07-15 22:24:59 +01:00
Marco Pivetta
70a22b6a73 Merge pull request #1390 from deviantintegral/chaincache-docs
Document the ChainCache class
2015-07-15 21:58:20 +01:00
Marco Pivetta
06a00cf073 Merge branch 'hotfix/#1387-DDC-3699-do-not-merge-managed-uninitialized-entities'
Close #1387
2015-07-15 21:51:21 +01:00
Marco Pivetta
eb5d87cd94 DDC-3699 - #1387 - leveraging the OrmFunctionalTestCase API 2015-07-15 21:51:04 +01:00
Marco Pivetta
12183b7e6c DDC-3699 - #1387 - catching specific exceptions 2015-07-15 21:47:37 +01:00
Marco Pivetta
74883e535f DDC-3699 - #1387 - simpifying tests, clarifying on test method names 2015-07-15 21:46:23 +01:00
Lenard Palko
cbfd71cec6 Added test cases for both one-to-one and one-to-many cases. 2015-07-15 21:26:45 +01:00
Lenard Palko
977f0a5b5c Fix skipping properties if they are listed after a not loaded relation. 2015-07-15 21:26:45 +01:00
Marco Pivetta
67cda0cd75 Merge branch 'hotfix/#1381-wakeup-reflection-with-embeddable-and-staticreflection-serialization-fix'
Close #1381
2015-07-15 20:49:40 +01:00
Nico Vogelaar
b3af5590f9 Fixes ClassMetadata wakeupReflection with embeddable and StaticReflectionService 2015-07-15 20:49:16 +01:00
Marco Pivetta
34eb4fdec5 Merge branch 'hotfix/#1380-non-cache-persister-bug'
Close #1380
2015-07-15 20:37:30 +01:00
Marco Pivetta
56cedc5d4f DDC-3683 - #1380 - reverting BC break, annotating correct types, cs fixes 2015-07-15 20:35:21 +01:00
Darien Hager
77d03ec745 Remove runtime assertion 2015-07-15 20:29:44 +01:00
Darien Hager
6f1107c4ee Clarify state-changes, replace array_key_exists() with isset() for speed 2015-07-15 20:29:43 +01:00
Darien Hager
1659fab44f Whitespace formatting tweaks 2015-07-15 20:29:43 +01:00
Darien Hager
d0892b21fb Remove now-superfluous EntityManager check 2015-07-15 20:29:43 +01:00
Darien Hager
6d6a6a7fbd Refactor LoadClassMetadataEventArgs to ensure it contains an EntityManager 2015-07-15 20:29:43 +01:00
Darien Hager
e8854b68bb Change the test listener than layers on second-level-caching so that it is more conservative, only turning on caching-associations when it knows the target entity is cache-able. 2015-07-15 20:29:43 +01:00
Darien Hager
cddbbf00b4 Stumbled across a bug where signatures didn't match, but also the current persister-type didn't support getCacheRegion(). Unsure of exact mechanism, but clearly the constructor doesn't take the second argument anyway, may be old code. 2015-07-15 20:29:43 +01:00
Marco Pivetta
4b1851467b Merge pull request #1458 from phansys/patch-1
[Paginator] Fixed boolean casting
2015-07-15 08:11:43 +01:00
Javier Spagnoletti
cedff7715e [Paginator] Fixed boolean casting in Paginator
| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |
2015-07-14 16:48:42 -03:00
Javier Spagnoletti
97cc49033e Updated syntax for ``integer` and `boolean`` types
| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Used short syntax for ```integer``` and ```boolean``` types.

**Before**
```php
/**
 * @var integer
 *
 * @ORM\Column(name="some_integer_field", type="integer")
 */
private $someIntegerField;

/**
 * @var boolean
 *
 * @ORM\Column(name="some_boolean_field", type="boolean")
 */
private $someBooleanField;
```

**After**
```php
/**
 * @var int
 *
 * @ORM\Column(name="some_integer_field", type="integer")
 */
private $someIntegerField;

/**
 * @var bool
 *
 * @ORM\Column(name="some_boolean_field", type="boolean")
 */
private $someBooleanField;
```
2015-07-14 15:30:13 -03:00
xoeoro
44557a5afa Update ExprTest.php
expr()->countDistinct allows to create COUNT(DISTINCT) expression with mulltiple fields but parser requires only one field.

\Doctrine\ORM\Query\Parser::AggregateExpression

some body, please, fix this problem
2015-07-13 10:45:17 +03:00
Dick Marinus
4a39754e76 unsigned is in fieldMapping['options'] 2015-07-09 20:54:04 +02:00
Tomáš Votruba
e0872c55a9 composer: dev is now by default 2015-07-08 14:31:43 +02:00
Tomas Votruba
726383cafb composer: autoload via PSR-4 2015-07-08 01:51:16 +02:00
David Fuhr
de424be9f7 [DX] Link annotation ref to locking explanation
The annotation reference contained no cross reference to the great
transaction and concurrency page. But this might be very useful for the
reader.
2015-07-07 18:45:56 +02:00
Guilherme Blanco
33c2ae465d Merge pull request #1449 from dunglas/patch-1
minor: code quality in Paginator
2015-07-07 11:03:03 -04:00
Kévin Dunglas
abf6b8bee5 minor: Code quality in Paginator 2015-07-07 10:09:06 +02:00
Guilherme Blanco
96b065b282 Merge pull request #1447 from krispypen/patch-1
Fix second level caching for queries with multiple joins
2015-07-06 09:49:35 -04:00
Kris Pypen
5780f3209c wrote a Test for second level cache with multiple levels of associations 2015-07-06 14:18:38 +02:00
Kris Pypen
a2a400b8fb Fix second level caching for queries with multiple joins
The $metadata of the main entity is not always the metadata you need here, for example when you do join A with B and then B with C. For the second join it was using the metadata from A.
2015-07-03 14:45:25 +02:00
Cezary Kluczyński
793fe9d2d1 Missing opening tags added in one of the tutorials 2015-07-01 19:49:11 +02:00
Dick Marinus
9715f3dfcc add field options as array 2015-06-30 19:42:22 +02:00
Matthew Turland
af2f6a6fff Corrected bad class reference in "Adding own commands" 2015-06-29 22:58:48 -05:00
David Adams
6fa20062f3 allow ManyToManyPersister to handle identification types 2015-06-23 17:55:56 +00:00
Asmir Mustafic
32f0fefec7 Test XML driver with failing SLC mapping 2015-06-20 14:33:36 +02:00
Asmir Mustafic
4da0ee9db8 Test PHP driver with failing SLC mapping 2015-06-20 14:33:36 +02:00
Asmir Mustafic
5f2922b3a7 Test annotation driver with failing SLC mapping 2015-06-20 14:32:15 +02:00
Asmir Mustafic
012367a371 Removed runtime check test for non-cacheable entities 2015-06-20 14:32:14 +02:00
Asmir Mustafic
acbda4bc0e YAML driver uses getAssociationCacheDefaults for SLC mapping 2015-06-20 14:32:14 +02:00
Asmir Mustafic
7d64be915c XML driver uses getAssociationCacheDefaults for SLC mapping 2015-06-20 14:32:14 +02:00
Asmir Mustafic
f4f32a5213 Annotation driver uses getAssociationCacheDefaults for SLC mapping 2015-06-20 14:32:14 +02:00
Asmir Mustafic
11be4fae86 Do not check at runtime for non-cacheable associations 2015-06-20 14:32:14 +02:00
Asmir Mustafic
c685255fe3 Check for non-cacheable associations directly on the class metada info 2015-06-20 14:32:14 +02:00
Asmir Mustafic
6a428c6064 Allow to retreive association cache defaults 2015-06-20 14:32:14 +02:00
Bill Schaller
6b3056ff8c Merge pull request #1430 from michael-lavaveshkul/master
"INSTANCE OF" example doesn't match description.
2015-06-18 10:30:14 -04:00
michael-lavaveshkul
073f570c67 Updated "INSTANCE OF" example code. 2015-06-17 22:15:17 -07:00
Marco Pivetta
37a409aa1f Merge pull request #1429 from hallabro/update-preupdate-documentation
Update events.rst to reflect behaviour of preUpdate
2015-06-17 08:25:37 +01:00
Robin Hallabro
63a543d6a0 Update events.rst to reflect behaviour of preUpdate 2015-06-17 07:57:11 +02:00
Thomas Lallement
f41e59258c Failing Test - Paginator with sorted collection 2015-06-16 16:34:37 -04:00
Benjamin Eberlei
ae5b8178e7 Merge pull request #1406 from XitasoChris/patch-1
add default value for GeneratedValue
2015-06-16 22:25:49 +02:00
Benjamin Eberlei
5ae40d571a Merge pull request #1409 from haeber/patch-1
Added PHPDoc return type false of next method in Hydration/IterableResult
2015-06-16 22:21:20 +02:00
Benjamin Eberlei
8d1be42924 [DDC-3741] Add test for AbstractQuery#setHydrationCacheProfile(null) 2015-06-16 21:56:25 +02:00
Benjamin Eberlei
6423a33a23 Merge pull request #1411 from icambridge/patch-1
Allow null to be passed to setHydrationCacheProfile
2015-06-16 21:54:08 +02:00
Benjamin Eberlei
545e448024 Merge pull request #1416 from Restless-ET/patch-1
[2.5][Bug] Fix ConvertDoctrine1Schema->getMetadata
2015-06-16 21:38:35 +02:00
Benjamin Eberlei
5aded88cf6 Merge pull request #1418 from mageekguy/patch-2
Remove (useless?) call to parser::getLexer()
2015-06-16 21:36:14 +02:00
Benjamin Eberlei
1e7e8f216a Merge pull request #1419 from c960657/cancel-orphan-removal
[DDC-3382] Allow orphan removal to be cancelled
2015-06-16 21:23:20 +02:00
Benjamin Eberlei
ac03c9d851 Add section about entities, proxies and reflection to "Limitations and Known Issues" chapter. 2015-06-16 21:11:29 +02:00
Christian Schmidt
96dbecec24 [DDC-3382] Allow orphan removal to be cancelled 2015-06-12 16:44:13 +02:00
Marco Pivetta
14ff7f50cf Updating contributing notes to latest composer standard 2015-06-11 14:08:34 +01:00
Frédéric Hardy
b6d29c8b72 Remove (useless?) call to parser::getLexer()
The `$lexer` variable is not used, the method `parser::getLexer()` is just a dumb getter and do nothing, so in my opinion, the call to `parser::getLexer()` is useless in this context.

Can you confirm?
2015-06-08 16:04:58 +02:00
Restless-ET
b33612f9e7 [2.5][Bug] Fix ConvertDoctrine1Schema->getMetadata
This bug was introduced at #1205 while resolving #1200.
2015-06-05 17:08:50 +01:00
Iain Cambridge
8625ca5187 Allow null to be passed to setHydrationCacheProfile
Currently null can be passed and is set as default, however if you do this you get an exception. This allows null to be passed and set. 

There is an if statement later on to see if $this->_hydrationCacheProfile is null so it seems logical you can set it to be null.
2015-05-20 15:10:01 +02:00
Thomas Häber
d92785811b Added PHPDoc return type false of next method
Because hydrateRow can return false, too. The PHPDoc return type of the next method has return false in addition to array.
2015-05-15 12:06:56 +02:00
Logan Bailey
272e8aa6f1 [doc] Remove unused variable from sample code
Removes lexer since it's not used.
2015-05-14 11:51:01 -07:00
Ilya Antipenko
6a98f0391d Add return to removeMethodTemplate 2015-05-13 15:52:38 +03:00
Christopher Gross
702b8b3309 add default value for GeneratedValue 2015-05-12 14:16:02 +02:00
Sergio Santoro
8c6607532b EntityManager#getReference throw ORMException for unrecognized id
- Unreachable statements have been removed
 - Throw ORMException for unrecognized identifier field (same
   behavior as EntityManager#find)
2015-05-10 00:28:28 +02:00
Marco Pivetta
900b55d16a Merge pull request #1404 from stephan281094/typo
Fix PHPDoc typo
2015-05-07 13:36:20 +01:00
Stephan de Vries
f61526d3ff Fix PHPDoc typo 2015-05-07 14:05:20 +02:00
photodude
4d6dfb2b81 PostgreSQL currently unsupported by HHVM
- Supported but you have to [install an officially supported dependency.](https://github.com/PocketRent/hhvm-pgsql/tree/releases)
2015-05-06 19:45:36 -06:00
photodude
652f999e83 pgsql and mysqli are supported by HHVM
- reference to [Known compatible extensions for HHVM](http://docs.hhvm.com/manual/en/extensions.alphabetical.php)
2015-05-06 19:45:24 -06:00
Marco Pivetta
330f88e44b Merge pull request #1401 from stof/patch-2
Remove HHVM-nightly builds
2015-05-05 10:03:25 +01:00
Christophe Coevoet
1b9e197ff3 Remove HHVM-nightly builds
hhvm-nightly is not available anymore on Travis because HHVM dropped support for Ubuntu Precise, which is still used by Travis.
2015-05-05 10:41:44 +02:00
Wojciech Zylinski
af2295b73a Switch to relationToTargetKeyColumns when matching non-owning side with Criteria. Fixes DDC-3719. 2015-05-03 18:39:51 +01:00
Adam Prager
961bff6a80 Initializing embeddables doc 2015-04-27 17:23:40 +02:00
Andrew Berry
f91fadd00c Not all cache drivers are explicitly documented. 2015-04-19 20:51:46 -04:00
Andrew Berry
3d0f44f596 Document the ChainCache class. 2015-04-19 20:47:36 -04:00
Steve Müller
71d134fcc0 Merge pull request #1379 from holtkamp/patch-1
Added missing 'new' keyword for logger instantiation
2015-04-18 11:13:31 +02:00
Steve Müller
b8ef6cfd2f Merge pull request #1384 from TomasVotruba/patch-1
cs
2015-04-18 11:07:17 +02:00
Steve Müller
2706812b37 Merge pull request #1385 from TomasVotruba/patch-2
duplicated param in phpdoc
2015-04-18 11:03:09 +02:00
Steve Müller
5ac291d0f4 Merge pull request #1386 from TomasVotruba/patch-3
PersisterException: missing license added
2015-04-18 10:57:12 +02:00
Tomáš Votruba
b3b0f6bd5b PersisterException: missing license added 2015-04-17 12:46:52 +02:00
Tomáš Votruba
6fae618669 duplicated param in phpdoc 2015-04-17 10:13:40 +02:00
Tomáš Votruba
a71f2ba76f cs 2015-04-17 10:12:18 +02:00
Guilherme Blanco
5f18618355 Merge pull request #1382 from holtkamp/patch-second-level-cache-association-hydration
Patch second level cache association hydration
2015-04-14 11:37:54 -04:00
Menno Holtkamp
5f891435f1 Use early return 2015-04-14 16:02:36 +02:00
Menno Holtkamp
34b6ce9259 Introduced getCacheEntryKey() to combine region name and cache key 2015-04-14 09:52:25 +02:00
Menno Holtkamp
dbc29d28d2 Simplified way to fetch multiple entries when index does not matter 2015-04-14 09:47:57 +02:00
Menno Holtkamp
012f33524b Fixed some typo's 2015-04-14 09:43:22 +02:00
Menno Holtkamp
c236a67096 Used index as key to retrieve proper entry 2015-04-13 23:33:09 +02:00
Menno Holtkamp
74964e7d85 Improved testing region->getMultiple() 2015-04-13 23:31:19 +02:00
Menno Holtkamp
eef81b6eb9 Added missing 'new' keyword for logger instantiation 2015-04-09 15:06:41 +02:00
Bill Schaller
3f84be7b7c Merge pull request #1377 from fprochazka/bugfix/paginator
LimitSubqueryOutputWalker: fix aliasing of property in OrderBy from MappedSuperclass
2015-04-08 20:05:51 -04:00
Filip Procházka
e501137d1a LimitSubqueryOutputWalker: fix aliasing of property in OrderBy from MappedSuperclass 2015-04-09 01:43:05 +02:00
Filip Procházka
192da14842 Failing test case for broken paginator case 2015-04-09 01:42:46 +02:00
Michał Bundyra
699a6e1783 prevent duplicate unique index 2015-04-08 10:49:21 +01:00
Marco Pivetta
2c90930068 Merge pull request #1374 from mbeccati/fix-DDC767Test-php7-pg94
Fix DDC767Test failing on php7 + pg94
2015-04-06 04:22:24 +01:00
Marco Pivetta
6a41b73318 Merge pull request #1373 from aivus/patch-1
Add note about "symfony/yaml" dependency for yml mappings
2015-04-06 04:09:51 +01:00
Matteo Beccati
e7397ff62e Fix DDC767Test failing on php7 + pg94
The failure happens when running the full suite or even just:

phpunit tests/Doctrine/Tests/ORM/Functional/Ticket
2015-04-05 21:50:25 +02:00
Ilya Antipenko
a14517dc9d Add note about "symfony/yaml" dependency for yml mappings 2015-04-05 15:26:12 +03:00
Bill Schaller
354ccdc58b Merge pull request #1361 from Ocramius/hotfix/array-property-initialization
Hotfix: Reverting BC Break - PersistentCollection should accept `null` and `array` as constructor parameter
2015-04-04 20:26:19 -04:00
Marco Pivetta
ea824f39a9 Merge branch 'hotfix/#1365-query-dql-function-test-determinism' 2015-04-05 00:09:47 +01:00
Bill Schaller
f93f601715 fix rare query test failures due to nondeterminism without order by clause 2015-04-05 00:09:38 +01:00
Marco Pivetta
19e24eeb23 Merge pull request #1369 from DavidPrevot/clean-up
Drop empty file
2015-04-05 00:03:10 +01:00
Marco Pivetta
63d86c2e0f Merge pull request #1371 from TomasVotruba/patch-2
Readme: drop "Downloads" link
2015-04-05 00:02:02 +01:00
Tomáš Votruba
c162b593be Readme: drop "Downloads" link
Probably deprecated option
2015-04-05 00:38:43 +02:00
Marco Pivetta
a661a7371d Merge pull request #1370 from TomasVotruba/vendor-clean
drop doctrine/common git submodule
2015-04-04 22:49:20 +01:00
Tomas Votruba
8f758dc932 drop doctrine/common git submodule 2015-04-04 22:43:50 +02:00
David Prévot
6f033a2c47 Drop empty file 2015-04-04 15:37:59 -04:00
Marco Pivetta
c7c6822c56 Merge pull request #1368 from TomasVotruba/patch-2
Readme: coverage badge for 2.4 added
2015-04-04 18:49:35 +01:00
Tomáš Votruba
257bf81a3b Readme: coverage badge for 2.4 added 2015-04-04 19:47:43 +02:00
Marco Pivetta
fb055b5eab Merge pull request #1366 from shieldo/patch-3
[Documentation] typo fixes
2015-04-04 00:29:33 +01:00
Douglas Greenshields
fb96a65733 [Documentation] typo fixes 2015-04-04 00:22:00 +01:00
Bill Schaller
052b8e802f Merge pull request #1364 from shieldo/embeddedables
[Documentation] correct naming of Embeddable Objects feature
2015-04-03 12:08:37 -04:00
Douglas Greenshields
16a3d0d769 [Documentation] correct naming of Embeddable Objects feature 2015-04-03 17:05:47 +01:00
Bill Schaller
4a358284f6 Merge pull request #1363 from shieldo/patch-2
merged #1363
2015-04-03 10:53:48 -04:00
Douglas Greenshields
08b66f09b1 remove disclaimer about ORM 2.5 being in beta 2015-04-03 15:52:22 +01:00
Marco Pivetta
2a81adc1fc Correcting ObjectHydrator logic: if an array is a default value for a collection-valued property, it should be cast to a Collection 2015-04-03 15:28:53 +01:00
Marco Pivetta
f0d2e8d150 Correcting static introspection issue in cache specific tests (null was being passed to a PersistentCollection) 2015-04-03 15:28:13 +01:00
Marco Pivetta
95b128ce8f Removing irrelevant tests (as per discussion with @guilhermeblanco and @stof 2015-04-03 15:27:13 +01:00
Marco Pivetta
d49c907934 a PersistentCollection should only allow another collection as a wrapped collection 2015-04-03 15:26:38 +01:00
Tomas Votruba
e5efc23642 Readme: renamed to standard md suffix 2015-04-03 14:55:28 +02:00
Tomas Votruba
23fb24e2be Readme: nicer badges 2015-04-03 14:55:09 +02:00
Marco Pivetta
ad5de6f67a Merge pull request #1362 from TomasVotruba/patch-2
Readme: badges for 2.5 added; 2.3- dropped
2015-04-03 13:49:55 +01:00
Tomáš Votruba
8a4d1e2cf6 Readme: badges for 2.5 added; 2.3- dropped
If I understand [2.5 release info](https://github.com/doctrine/doctrine2/releases/tag/v2.5.0) correctly, 2.4 will have last bugfix, then security fixes. I suppose then 2.3 and lower are in EOL, thus not needed to check badge for. Also they don't have any branch.
2015-04-03 14:16:48 +02:00
Marco Pivetta
1993aecd4c Reverting BC break: PersistentConnection#__construct() now accepts null|array|Collection again 2015-04-02 23:45:46 +01:00
Marco Pivetta
6b5188fee8 FQCN reference (class was not imported correctly) 2015-04-02 23:45:12 +01:00
Marco Pivetta
670972d5c3 PersistentCollection should still accept null and array as constructor argument, as it did before 2015-04-02 23:44:12 +01:00
Marco Pivetta
3bc3aeeb52 Minor docblock correction (discovered during testing) 2015-04-02 23:43:41 +01:00
Marco Pivetta
21b70577d3 Hydration of fetch-joined results fails when an entity has a default value of array for the collection property 2015-04-02 23:43:16 +01:00
Marco Pivetta
6b94dc61c6 Merge branch 'hotfix/#1360-docs-fix-misleading-embeddable-documentation-prefix' 2015-04-02 23:25:02 +01:00
Stefan Blanke
293c6f6313 Fixed misleading typo in Embeddables tutorial 2015-04-02 23:19:26 +02:00
Marco Pivetta
f495dfcc9c Merge branch 'docs/#1359-correcting-mapping-in-working-with-objects-reference' 2015-04-02 21:55:57 +01:00
Juti Noppornpitak
3b6616fe65 Fixed typo in the documentation 2015-04-02 16:46:25 -04:00
Marco Pivetta
f20de54281 Bumping version to 2.6.0-DEV 2015-04-02 21:42:47 +01:00
Marco Pivetta
aa80c7d2c5 Preparing for v2.5.0 release 2015-04-02 21:40:18 +01:00
Marco Pivetta
f8270d7bb2 Bumping branch alias for master to 2.6.x-dev 2015-04-02 21:40:05 +01:00
Marco Pivetta
7ecadb4c61 Merge pull request #1358 from zerocrates/patch-1
Update docs for clear-cache commands
2015-04-02 20:33:51 +01:00
Marco Pivetta
014d554c28 Merge pull request #1355 from scaytrase/patch-1
[Docs] TablePrefix example - Check for being the owning side
2015-04-02 20:31:27 +01:00
Marco Pivetta
8d186528e6 Merge pull request #1357 from DavidPrevot/exec
Drop useless execution bit
2015-04-02 20:30:23 +01:00
John Flatness
5058312d6d Update clear-cache command docs 2015-04-01 17:10:40 -04:00
David Prévot
b7cf41ca45 Drop useless execution bit 2015-04-01 16:01:22 -04:00
Pavel Batanov
ac70c18d50 Check for the being owning side
* Small fix do get rid of notice `undefined index 'joinTable'` as the inverse side does not declare `joinTable` at all.
* Shortened access to `$classMetadata->associationMappings[$fieldName]` for read accesses to increase readability
2015-04-01 14:55:52 +03:00
Marco Pivetta
61bcfda167 Bumping version to v2.5.0-DEV 2015-03-31 22:13:40 +01:00
Marco Pivetta
afd0f28c5f Bumping version for v2.5.0-RC2 release 2015-03-31 22:12:50 +01:00
Marco Pivetta
13ef9fd179 Merge branch 'hotfix/#1350-default-property-value-for-sql-filter'
Close #1350
2015-03-31 22:03:20 +01:00
Marco Pivetta
9a2afd1a9a #1350 - parameters should be an array by default 2015-03-31 22:02:48 +01:00
mmoreram
f6a1ea4859 Assigned default value to array
* For strict configurations of PHP, we were accessing to a non-array element
2015-03-31 22:02:05 +01:00
Marco Pivetta
82230cc427 Merge branch 'hotfix/#1353-#1347-#1351-fix-paginator-sorting-and-fetch-joining'
Close #1353
2015-03-31 21:55:27 +01:00
Marco Pivetta
ba00fc1e90 #1353 #1347 #1351 - s/inSubselect/inSubSelect (with docblock documentation) 2015-03-31 21:51:56 +01:00
Marco Pivetta
6c5dbd8d4c #1353 #1347 #1351 - Removing double quotes (confusing) 2015-03-31 21:50:08 +01:00
Bill Schaller
5c93e61686 Fix issue in LimitSubqueryOutputWalker with entities having field names different from column names 2015-03-31 21:39:21 +01:00
Kristopher Wilson
9d7aa9ba39 Adding failing test case for PaginationTest
The failure comes into play when an entity has an attribute named
differently from its corresponding column name.
2015-03-31 21:39:21 +01:00
Bill Schaller
608dfa2f57 Add more detection in LimitSubqueryWalker for conditions that must be handled by LimitSubqueryOutputWalker 2015-03-31 21:39:20 +01:00
Bill Schaller
b76107e20f resolve review comments from @stof 2015-03-31 21:39:20 +01:00
Bill Schaller
edcc0fc024 Fix paginator when ordering by while selecting entities using joined table inheritance 2015-03-31 21:39:20 +01:00
Bill Schaller
09d28819b5 Fix issue where paginating on a query with a subquery in the where clause crashed 2015-03-31 21:38:58 +01:00
Bill Schaller
af3f5c5c5a Add test for paginating on a query with a subquery in the where clause
Conflicts:
	tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php
2015-03-31 21:38:58 +01:00
Kristopher Wilson
a4aa18f796 test case for joined table inheritance pagination 2015-03-31 21:38:58 +01:00
Bill Schaller
010d52378c Fix LimitSubqueryOutputWalkerTest 2015-03-31 21:36:33 +01:00
Bill Schaller
a8342a4be2 Cleanup 2015-03-31 21:36:33 +01:00
Alexander Orabey
f92307d06d problem with LimitSubqueryOutputWalker when use InheritanceType
Conflicts:
	tests/Doctrine/Tests/OrmFunctionalTestCase.php
2015-03-31 21:36:32 +01:00
Bill Schaller
ff75a3ad49 Fix paginator issues when ordering by a joined column from a to-many association.
Manual merge testcase from #1351
2015-03-31 21:36:32 +01:00
Bill Schaller
54d7efd92c Fix LimitSubqueryOutputWalker when used on tables with joined table inheritance 2015-03-31 21:32:28 +01:00
Marco Pivetta
b923c937e2 Merge branch 'hotfix/#1352-entity-generator-new-class-metadata-hotfix'
Close #1352
2015-03-31 08:45:48 +01:00
Fedik
5cd8334897 fix EntityGenerator RegenerateEntityIfExists 2015-03-27 13:10:14 +02:00
Marco Pivetta
60bacda685 Bumping version to 2.5.0-DEV 2015-03-25 23:16:30 +00:00
Marco Pivetta
df902c9c6a Preparing release v2.5.0-RC1 2015-03-25 23:14:52 +00:00
Marco Pivetta
cf1ecffb14 Merge pull request #1339 from BenMorel/dqlcustomtype
[DDC-2224] Honor convertToDatabaseValueSQL() in DQL query parameters
2015-03-25 01:27:05 +00:00
Benjamin Morel
9eb458caa6 Query::_getQueryCacheId() directly accesses $this->_parsedTypes 2015-03-24 17:14:45 +01:00
Marco Pivetta
dc99ed286a Merge branch 'hotfix/#1342-paginator-functional-test-integration-take2'
Close #1342
Close #1337
Close #1325
2015-03-24 00:39:03 +00:00
Marco Pivetta
d97d3ec0e5 Minor CS fixes (braces) 2015-03-24 00:37:17 +00:00
Marco Pivetta
45d39dd50d Making preserveSqlOrdering API private 2015-03-24 00:36:13 +00:00
Marco Pivetta
6dfff304f3 Merge branch 'hotfix/#1337-fix-oracle-postgresql-paginator-sorting-issues' into hotfix/#1342-paginator-functional-test-integration 2015-03-24 00:25:12 +00:00
Bill Schaller
147bdd8ede Fixed nitpicks from @stof 2015-03-24 00:25:12 +00:00
Bill Schaller
81ccd93b74 Add thorough functional tests for Paginator, expand existing ones. 2015-03-24 00:25:12 +00:00
Marco Pivetta
06998d015f Skipping DDC-3634 tests when a post-insert generator is unavailable 2015-03-24 00:20:03 +00:00
Marco Pivetta
70c8591bbe Merge pull request #1343 from karlrixon/master
Support embeddables in partial object query expression [DDC-3621]
2015-03-23 23:43:36 +00:00
Marco Pivetta
22d699008c Merge branch 'hotfix/#1346-post-insert-big-integer-cast-avoidance'
Close #1346
2015-03-23 23:38:21 +00:00
Marco Pivetta
4c119c44a1 Completed test coverage for DDC-3634 2015-03-23 23:37:36 +00:00
Marco Pivetta
cbdf23ca65 Verifies that identifiers are kept as strings when dealing with large numbers 2015-03-23 23:29:22 +00:00
Marco Pivetta
34168d7085 Merge pull request #1345 from zeroedin-bill/fix-crash-in-convertmapping-command
Fix crashes in ConvertMappingCommand and GenerateEntitiesCommand...
2015-03-23 22:35:33 +00:00
Jonathan H. Wage
525c77d4a1 Update docs theme submodule. 2015-03-23 22:10:06 +00:00
Josef Kříž
e57be9da5e Fix: generated IDs are converted to integer 2015-03-23 17:51:04 +01:00
Karl Rixon
6070c9395d Functional tests for partial selection with embeddables [DDC-3630] 2015-03-23 15:44:06 +00:00
Josef Kříž
d1a695b42b Typo in phpdoc 2015-03-23 15:57:41 +01:00
Bill Schaller
4b10db3a43 Fix crashes in ConvertMappingCommand and GenerateEntitiesCommand when using entities with joined table inheritance
ConvertMappingCommand and GenerateEntitiesCommand both use the DisconnectedClassMetadataFactory, which allows metadata manipulation without loading the associated classes. Commit a36bea broke these two commands by adding a bailout condition in ClassMetadataFactory::populateDiscriminatorValue which checks $metadata->reflClass->isAbstract(). If the DisconnectedClassMetadataFactory is being used, $metadata->reflClass will always be null, causing a fatal error, "Fatal error: Call to a member function isAbstract() on null".

This commit adds a check to see if $metadata->reflClass is set before checking isAbstract.
2015-03-20 13:59:27 -04:00
Guilherme Blanco
e6887954ec Merge pull request #1344 from zeroedin-bill/fix-slc-tests-console-decoration
Fix tests for SLC console commands failing due to console output decoration
2015-03-20 13:52:00 -04:00
Bill Schaller
b057b64c1c Fix tests for SLC console commands failing due to comparison with decorated console output. 2015-03-20 13:45:49 -04:00
Bill Schaller
4c84f54493 Fix failures on SQL Server due to scalar select items not having an alias 2015-03-19 17:09:47 -04:00
Bill Schaller
591fd00d73 Fix capitalization of mapping annotations in PaginationTestCase.php 2015-03-19 16:47:04 -04:00
Marco Pivetta
24425436b0 Bumping version constants to 2.5.0-DEV 2015-03-18 22:38:42 +00:00
Marco Pivetta
483d48cc54 Bumping version constants for the 2.5.0-BETA1 release 2015-03-18 22:38:18 +00:00
Marco Pivetta
05db65d034 Merge pull request #1341 from javiereguiluz/patch-6
[doc] Minor fixes and typos
2015-03-18 22:02:15 +00:00
Javier Eguiluz
be18915ed6 Minor fixes and typos 2015-03-18 17:27:31 +01:00
Benjamin Eberlei
b3a6fb7fde [DDC-3461] Renamed AssocationBuilder::isPrimaryKey() to makePrimaryKey(). Same for FieldBuilder and depreceating isPrimaryKey(). Adjust tests. Revert change in ClassMetadataInfo and fix bug. 2015-03-18 17:06:30 +01:00
Marco Pivetta
df8be6f31e Correcting import that was colliding with another already imported User type 2015-03-17 23:58:53 +00:00
Marco Pivetta
4daf383e4f Merge pull request #1303 from mrkrstphr/querybuilder-get-all-aliases
make QueryBuilder::getAllAliases public
2015-03-17 23:33:43 +00:00
Marco Pivetta
3b0fb6b4b8 Merge pull request #1274 from doctrine/persistent-collection-as-lazy-collection
PersistentCollection now extends AbstractLazyCollection.
2015-03-17 23:32:17 +00:00
Marco Pivetta
1add0a04fa Merge pull request #1302 from goetas/pr1301
Store column values of not cache-able associations
2015-03-17 23:27:04 +00:00
Benjamin Morel
517cb7e2a2 Honor convertToDatabaseValueSQL() in DQL query parameters 2015-03-18 00:24:41 +01:00
Marco Pivetta
0738571b7d Merge branch 'feature/#1316-allow-non-public-schema-join-tables'
Close #1316
2015-03-17 23:16:26 +00:00
Marco Pivetta
648fde8914 #1316 - removing useless null check (redundant with isset()), cs cleanups 2015-03-17 23:16:16 +00:00
Marco Pivetta
4095bbaa92 #1316 - adding @group annotation to newly introduced tests 2015-03-17 23:15:07 +00:00
Marco Pivetta
0c0d3a1a7c #1316 - removing unused API from stub class 2015-03-17 23:14:29 +00:00
Marco Pivetta
bfd628e153 #1316 - refactoring test code to reduce the number of actual involved systems (quote strategy) 2015-03-17 23:14:13 +00:00
molchanoviv
ab740abe96 Add DefaultQuoteStrategyTest::testGetJoinTableName() test 2015-03-17 23:03:03 +00:00
molchanoviv
f244db80fb Allow to join non-public schema tables 2015-03-17 23:03:03 +00:00
Marco Pivetta
8f0b3398d3 Merge branch 'hotfix/#1327-entity-generator-default-property-value-export'
Close #1327
2015-03-17 22:47:50 +00:00
Jeremy
ac9a5e69ec Properly generate default value from yml & xml mapping 2015-03-17 22:47:11 +00:00
Bill Schaller
5c4b6a2140 resolve nitpicks from @Ocramius and @deeky666 2015-03-17 18:44:03 -04:00
Marco Pivetta
ce41e35c1f Merge branch 'hotfix/#1338-identity-map-garbage-collection-prevention-on-canceled-remove'
Close #1338
2015-03-17 22:38:19 +00:00
Marco Pivetta
0a2d9fa130 #1338 - Removing redundant test case 2015-03-17 22:36:00 +00:00
Bill Schaller
d710555265 Remove shameful hack in LimitSubqueryOutputWalker - replace with significantly less shameful hack 2015-03-17 18:32:57 -04:00
Marco Pivetta
504552e779 Adding @group annotations for newly introduced tests 2015-03-17 22:31:05 +00:00
Marco Pivetta
b721841c73 #1338 DDC-3619 - moved test to unit of work tests 2015-03-17 22:30:06 +00:00
nclavaud
b492d61398 Update identityMap when entity gets managed again
http://www.doctrine-project.org/jira/browse/DDC-3619

When using SoftDeleteable doctrine extension, an entity can be scheduled
for deletion, then persisted before flushing. In such a case, the entity
was removed from the unit of work identity map and no reference was
hold. This could lead to spl_object_hash collisions, and prevent
another, new entity to be persisted later.

This fix makes sure the unit of work identity map holds a reference to
the entity after it has been soft-deleted.
2015-03-17 22:19:10 +00:00
Bill Schaller
df0875c596 Fix Paginator OrderBy clauses when ordering by columns from non-fetched joined tables 2015-03-17 17:32:28 -04:00
Marco Pivetta
da72f3e62c Merge branch 'hotfix/#1336-handle-custom-object-type-identifiers-in-uow'
Close #1336
2015-03-17 21:31:03 +00:00
Marco Pivetta
5c89bb8c6b #1336 DDC-3622 - removing implicit cast from string to CustomIdObject in entity API (confusing) 2015-03-17 21:29:30 +00:00
Marco Pivetta
712b6a7a64 #1336 DDC-3622 - adding @group annotations for newly introduced tests 2015-03-17 21:23:16 +00:00
Marco Pivetta
11da060668 #1336 - class constants over string references in tests - removing useless QueryBuilder usage 2015-03-17 21:21:20 +00:00
Marco Pivetta
40c41857e8 #1333 - Removing unused is_string() function call and cast (always a string) 2015-03-17 21:12:20 +00:00
Marco Pivetta
d6687e070e #1333 - Removing useless is_string() function call, clarifying docblock parameters 2015-03-17 21:11:43 +00:00
Stefano Torresi
5d6a39d14c fix tests tear down 2015-03-17 21:08:07 +00:00
Stefano Torresi
904bcfa4f9 add docs notice about custom object types as IDs 2015-03-17 21:08:07 +00:00
Stefano Torresi
c7ad932b5f fix copyright notices 2015-03-17 21:08:07 +00:00
Stefano Torresi
1b850fbb23 add missing return statement 2015-03-17 21:08:07 +00:00
Stefano Torresi
2bdc1142fe add string casting to id hashes 2015-03-17 21:08:06 +00:00
Stefano Torresi
41e873bd72 add failing functional test for custom id object types 2015-03-17 21:08:06 +00:00
Marco Pivetta
32137c72e4 Merge branch 'hotfix/#1333-datetime-immutable-dql-parameter-inference'
Close #1333
2015-03-17 21:01:05 +00:00
Marco Pivetta
376e74fb7e #1333 - minor CS fixes - spacing/PSR-2 2015-03-17 20:59:56 +00:00
Jan Langer
8ac66bb608 Allow DateTimeInterface as parameter value 2015-03-17 20:58:20 +00:00
Bill Schaller
eebce88146 Revert "Revert "Merge branch 'hotfix/#1220-sort-paginator-subquery-output-only-once'""
This reverts commit 6a1755972d.
2015-03-17 13:58:50 -04:00
Karl Rixon
778ed04eac Support embeddables in partial object query expression [DDC-3621] 2015-03-17 15:46:01 +00:00
Marco Pivetta
2fb11cdf05 Merge pull request #1335 from BenMorel/queryreturntype
Fix AbstractQuery::getParameter() documented return type
2015-03-17 14:58:21 +00:00
Benjamin Morel
8d7ba1aebb Fixed AbstractQuery::getParameter() documented return type 2015-03-17 15:53:09 +01:00
Marco Pivetta
89ab4b3f48 Merge pull request #1334 from acrobat/internal-phpdoc-fix
Changed some wrong usage of the @internal phpdoc
2015-03-15 19:08:02 +01:00
Jeroen Thora
a409e7591d Changed some wrong usage of the @internal phpdoc 2015-03-15 16:53:34 +01:00
Marco Pivetta
6cf76158a0 Merge pull request #1329 from Wilt/patch-1
Fix for inconsistent use of getSQLDeclaration
2015-03-13 17:44:40 +01:00
Marco Pivetta
d87118437e Merge pull request #1330 from coolmic/patch-1
Fix @Column options sections in documentation
2015-03-12 22:16:28 +01:00
Marco Pivetta
cdc739b7f8 Merge pull request #1331 from 1ed/patch-2
[DOCS] Fixed class name in aggregate fields example
2015-03-12 22:14:38 +01:00
Gábor Egyed
6a75bf078b [DOCS] Fixed class name in aggregate fields example 2015-03-12 19:27:54 +01:00
Coolmic
f2d8b6d762 Fix @Column options sections
I lose hours to find out how to make column collation works, mostly because of incorrect docs.

Annotations options is the equivalent of customSchemaOptions in https://github.com/doctrine/dbal/blob/master/docs/en/reference/schema-representation.rst

See d1e5034659/lib/Doctrine/ORM/Tools/SchemaTool.php (L443)
2015-03-12 12:22:59 +01:00
Wilt
228dc895ca getSqlDeclaration -> getSQLDeclaration
Fixed inconsistent use of getSQLDeclaration method
2015-03-11 14:14:29 +01:00
Wilt
a6931dedaf getSqlDeclaration -> getSQLDeclaration
Fixed inconsistent use of getSQLDeclaration method
2015-03-11 14:07:04 +01:00
Wilt
5ae888b853 getSqlDeclaration -> getSQLDeclaration
Fixed inconsistent use of getSQLDeclaration method
2015-03-11 14:06:36 +01:00
Wilt
ea70e080c2 getSqlDeclaration -> getSQLDeclaration
Fixed inconsistent use of getSQLDeclaration method
2015-03-11 14:05:36 +01:00
Marco Pivetta
cfc7236599 Merge pull request #1319 from TomasVotruba/patch-1
travis: PHP 7.0 nightly added
2015-03-11 01:12:18 +01:00
Marco Pivetta
a3f9f153dd Merge pull request #1321 from vvh-empora/master
embeddedClasses support...
2015-03-10 21:53:05 +01:00
Marco Pivetta
73d4d88ba1 Merge pull request #1326 from guiwoda/orphan-removal-association-builder
Allow AssociationBuilder to set a relation as orphan removal
2015-03-09 23:18:59 +01:00
Guido Contreras Woda
71821bb7a3 Allow AssociationBuilder to set a relation as orphan removal 2015-03-09 18:54:35 -03:00
Volker von Hoesslin
0824c6136d unittest DDC3597: fix for PHP 5.4 2015-03-04 11:55:08 +01:00
Marco Pivetta
34b7f07344 Merge pull request #1322 from dennisbirkholz/patch-1
Typo in documentation
2015-03-04 03:07:37 +00:00
Volker von Hoesslin
2aef87c9b2 add unittest for DDC3597 2015-03-03 16:59:48 +01:00
Dennis Birkholz
69e5562de4 Typo in documentation
Two list items where just one
2015-03-03 16:57:51 +01:00
vvh-empora
6afcac84d0 embeddedClasses support...
...for JoinedSubclassPersister.php
2015-03-03 11:40:19 +01:00
Tomas Votruba
0e14136fad travis: PHP 7.0 nightly added 2015-03-02 20:41:50 +01:00
Marco Pivetta
f2f47930e6 Merge pull request #1320 from joshdifabio/patch-1
Fix 'entitiy' typo in Getting Started tutorial
2015-03-02 16:58:05 +00:00
Joshua Di Fabio
dce76bba60 Fix 'entitiy' typo in Getting Started tutorial 2015-03-02 16:53:44 +00:00
Guilherme Blanco
b1d918b124 Fixed more broken tests. 2015-03-01 23:57:38 -05:00
Guilherme Blanco
588c92875d Removed fragile test. 2015-03-01 00:32:43 -05:00
Guilherme Blanco
19f18fa069 PersistentCollection now extends AbstractLazyCollection. 2015-03-01 00:30:21 -05:00
Guilherme Blanco
6e40361fe7 Merge pull request #1311 from jankramer/DDC-3582-nested-embeddable-hydration
[DDC-3582] Wrong class is instantiated when using nested embeddables
2015-02-27 10:31:58 -05:00
Jan Kramer
f09b9895b6 Fix embeddable instantiation in nested situations 2015-02-27 15:09:58 +01:00
Jan Kramer
c059de9e60 Implement test to show nested embeddables are not instantiated properly 2015-02-27 15:09:22 +01:00
Marco Pivetta
a41e774bb1 Merge pull request #1314 from FabioBatSilva/date-add-second
DATE_ADD - Support for seconds
2015-02-26 10:20:52 +00:00
Marco Pivetta
94223621dc Merge pull request #1315 from GeekMode/GeekMode-patch-url-fix
Fixed broken url for implementing Serializable interface
2015-02-26 08:49:22 +00:00
Niro
1afaec9cbf Fixed broken url for implementing Serializable interface 2015-02-26 02:53:37 -05:00
Guilherme Blanco
7fc1dc9209 Merge pull request #1313 from doctrine/querybuilder-indexby
Added programmatical support to define indexBy on root aliases.
2015-02-25 14:42:13 -05:00
FabioBatSilva
57bcd7cd3d DATE_ADD - Support for seconds 2015-02-25 14:32:51 -05:00
Guilherme Blanco
5ab4c3d50c Added programatical support to define indexBy on root aliases. 2015-02-25 14:29:10 -05:00
Guilherme Blanco
1369cdda2b Merge pull request #1312 from ThomasLomas/master
Add proper pluralization into UpdateCommand
2015-02-24 13:37:34 -05:00
Thomas Lomas
37f5c82d15 Add proper pluralization into UpdateCommand 2015-02-24 18:13:13 +00:00
Asmir Mustafic
d33ee5e7ff Removed unnecessary API from test cases 2015-02-24 08:53:22 +01:00
Nicolas Grekas
bad6593460 Allow symfony 3.0 components
Tests should tell if any deprecated interfaces of Symfony are used. If not, then the bundle is defacto compatible with 3.0
2015-02-22 20:13:44 +01:00
Guilherme Blanco
4680a7b861 Fixed bug where embedded reflection fields were never exposed to userland. 2015-02-20 14:10:28 -05:00
Asmir Mustafic
4d43f5ca52 Tested composite keys on non cache-able entities 2015-02-20 19:00:32 +01:00
Asmir Mustafic
d72ad9cc50 Handling composite keys on non cache-able entities 2015-02-20 10:00:36 +01:00
Marco Pivetta
38c819ae04 Merge pull request #1305 from guillaumerobin/patch-2
Documentation : fix table prefix with STI
2015-02-16 21:35:28 +00:00
Guillaume Robin
1661d96b92 Documentation : fix table prefix with STI
If an Entity use STI, it gets its table name from the parent class. In this case, we need to check that the class is the root class of the hierarchy when adding prefix, otherwise children class are prefixed twice.
2015-02-16 22:11:30 +01:00
Kristopher Wilson
a6448f5c77 make QueryBuilder::getAllAliases public 2015-02-16 08:31:14 -05:00
Asmir Mustafic
24dd0c6a55 Fixed delete order on tearDown method 2015-02-16 08:55:27 +01:00
Asmir Mustafic
b9577bf2f3 Added tests for many-to-one non cache-able relations 2015-02-16 08:55:27 +01:00
Asmir Mustafic
60164931b8 Handled one-to-many non cache-able relations 2015-02-16 08:55:27 +01:00
Asmir Mustafic
a2461d6d5f Use identifier flattener to retrevie entity identifiers 2015-02-16 08:55:27 +01:00
Asmir Mustafic
58e20c70c6 Store column values of not cache-able associations 2015-02-16 08:55:27 +01:00
Michaël Gallego
ed6fa0deb4 Add failing test 2015-02-16 08:55:27 +01:00
Marco Pivetta
a13143b1ac Merge branch 'feature/#1229-to-one-association-builder'
Close #1229
2015-02-16 02:06:32 +00:00
Marco Pivetta
1f67218dc5 #1229 - code style fixes (alignment/spacing) 2015-02-16 02:06:22 +00:00
Guido Contreras Woda
baeab5d4f4 More consistent test naming 2015-02-16 02:02:29 +00:00
Guido Contreras Woda
51881fed94 Added tests and validation on joinColumns being set before checking if its a composite key. 2015-02-16 02:02:29 +00:00
Guido Contreras Woda
cd728344e9 Allow an association to be set as primary key through the builder 2015-02-16 02:02:29 +00:00
Marco Pivetta
b5238966d1 Merge branch 'hotfix/#1295-fix-join-when-re-creating-query-builder-from-parts'
Close #1295
2015-02-16 01:23:54 +00:00
Dries De Peuter
4a6afb46e2 Fix join when recreation of query from parts. 2015-02-16 01:23:27 +00:00
Marco Pivetta
f90897465c Merge branch 'hotfix/#1113-composite-pk-improved-support'
Close #1113
2015-02-16 01:17:48 +00:00
Marco Pivetta
2a99d5a19b #1113 - minor CS fixes (spacing/alignment) 2015-02-16 01:02:56 +00:00
Asmir Mustafic
8eea7c86f7 Resolve association entries on multi get cache 2015-02-16 00:53:48 +00:00
Asmir Mustafic
cb52782e5e Default Version Value identifier is always an array 2015-02-16 00:53:47 +00:00
Asmir Mustafic
c9e66e464d Changed getSelectConditionStatementColumnSQL return docblock 2015-02-16 00:53:47 +00:00
Asmir Mustafic
1630ec1ebd Fixed owing-inverse side search by criteria 2015-02-16 00:53:47 +00:00
Asmir Mustafic
4d531d8855 Right type detection on to-many relations 2015-02-16 00:53:47 +00:00
Asmir Mustafic
4323d9ce4c Removed unused methods 2015-02-16 00:53:47 +00:00
Asmir Mustafic
7948b0c160 Identity map check 2015-02-16 00:53:47 +00:00
Asmir Mustafic
5838115582 Fixed type checking on to-many relations 2015-02-16 00:53:47 +00:00
Asmir Mustafic
2e890362c5 Tested second level cache with composite primary keys 2015-02-16 00:53:46 +00:00
Asmir Mustafic
51b34919ba Second level cache check with composite primary keys 2015-02-16 00:53:46 +00:00
Asmir Mustafic
7222991b13 Tested composite primary key support 2015-02-16 00:53:46 +00:00
Asmir Mustafic
5e29bbd41f Improved composite primary key support 2015-02-16 00:53:46 +00:00
Asmir Mustafic
2eb7dedf4f Refactored IdentifierFlattener 2015-02-16 00:53:46 +00:00
Marco Pivetta
081ad0efbe Merge pull request #1297 from eugene-dounar/docs-embeddable-mapping
[DDC-3480] Docs: Embeddable supported mappings
2015-02-14 23:20:09 +01:00
Marco Pivetta
eb90cf0c3b Merge pull request #1298 from eugene-dounar/docs-clean-up-toc
Docs: Remove empty pages from TOC
2015-02-14 23:18:48 +01:00
Guilherme Blanco
4c68a38bd6 Merge pull request #1294 from weaverryan/target-platform-when-needed
Avoid Connection error when calling ClassMetadataFactor::getAllMetadata()
2015-02-04 16:42:55 -05:00
Ryan Weaver
0e08633790 Adding docblock 2015-02-04 13:51:02 -05:00
Ryan Weaver
75bb3a0de3 Small code change thanks to the comments and adding a test 2015-02-04 13:49:51 -05:00
Steve Müller
a0f3b75ec0 Merge pull request #1299 from javiereguiluz/patch-5
Fixed missing quote in one DQL example
2015-02-04 11:40:57 +01:00
Javier Eguiluz
aa0f18def3 Fixed missing quote in one DQL example 2015-02-04 11:12:15 +01:00
Eugene Dounar
f996f6583a Remove empty pages from TOC
Remove Installation page from TOC as it was moved to "Installation and
Configuration"
2015-02-04 00:44:57 +03:00
Eugene Dounar
cd7f91910b Docs: Embeddable supported mappings
Mention that only basic mapping is supported by embeddables
2015-02-04 00:17:13 +03:00
Marco Pivetta
78d3f51140 Merge pull request #1296 from joenivl/patch-1
Flip key value in $namespaces array
2015-02-03 14:48:44 +00:00
Jeroen van Leeuwen
f9cf2b6a95 Flip key value in $namespaces array
Key value should be other way around.
2015-02-03 14:54:21 +01:00
Guilherme Blanco
64ef89ce4c Merge pull request #1292 from goetas/private-method-mark
Mark getSelectConditionStatementColumnSQL method as private
2015-01-28 22:11:49 -05:00
Ryan Weaver
b30d1dd39c Only getting the target platform when it's *actually* needed to avoid errors
initialize() is called sometimes, even when the following code doesn't need
the targetPlatform property. Specifically, in AbstractClassMetadataFactory::getAllMetadata().

But as of DBAL 2.5.0, calling Connection::getDatabasePlatform() will make a
connection to the database, which means that sometimes it may fail (e.g. you
haven't configured your database yet). As a result, calling a method like
AbstractClassMetadataFactory::getAllMetadata() - which does not need the
targetPlatform - will fail, because determining the targetPlatform requires
a connection, which fails.

This avoids that - we only get the targetPlatform *when* we need it, which
are cases where we're doing things that do indeed need a connection.
2015-01-28 20:17:28 -05:00
Asmir Mustafic
fb5cd928ee Mark getSelectConditionStatementColumnSQL method as private 2015-01-28 23:55:20 +01:00
Marco Pivetta
17a23ea825 Merge pull request #1222 from guiwoda/embeddables-in-metadata-builder
Embeddables in metadata builder
2015-01-28 22:25:10 +00:00
Marco Pivetta
3ed73b4a60 Merge pull request #1288 from Ocramius/hotfix/#1169-extra-lazy-one-to-many-is-noop-when-not-doing-orphan-removal
Hotfix - #1169 - extra lazy one to many must be no-op when not doing orphan removal
2015-01-28 20:27:22 +00:00
Marco Pivetta
e76b20b109 #1169 DDC-3343 - removing note about query count assertion 2015-01-28 20:01:57 +00:00
Marco Pivetta
ffaffa0b8a Merge pull request #1290 from phansys/doc-slc
[Doc] [Reference] [Second Level Cache]
2015-01-27 16:37:22 +00:00
Javier Spagnoletti
c6158ae3f4 Updated reference for Second Level Cache (fixed some typos and docblocks). 2015-01-27 13:24:35 -03:00
Marco Pivetta
969788d928 Merge pull request #1289 from deeky666/improve-testsuite
Improve test suite
2015-01-27 12:24:36 +00:00
Steve Müller
3b61d2d0fe initialize database schema only once and avoid unnecessary connections 2015-01-27 12:28:31 +01:00
Steve Müller
75e41eefb5 fix indentation 2015-01-27 10:02:57 +01:00
Steve Müller
5795d53ca7 remove temporary database dependencies from Travis build 2015-01-27 09:44:06 +01:00
Steve Müller
2fbc483fe3 apply current implementation from DBAL @ dcdf744e3fdd2ba99239ee41009e08a4b6450eff 2015-01-27 09:40:45 +01:00
Marco Pivetta
c7a6352b08 #1169 DDC-3343 - eagerly evicting cache if a persister passes a delete operation down to the DB 2015-01-27 09:04:28 +01:00
Marco Pivetta
a9671fdc2e #1169 DDC-3343 - eagerly evicting cache if a persister passes a delete operation down to the DB 2015-01-27 09:04:00 +01:00
Marco Pivetta
c4019d96b9 #1169 DDC-3343 - when a deletion fails for some reason, related cache entries should be evicted to avoid collisions with DB state 2015-01-27 09:03:36 +01:00
Marco Pivetta
f32766c00d #1169 DDC-3343 - when using one-to-many extra-lazy with orphan-removal, referenced entities should be deleted directly 2015-01-27 07:46:31 +01:00
Marco Pivetta
3f28adf9b6 #1169 DDC-3343 - correcting collection name used in tests 2015-01-27 07:45:58 +01:00
Marco Pivetta
a0eb6005f3 #1169 DDC-3343 - adding tests for orphan-removal + extra-lazy + one-to-many element removal behavior 2015-01-27 07:42:48 +01:00
Marco Pivetta
9eaac13615 #1169 DDC-3343 - correcting one-to-many persister - association should not be updated directly if no orphan removal is involved 2015-01-27 06:27:37 +01:00
Marco Pivetta
539c364ca6 #1169 DDC-3343 - updating test expectations - one-to-many changes should be no-op unless orphan removal is specified. 2015-01-27 06:26:55 +01:00
Marco Pivetta
9839c400b8 #1169 DDC-3343 - updating test expectations - one-to-many changes should be no-op unless orphan removal is specified. 2015-01-27 06:19:26 +01:00
Marco Pivetta
7e8d27d41a Merge pull request #1287 from BenMorel/patch-1
Typo fix
2015-01-26 01:53:41 +01:00
Benjamin Morel
58e2510f41 Typo fix 2015-01-25 23:54:59 +01:00
Marco Pivetta
146354d835 Merge pull request #1280 from Ocramius/hotfix/#1277-find-one-with-eager-loads-is-failing
[DDC-3346] #1277 find one with eager loads is failing
2015-01-25 06:00:47 +01:00
Marco Pivetta
d024193cc0 Merge pull request #1272 from Ocramius/hotfix/DDC-2704-merge-inherited-transient-properties
[DDC-2704] - merge inherited transient properties - merge properties into uninitialized proxies
2015-01-25 05:55:53 +01:00
Marco Pivetta
d62cb6237f Merge pull request #1286 from Ocramius/feature/remove-xdebug-from-non-coverage-builds
Removing XDebug from non-coverage builds
2015-01-25 05:51:11 +01:00
Marco Pivetta
5bf18298b1 Merge pull request #1281 from Ocramius/hotfix/#1169-extra-lazy-one-to-many-should-not-delete-referenced-entities
Hotfix/#1169 extra lazy one to many should not delete referenced entities
2015-01-25 05:43:34 +01:00
Marco Pivetta
3570f4a49a #1277 DDC-3346 - disabling XDebug only for non-hhvm builds 2015-01-25 05:42:24 +01:00
Marco Pivetta
670acfc693 Removing XDebug from non-coverage builds 2015-01-25 05:35:31 +01:00
Marco Pivetta
d4b278c809 #1277 DDC-3346 - removing leftover comments 2015-01-25 05:03:19 +01:00
Marco Pivetta
cb780e8bb6 #1169 DDC-3343 - factoring logging into cached collection persister changes 2015-01-25 04:45:45 +01:00
Marco Pivetta
7e85c94f48 #1169 DDC-3343 - adapting cached collection persister logic to EXTRA_LAZY collection behavior 2015-01-25 04:40:30 +01:00
Marco Pivetta
4a05e19f37 Merge pull request #1283 from Ocramius/hotfix/#1267-order-by-broken-in-pagination-logic
#1267 - order by broken in pagination logic (reverts #1220)
2015-01-24 19:20:00 +01:00
Marco Pivetta
97ea6a7d85 #1277 DDC-3346 - removing array-based persister context handling (better to just use private props) 2015-01-24 14:39:47 +01:00
Marco Pivetta
dff365318d #1277 DDC-3346 DDC-3531 - enforcing 0 offset to avoid persisting more than 1 row 2015-01-24 14:39:47 +01:00
Marco Pivetta
186c593058 #1277 DDC-3346 DDC-3531 - proper bi-directional association setup 2015-01-24 14:39:46 +01:00
Marco Pivetta
39a8941d1b #1277 DDC-3346 DDC-3531 - minor CS fixes/cleanups: avoiding setters 2015-01-24 14:39:46 +01:00
Marco Pivetta
04a271a04e #1277 DDC-3346 DDC-3531 - refactoring test assets for readability 2015-01-24 14:39:46 +01:00
Marco Pivetta
36bc448880 #1277 DDC-3346 DDC-3531 - refactoring test code for simplicity/readability 2015-01-24 14:39:46 +01:00
Marco Pivetta
16f447d1ac #1277 DDC-3346 DDC-3531 - correct usage of the model set (setUp/tearDown of model-related tables) 2015-01-24 14:39:46 +01:00
Marco Pivetta
6e3ad496e2 #1277 DDC-3346 DDC-3531 - constants over string references 2015-01-24 14:39:45 +01:00
Marco Pivetta
157bf203bc #1277 DDC-3346 DDC-3531 - additional tests for LIMIT and OFFSET repository API (must not hydrate collections) 2015-01-24 14:39:45 +01:00
Marco Pivetta
1672448993 #1277 DDC-3346 DDC-3531 - renaming persister context switch for clarity 2015-01-24 14:39:45 +01:00
Marco Pivetta
a37fa97be3 #1277 DDC-3346 DDC-3531 - skipping joining of associations when limiting and fetch-joining to-many eager associations 2015-01-24 14:39:45 +01:00
Marco Pivetta
67f60f2286 #1277 DDC-3346 DDC-3531 - switching persister context at runtime, depending on choices 2015-01-24 14:39:44 +01:00
Marco Pivetta
23a0d9a1fb #1277 DDC-3346 DDC-3531 - switch persister context at runtime 2015-01-24 14:39:44 +01:00
Marco Pivetta
8b9171c8ad #1277 DDC-3346 DDC-3531 - caching the currently in use persister context 2015-01-24 14:39:44 +01:00
Marco Pivetta
ebdfab8f2c #1277 DDC-3346 DDC-3531 - moved sqlTableAliases into the newly created CachedPersisterContext 2015-01-24 14:39:44 +01:00
Marco Pivetta
2a7f149029 #1277 DDC-3346 DDC-3531 - moved sqlAliasCounter into the newly created CachedPersisterContext 2015-01-24 14:39:44 +01:00
Marco Pivetta
b9f698c98c #1277 DDC-3346 DDC-3531 - moved selectJoinSql into the newly created CachedPersisterContext 2015-01-24 14:39:43 +01:00
Marco Pivetta
55930a3402 #1277 DDC-3346 DDC-3531 - moved selectColumnListSql into the newly created CachedPersisterContext 2015-01-24 14:39:43 +01:00
Marco Pivetta
4c62d3bfda #1277 DDC-3346 DDC-3531 - moved resultsetmapping into the newly created CachedPersisterContext 2015-01-24 14:39:43 +01:00
Pavel Batanov
981cebbf4c Update test according to @Ocramius notes 2015-01-24 14:39:43 +01:00
Pavel Batanov
e36c7b0c2a DDC-3346 failing test example 2015-01-24 14:39:42 +01:00
Marco Pivetta
28e0da4321 #1272 DDC-2704 - reverting classmetadata API changes (moved all to reflection property getter API) 2015-01-24 14:32:23 +01:00
Marco Pivetta
d952077d04 #1272 DDC-2704 - using the property getter utility rather than metadata API when fetching reflection properties for a class 2015-01-24 14:30:40 +01:00
Marco Pivetta
05a8e1c77d #1272 DDC-2704 - test assets for the property getter utility tests 2015-01-24 14:30:07 +01:00
Marco Pivetta
1aa453d493 #1272 DDC-2704 - property getter utility is package private 2015-01-24 14:29:40 +01:00
Marco Pivetta
5ec300452a #1272 DDC-2704 - implementation for a property getter utility 2015-01-24 14:29:09 +01:00
Marco Pivetta
1b0a5e38d9 #1272 DDC-2704 - specification for a property getter utility 2015-01-24 14:28:54 +01:00
Marco Pivetta
8910c2c482 DDC-2704 - data should be merged only into initialized proxies 2015-01-24 13:22:16 +01:00
Marco Pivetta
91f4ed8b92 DDC-2704 - data should be merged only into initialized proxies 2015-01-24 13:22:16 +01:00
Marco Pivetta
21995a8b10 DDC-2704 - more explicit value checking 2015-01-24 13:22:16 +01:00
Marco Pivetta
30dcece125 DDC-2704 - covering code handling class metadata skipping of static properties 2015-01-24 13:22:16 +01:00
Marco Pivetta
3df9b4d122 DDC-2704 - synchronized model classes to new test code 2015-01-24 13:22:16 +01:00
Marco Pivetta
885700d38c DDC-2704 - should initializeAllReflectionProperties also on initializeReflection 2015-01-24 13:22:16 +01:00
Marco Pivetta
bd667b82d9 DDC-2704 - carefully checking defined classes in getAllReflectionProperties 2015-01-24 13:22:16 +01:00
Marco Pivetta
a4982a8dc2 DDC-2704 - handling partial initialization of the class as expected (class metadata may not hold reflection class after wakeup) 2015-01-24 13:22:15 +01:00
Marco Pivetta
1e6c071bb8 DDC-2704 - trying to get all reflection properties from a partially initialized class metadata instance will result in a failure 2015-01-24 13:22:15 +01:00
Marco Pivetta
4e08c99b86 DDC-2704 - trying to get all reflection properties from an unitialized class metadata instance will result in a failure 2015-01-24 13:22:15 +01:00
Marco Pivetta
0a3d6966d6 DDC-2704 - providing hotfix - also storing inherited transient properties in the class metadata 2015-01-24 13:22:15 +01:00
Marco Pivetta
5ae980e0f9 DDC-2704 - reducing test case clutter 2015-01-24 13:22:15 +01:00
Marco Pivetta
302e6218bb DDC-2704 - renaming test case for clarity 2015-01-24 13:22:15 +01:00
Marco Pivetta
942004226c DDC-2704 - basic test case verifying that merged transient properties are not handled when in an inheritance 2015-01-24 13:22:15 +01:00
Marco Pivetta
6a1755972d Revert "Merge branch 'hotfix/#1220-sort-paginator-subquery-output-only-once'"
This reverts commit 8f097ab304, reversing
changes made to b23a8dd429.

Conflicts:
	tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php
2015-01-24 13:10:25 +01:00
Austin Morris
c8160fcd0e Failing test for an ORDER BY that is INNER JOINED in a subquery 2015-01-24 13:07:56 +01:00
Marco Pivetta
01a9dadee7 #1169 DDC-3343 - removed unused imports 2015-01-24 12:54:40 +01:00
Marco Pivetta
b7b716a6bb #1169 DDC-3343 - moved tests to correct test class 2015-01-24 12:53:48 +01:00
Marco Pivetta
d443d4f3b6 #1169 DDC-3343 - additional test cases: removing proxies from an extra-lazy collection still updates the owning side values 2015-01-24 12:21:21 +01:00
Marco Pivetta
6a2b7c2a8e #1169 DDC-3343 - correcting query count assertions on extra-lazy specific tests (some DELETE operations became UPDATE operations) 2015-01-24 12:20:33 +01:00
Marco Pivetta
99c5650ba4 #1169 DDC-3343 - removing duplicate test 2015-01-24 11:59:21 +01:00
Marco Pivetta
a8796fa489 #1169 DDC-3343 - integrating tests into the existing test suite 2015-01-24 11:58:57 +01:00
Marco Pivetta
ff986a9bf5 #1169 DDC-3343 - importing used classe 2015-01-24 11:54:58 +01:00
Marco Pivetta
ed0331d25a #1169 DDC-3343 - optimized imports 2015-01-24 11:54:32 +01:00
Marco Pivetta
43f301fdad #1169 DDC-3343 - refactoring test to use pre-existing test models 2015-01-24 11:54:17 +01:00
Marco Pivetta
15397bbe40 #1169 DDC-3343 - refactoring test to use pre-existing test models 2015-01-24 11:54:03 +01:00
Marco Pivetta
aed01ea571 #1169 DDC-3343 - minor refactoring: constant over string reference 2015-01-24 11:41:20 +01:00
Marco Pivetta
f184956d3a #1169 DDC-3343 - one-to-many extra-lazy should not delete associated values when they are removed, but just update the owning side 2015-01-24 11:40:48 +01:00
Andrea Sprega
c2b3348f99 [DDC-3343] Failing test case (updated) 2015-01-24 11:30:17 +01:00
Andrea Sprega
db3697433b [DDC-3343] Failing test case 2015-01-24 11:30:17 +01:00
Marco Pivetta
3f360d7fbc Merge branch 'hotfix/#1257-discriminator-map-changes-documentation' 2015-01-24 09:21:27 +01:00
Marco Pivetta
52fb4e53bc #1257 DDC-3300 DDC-3503 - describing new inheritance map requirements in the upgrade notes/blogpost 2015-01-24 09:21:13 +01:00
Marco Pivetta
efa375ac96 #1257 DDC-3300 DDC-3503 - providing upgrade notes for the breaking change in discriminator map declarations 2015-01-24 09:14:58 +01:00
Marco Pivetta
22533042a5 Merge pull request #1279 from phansys/doc-slc
[Doc][Reference][2nd level cache]
2015-01-23 16:25:53 +01:00
Javier Spagnoletti
72785eb27e [Doc][Reference][2nd level cache]
* Fixed typo in TimestampRegion title.
* Normalized php snippets (comments, indentation).
2015-01-23 11:23:21 -03:00
Marco Pivetta
b889e18a9a Merge branch 'hotfix/#1176-merging-entities-with-composite-association-identifier'
Close #1176
2015-01-22 12:11:16 +01:00
Marco Pivetta
a67332fb51 #1176 DDC-3378 - minor CS fixes (imports, spacing, IDE hints) 2015-01-22 12:11:03 +01:00
Marco Pivetta
8305649a45 #1176 DDC-3378 - refactored test logic to use the newly introduced test assets 2015-01-22 12:10:39 +01:00
Marco Pivetta
8987c9ab37 #1176 DDC-3378 - moved test asset entities to proper models directory 2015-01-22 12:07:42 +01:00
Adrien Brault
f189c1aaf0 Update test to valid use case 2015-01-22 11:18:12 +01:00
Adrien Brault
fc8191f557 Naive fix 2015-01-22 11:18:12 +01:00
Adrien Brault
4058ad3958 Add test exposing UnitOfWork merge bug 2015-01-22 11:18:12 +01:00
Marco Pivetta
dfa4bbd67a Merge branch 'hotfix/resolve-target-entity-also-in-discriminator-map'
Close #1257
2015-01-22 09:52:17 +01:00
Marco Pivetta
6547d5462e #1257 DDC-3300 - strengthening test case (missing assertion, test name) 2015-01-22 09:51:43 +01:00
Marco Pivetta
c1cc768aee #1257 DDC-3300 - correcting further incomplete discriminator maps in the test suite 2015-01-22 09:50:59 +01:00
Marco Pivetta
cd3ffa8f14 #1130 DDC-3300 - removing typo causing parse error 2015-01-22 09:44:40 +01:00
Marco Pivetta
e969a6be85 #1130 DDC-3300 - rewording and clarifying logic that re-maps discriminator values when needed 2015-01-22 09:44:39 +01:00
Marco Pivetta
635d2c141f #1130 DDC-3300 - minor CS fix (EOF EOL) 2015-01-22 09:44:39 +01:00
Marco Pivetta
fbe294927f #1130 DDC-3300 - cleaning up test code 2015-01-22 09:44:39 +01:00
Marco Pivetta
8a6b1b48e3 #1130 DDC-3300 - removing unused ResolveDiscriminatorMapListener and related test 2015-01-22 09:44:39 +01:00
Marco Pivetta
b7c28924b1 #1130 DDC-3300 - fixed inheritance maps where inheritance members were missing 2015-01-22 09:44:39 +01:00
Marco Pivetta
a36bea2951 #1130 DDC-3300 - optimizing performance (looping over existing classes first): throwing exceptions if the class is not found in the discriminator map 2015-01-22 09:44:39 +01:00
Marco Pivetta
8579baf28c #1130 DDC-3300 - minor refactoring (else removal, spacing) 2015-01-22 09:44:39 +01:00
Marco Pivetta
786c34faa5 #1130 DDC-3300 - refactoring auto-remapping of discriminator value into a private method 2015-01-22 09:44:38 +01:00
Marco Pivetta
c589b5d013 #1130 DDC-3300 - re-mapping discriminator column at runtime (based on modified class metadata) 2015-01-22 09:44:38 +01:00
mmoreram
5a1a32297b Tested DDC-3300 2015-01-22 09:44:38 +01:00
mmoreram
93b6eeca54 Full resolveTargetEntities as constructor argument 2015-01-22 09:44:38 +01:00
mmoreram
fa45c0834d Removed unused construct param 2015-01-22 09:44:38 +01:00
mmoreram
2a6c844953 Using constructor to define environment 2015-01-22 09:44:38 +01:00
mmoreram
7a73d27600 Added resolve entities support in discrim. map 2015-01-22 09:44:38 +01:00
Marco Pivetta
39c36f6037 Merge pull request #1232 from PowerKiKi/doc-partial-indexes
Explicit example of partial indexes
2015-01-22 09:21:57 +01:00
Adrien Crivelli
3caaf26069 Explicit example of partial indexes 2015-01-22 16:38:24 +09:00
Marco Pivetta
3930fd50a7 Merge pull request #1273 from TrkiSF2/master
Incorrect @throws doc. in getSingleScalarResult
2015-01-20 22:42:11 +01:00
Lukáš Lukáč
ea213ef23c Merge pull request #1 from TrkiSF2/TrkiSF2-getSingleScalarResult-Doc
Incorrect @throws doc. in getSingleScalarResult
2015-01-20 17:24:29 +01:00
Lukáš Lukáč
5e6ec8ebf3 Incorrect @throws doc. in getSingleScalarResult 2015-01-20 17:21:43 +01:00
Guilherme Blanco
335492aed7 Merge pull request #1269 from spdionis/patch-1
[DDC-3520] self-update composer before install
2015-01-20 09:19:27 -05:00
Marco Pivetta
f019bf4379 Merge branch 'docs/#1264-2.5-upgrade-notes'
Close #1264
2015-01-20 12:12:57 +01:00
Marco Pivetta
542d9b664b #1264 - removing backtick 2015-01-20 12:11:39 +01:00
Marco Pivetta
daf2763894 Merge pull request #1271 from kix/patch-1
Update migration_2_5.rst
2015-01-20 11:41:32 +01:00
Stepan Anchugov
6ac0ae3c87 Update migration_2_5.rst
Fixed some formatting issues and typos.
2015-01-20 15:35:47 +05:00
Spinei Dionis
2528d0b3fc self-update composer before install
Updating composer before install seems like a good idea. At the moment for example the travis build is failing because of the new composer syntax with '^' and it would be fixed by composer self-update.
2015-01-20 03:31:42 +02:00
Guilherme Blanco
2418f8f5e6 Removed todo by implementing it. 2015-01-18 22:21:18 -05:00
Benjamin Eberlei
cd616ff40e Update changelog docs 2015-01-18 22:52:30 +01:00
Marco Pivetta
d8d4ec6eb2 Merge branch 'hotfix/#1265-sti-persister-one-to-one-association-notices'
Close #1265
2015-01-18 18:27:33 +01:00
Marco Pivetta
544add9e8b Merge branch 'hotfix/#1265-sti-persister-one-to-one-association-notices-fix' into hotfix/#1265-sti-persister-one-to-one-association-notices 2015-01-18 18:27:01 +01:00
Marco Pivetta
9abbdb9e7f #1265 DDC-3517 - moved test assets to separate models dir, namespaced table names 2015-01-18 18:25:46 +01:00
Marco Pivetta
185f22668c #1265 DDC-3517 - correcting test docblocks 2015-01-18 18:15:03 +01:00
Marco Pivetta
bffc99a116 #1265 DDC-3517 - failing test - finding via a STI root class fails if there is a one-to-one association in a subclass 2015-01-18 18:13:15 +01:00
Anderson Müller
d48093886d Fix error undefined index "targetEntity" 2015-01-18 15:54:43 +01:00
Benjamin Eberlei
79ba8c6be8 Add Changelog/Migration to 2.5 documentation chapter. 2015-01-18 15:18:18 +01:00
Marco Pivetta
61e07e5907 Handling minor HHVM incompatibility (dumped value is different between PHP and HHVM) 2015-01-18 02:54:18 +01:00
Marco Pivetta
7cba76082e Corrected test: metadata should be retrieved from a specific entity manager
Metadata is subject to modification depending on the active database platform (generator strategies, usually),
therefore it is not safe to pull it from an entity manager and sharing metadata across multiple entity managers.
2015-01-18 02:32:02 +01:00
Marco Pivetta
39766e645c Merge branch 'feature/#1248-better-exception-messages-on-invalid-association-data'
Close #1248
2015-01-18 01:07:08 +01:00
Marco Pivetta
c7f5ee8e9e #1228 DDC-3490 - Remove unused method 2015-01-18 01:05:53 +01:00
Marco Pivetta
b1d7a057fd #1228 DDC-3490 - avoid catching unknown exceptions, remove unused method call 2015-01-18 01:05:36 +01:00
Marco Pivetta
1cd03625a5 #1228 DDC-3490 - fixed exception catching in BasicFunctionalTest logic 2015-01-18 00:59:58 +01:00
Marco Pivetta
66479334d4 #1228 DDC-3490 - computing changes of invalid objects should also fail 2015-01-18 00:55:40 +01:00
Marco Pivetta
9c1275bb1f #1228 DDC-3490 - persistence of invalid values should also cause exceptions 2015-01-18 00:54:18 +01:00
Marco Pivetta
d0c0f43c79 #1228 DDC-3490 - preventing invalid association values from being persisted 2015-01-18 00:53:57 +01:00
Marco Pivetta
71a6a88de8 #1228 DDC-3490 -better/more complete exception message for invalid populated associations 2015-01-18 00:53:34 +01:00
Marco Pivetta
5e76f12000 #1228 DDC-3490 - tests for invalid association values handled in the UnitOfWork 2015-01-18 00:37:21 +01:00
flip111
83de071c00 Update ORMInvalidArgumentException.php
remove added `value` to exception
2015-01-18 00:16:10 +01:00
flip111
d1a2655090 Update UnitOfWork.php
rename duplicate method
2015-01-18 00:16:10 +01:00
flip111
b5dd999f84 Update ORMInvalidArgumentException.php
rename duplicate method
2015-01-18 00:16:10 +01:00
flip111
059c33e69d Update UnitOfWork.php
removed one `)` too many
2015-01-18 00:16:10 +01:00
flip111
1ae153d315 Update UnitOfWork.php 2015-01-18 00:16:10 +01:00
flip111
643ae78691 Update ORMInvalidArgumentException.php
Add unused parameters for `invalidAssociation`
2015-01-18 00:16:09 +01:00
flip111
04e4940607 Update ORMInvalidArgumentException.php
`@return self` trend break with `@return ORMInvalidArgumentException`
2015-01-18 00:16:09 +01:00
flip111
88e071d22d moved exception constructors out of UoW 2015-01-18 00:16:09 +01:00
flip111
b120dafb70 Added new exception constructors 2015-01-18 00:16:09 +01:00
flip111
00a2c8e09c improved error handling for invalid association values
Possibly to do:
1. Make custom Exception for line 713
2. Make custom Exception for line 817
3. Does the object check on line 816 slow down the code too much? Alternatively a try-catch could be put around line 1415 or higher up.
2015-01-18 00:16:09 +01:00
Marco Pivetta
84562bca82 Merge branch 'hotfix/#1252-include-class-name-when-calling-naming-strategy-join-column-name'
Close #1252
2015-01-18 00:12:54 +01:00
Marco Pivetta
025565005d #1252 DDC-3496 - reverting interface BC break 2015-01-18 00:11:47 +01:00
Marco Pivetta
369a9934a5 #1252 DDC-3496 - moving stub naming strategy to tests directory 2015-01-18 00:07:54 +01:00
Marco Pivetta
29007e7d79 #1252 DDC-3496 - minor test cleanups (avoiding private static method) 2015-01-18 00:03:49 +01:00
Jack Sleight
60523d1b62 Update docblock for joinColumnName to include className details 2015-01-17 23:57:52 +01:00
Jack Sleight
04d8f66b72 Tests for new class based join column NamingStrategy 2015-01-17 23:57:52 +01:00
Jack Sleight
be9d92bb26 Example NamingStrategy for using class name in join column names. 2015-01-17 23:57:52 +01:00
Jack Sleight
82163a3301 Include className in calls to NamingStrategy joinColumnName method. 2015-01-17 23:57:52 +01:00
Marco Pivetta
4cde35dc18 Merge branch 'feature/#954-multi-get-slc-regions'
Close #954
2015-01-17 23:49:40 +01:00
Marco Pivetta
d5f6b4440a #954 DDC-2982 - s/CacheProvider/Cache in documentation 2015-01-17 23:44:40 +01:00
Marco Pivetta
b1474768fe #954 DDC-2982 - Better type-safety in Doctrine\ORM\Cache\Region\DefaultMultiGetRegion instantiation logic 2015-01-17 23:43:34 +01:00
Marco Pivetta
624b98544a #954 DDC-2982 - DefaultCacheFactory now supports generic Doctrine\Common\Cache\Cache instances 2015-01-17 23:42:49 +01:00
Marco Pivetta
95fe03b182 #954 DDC-2982 - Coverage for different instantiation of single-/multi-get cache regions 2015-01-17 23:42:15 +01:00
Marco Pivetta
564624814b #954 DDC-2982 - Evicting all cache entries is not supported with a generic cache adapter 2015-01-17 23:30:37 +01:00
Marco Pivetta
0e4a7caf0b #954 DDC-2982 - Evicting all cache entries is not supported with a generic cache adapter 2015-01-17 23:30:20 +01:00
Marco Pivetta
95c6cca336 #954 DDC-2982 - Minor CS fixes/IDE hints 2015-01-17 23:17:07 +01:00
Marco Pivetta
8ddcc4b270 #954 DDC-2982 - No need to check if a Region is a MultiGetRegion 2015-01-17 23:11:14 +01:00
Marco Pivetta
3c5a794691 #954 DDC-2982 - Making cache Region always a MultiGetRegion (no need to segregate the interface here) 2015-01-17 23:10:49 +01:00
Asmir Mustafic
3f64f3252b Changed some tests to be compatible with the new implementation of
multiget region
2015-01-17 22:27:59 +01:00
Asmir Mustafic
e73bd9e9bb New buildCacheEntry way bo build a entry for a cached collection 2015-01-17 22:27:59 +01:00
Asmir Mustafic
1b4eee6d0d Fixed strange test case with CmsUser and second-level cache 2015-01-17 22:27:59 +01:00
Asmir Mustafic
5ec2014051 MultiGetCollectionHydrator depends knows the multi-get region 2015-01-17 22:27:59 +01:00
Asmir Mustafic
1bfa68d94f Removed dependency with Region interface 2015-01-17 22:27:59 +01:00
Asmir Mustafic
779af8ce8e Added dependency with doctrine/cache 1.4 2015-01-17 22:27:59 +01:00
Asmir Mustafic
77c2e24215 Added test case for buildCachedCollectioHydrator on DefaultCacheFactory 2015-01-17 22:27:59 +01:00
Asmir Mustafic
b0792330e4 Added test case for MultiGetRegion 2015-01-17 22:27:58 +01:00
Asmir Mustafic
74e93e4cad Added multi-get support for second level cached collections 2015-01-17 22:27:58 +01:00
Marco Pivetta
8f097ab304 Merge branch 'hotfix/#1220-sort-paginator-subquery-output-only-once'
Close #1220
2015-01-17 22:13:36 +01:00
Bill Schaller
3fd3da3d46 Fixed removal of ASC and DESC keywords from orderby items that will be included in select list 2015-01-17 22:12:26 +01:00
Bill Schaller
39aeb9935b Added failing testcase for Limit queries on entities with column names containing 'asc' or desc' 2015-01-17 22:12:26 +01:00
Bill Schaller
8350de781f Doc fix 2015-01-17 22:12:26 +01:00
Bill Schaller
dfc0910756 Fixed how order by items are included in the select list of the select distinct wrapper statement 2015-01-17 22:12:26 +01:00
Bill Schaller
7031539314 Fixed SQL that could be considered invalid on the targeted platforms in LimitSubqueryOutputWalkerTest 2015-01-17 22:12:26 +01:00
Bill Schaller
ed800e4b86 Added function to LimitSubqueryOutputWalker which takes an order by clause and rebuilds it to work in the scope of the wrapping query 2015-01-17 22:12:25 +01:00
Bill Schaller
42bea80a6a Added failing test cases for limit queries with with complex scalar order by items 2015-01-17 22:12:25 +01:00
Bill Schaller
a4ebc08c4f * Modified tests in LimitSubqueryOutputWalkerTest.php to not have duplicated order by clauses
* Modified LimitSubqueryOutputWalker to not duplicate order by clauses
2015-01-17 22:12:25 +01:00
Marco Pivetta
b23a8dd429 Merge branch 'hotfix/#1262-restore-run-dql-command-functionality'
Close #1262
2015-01-17 21:31:11 +01:00
Marco Pivetta
fea0425a4f #1262 DDC-3513 - RunDqlCommand should write to the output object rather than to the output buffer 2015-01-17 21:31:00 +01:00
Marco Pivetta
f06d652393 #1262 DDC-3513 - RunDqlCommand should display the generated SQL when asked to do so 2015-01-17 21:30:34 +01:00
Marco Pivetta
1c6fd512a5 #1262 DDC-3513 - providing basic coverage for the RunDqlCommand logic 2015-01-17 21:27:32 +01:00
Bob van de Vijver
3c2ed7d8a8 Fixes the broken DQL command
Now it can again output more than only the created SQL query.
See cdb62a70cd (comments)
2015-01-17 13:21:30 +01:00
Marco Pivetta
fe4d46014d Merge branch 'hotfix/#1212-fix-regression-that-hid-join-aliases-in-criteria-expressions'
Close #1212
2015-01-17 08:35:27 +01:00
Kiel Goodman
0c5ea34fd4 [DDC-3436] Fix changes requested 2/2 2015-01-17 08:33:23 +01:00
Kiel Goodman
dc98da585d [DDC-3436] Fix changes requested 1/2 2015-01-17 08:33:23 +01:00
Kiel Goodman
349966832f [DDC-3436] Convert short array syntax to legacy style 2015-01-17 08:33:23 +01:00
Kiel Goodman
918d2910d9 [DDC-3108] Fix regression introduced in DDC-2764 where join aliases were no longer accessible in Criteria expressions 2015-01-17 08:33:23 +01:00
Marco Pivetta
6ba5211310 Merge branch 'hotfix/#1206-matching-should-not-modify-criteria'
Close #1206
2015-01-17 08:30:26 +01:00
Marco Pivetta
e9fd5678a5 #1206 DDC-3430 - PersistentCollection should not mutate the given Criteria instances when matching() 2015-01-17 08:30:16 +01:00
Oliver Tischlinger
f8072dd8e0 Fixed typo 2015-01-17 08:20:24 +01:00
Oliver Tischlinger
b5ba84f667 matching should not change critera
The matching should behave like in ArrayCollection, where it is not changed.
The criteria should be cloned so that it could be used for more than one matching operation.
2015-01-17 08:20:24 +01:00
Marco Pivetta
6164f17229 Merge branch 'hotfix/#1086-identifier-type-in-proxies'
Close #1086
2015-01-17 08:15:50 +01:00
Marco Pivetta
f13b085582 Using PersisterHelper instead of the unreliable ClassMetadataInfo#getTypeOfColumn() 2015-01-17 08:14:04 +01:00
Marco Pivetta
f1170c84a4 #1086 - Passing type information when building meta-mappings for JTI and STI inheritances 2015-01-17 08:09:55 +01:00
Marco Pivetta
40849f8ae1 #1086 - Minor CS fixes applied to the test case (simplifying) 2015-01-17 08:09:55 +01:00
Thomas Lallement
a0165858c4 Delete DDC0003Test.php 2015-01-17 08:09:55 +01:00
Thomas Lallement
033b8e51e9 Create DDC3223Test.php 2015-01-17 08:09:55 +01:00
Thomas Lallement
556c562258 Failing test (get id return string type) 2015-01-17 08:09:54 +01:00
Marco Pivetta
dad3a6bae1 Merge branch 'hotfix/#1178-correct-association-links-dbal-types-conversion'
Close #1178
2015-01-17 08:03:00 +01:00
Marco Pivetta
67f59dc256 Revert "#1178 - simplified ValueConversionType tests by using a single model-set for the entire subset of tests (faster as well)"
This reverts commit 2702540930.
2015-01-17 08:01:31 +01:00
Marco Pivetta
2702540930 #1178 - simplified ValueConversionType tests by using a single model-set for the entire subset of tests (faster as well) 2015-01-17 07:59:03 +01:00
Marco Pivetta
131a39bad4 #1178 - s/getValue/getIdentifierValues 2015-01-17 07:59:03 +01:00
Marco Pivetta
584839d38a #1178 - moved private method to the bottom of the class 2015-01-17 07:59:03 +01:00
Marco Pivetta
edf054cd0c #1178 - removing duplicate configuration of the rot13 DBAL type 2015-01-17 07:59:03 +01:00
Marco Pivetta
b32c779c37 #1178 - minor typo (method names) 2015-01-17 07:59:02 +01:00
Marco Pivetta
d47f724f16 #1178 - restoring correct getJoinTableRestrictionsWithKey logic as per @jaspernbrouwer's previous implementation 2015-01-17 07:59:02 +01:00
Marco Pivetta
f88f5ce454 #1178 - fetching actual target entity when resolving column types of it 2015-01-17 07:59:02 +01:00
Marco Pivetta
a39b6869ca #1178 - mapping between criteria parameters and types when fetching on one-to-many with additional criterions 2015-01-17 07:59:02 +01:00
Marco Pivetta
ce446a6f03 #1178 - correcting filtering when initializing a one-to-many collection that has composite complex (custom DBAL types) identifiers 2015-01-17 07:59:02 +01:00
Marco Pivetta
096bd90aed #1178 - using the PersisterHelper to extract type of associated meta-result columns 2015-01-17 07:59:02 +01:00
Marco Pivetta
e5c4e65764 #1178 - proxy identifiers should be correctly converted 2015-01-17 07:59:02 +01:00
Marco Pivetta
0743238b43 #1178 - minor code duplication removal 2015-01-17 07:59:01 +01:00
Marco Pivetta
4eaa7ea821 #1178 - correcting class from which the type of a column should be fetched (source class when relationToSourceKeyColumns is used) 2015-01-17 07:59:01 +01:00
Marco Pivetta
6e2179aa8e #1178 - handling custom types when filtering/removing by element in extra-lazy many-to-many associations 2015-01-17 07:59:01 +01:00
Marco Pivetta
5e49aeef6f #1178 - handling custom types when filtering by key in extra-lazy many-to-many associations 2015-01-17 07:59:01 +01:00
Marco Pivetta
e39f08f6bd #1178 - handling correct parameter binding when counting extra-lazy collections with custom-type referenced identifiers 2015-01-17 07:59:01 +01:00
Marco Pivetta
c82794bff7 #1178 - handling traversal of association mapping data in lazy-loading many-to-many requests on the inverse side 2015-01-17 07:59:01 +01:00
Marco Pivetta
1e606d1ed3 #1178 - adding note about ClassMetadataInfo#getTypeOfColumn() being unreliable/dangerous 2015-01-17 07:59:01 +01:00
Marco Pivetta
41900dca76 #1178 - correctly handling initialization of collections referenced via custom DBAL types 2015-01-17 07:59:00 +01:00
Marco Pivetta
91bceca7ee #1178 - correcting collection insert/update logic to correctly cast values for custom typed columns 2015-01-17 07:59:00 +01:00
Marco Pivetta
aaa6443954 #1178 - PersisterHelper::getTypeOfColumn() should not fail silently, as that makes persister bugs impossible to spot 2015-01-17 07:59:00 +01:00
Marco Pivetta
a80532a538 #1178 - correcting association column type when dealing with multiple derived associations/identifier levels
Since the ClassMetadata can only know about internal state, any `joinColumn` association details on the
inverse side of an association need to be computed by fetching associated metadata.
2015-01-17 07:59:00 +01:00
Marco Pivetta
445798ed46 #1178 - reverting patch and keeping tests (rebase gone awry)
Also cleaning up `OrmFunctionalTestCase`
2015-01-17 07:59:00 +01:00
Jasper N. Brouwer
5c1d1931b7 Fixed typehints and use statements 2015-01-17 07:59:00 +01:00
Jasper N. Brouwer
fe21f18991 Fixed doc-blocks 2015-01-17 07:59:00 +01:00
Jasper N. Brouwer
a0b43d0a7f Don't alias PersisterHelper to Helper 2015-01-17 07:58:59 +01:00
Jasper N. Brouwer
7b9c6a69bd Add tests for extra lazy many-to-many associations
and fixed production code
2015-01-17 07:58:59 +01:00
Jasper N. Brouwer
ba3df8577b Refined and added tests, fixed found issues
- Renamed id properties so they don't coexist between entities in a test
- Added tests for extra lazy one-to-many associations
- Fixed production code to make tests green
2015-01-17 07:58:59 +01:00
Jasper N. Brouwer
f7b14085f2 Abstracted infering binding types away in a helper 2015-01-17 07:58:59 +01:00
Jasper N. Brouwer
4f9f7eedf5 Removed DDC-3380 mentions in production code 2015-01-17 07:58:59 +01:00
Jasper N. Brouwer
f60f2a567a Fixed associations using a value-conversion type for identifiers 2015-01-17 07:58:59 +01:00
Marco Pivetta
f6445d5a3e Fixing build using a dedicated in-memory connection to stub out two real connections for DB-access checks 2015-01-17 07:58:35 +01:00
Marco Pivetta
074ec358ab Merge branch 'hotfix/#1172-avoid-proxy-initialization-when-proxy-is-merged-into-uow'
Close #1172
2015-01-16 22:56:03 +01:00
Marco Pivetta
57ce6ccfcf #1172 - fixed minor CS issues (spacing) 2015-01-16 22:54:30 +01:00
Marco Pivetta
45e733eb60 #1172 - adding @method annotation to simplify static introspection 2015-01-16 22:50:52 +01:00
Marco Pivetta
42c9ff026e #1172 - renaming test class for clarity 2015-01-16 22:47:00 +01:00
Marco Pivetta
937113e234 #1172 - simplified logic, re-using existing generic model 2015-01-16 22:46:31 +01:00
Marco Pivetta
cd3fc6e6ea #1172 - adding required @group annotations for newly introduced tests 2015-01-16 22:43:52 +01:00
Marco Pivetta
94724b7a56 #1172 - reverted: moving MergeUninitializedProxyTest tests into EntityManagerTest (invalid, as they are functional tests) 2015-01-16 22:43:03 +01:00
Marco Pivetta
3769cd1119 #1172 - adding required @group annotations for newly introduced tests 2015-01-16 22:37:38 +01:00
Marco Pivetta
70840131ff #1172 - moved MergeUninitializedProxyTest tests into EntityManagerTest 2015-01-16 22:36:30 +01:00
Marco Pivetta
438feccd55 #1172 - removing redundant test logic 2015-01-16 22:25:41 +01:00
Marco Pivetta
de4e980389 #1172 - covering merging of unmanaged, un-initialized proxies bound to a different entity manager 2015-01-16 22:25:00 +01:00
Marco Pivetta
b7566dc65b #1172 - correcting test: all connections should have a saved file instance 2015-01-16 22:20:58 +01:00
Marco Pivetta
d1e7960f99 #1172 - tests to verify that proxies keep distinct entity manager instances even across merging operations 2015-01-16 22:12:42 +01:00
Marco Pivetta
4ed0a6ce53 #1172 - removing redundant tests 2015-01-16 21:25:25 +01:00
Marco Pivetta
3df119f4fe #1172 - when merging an initialized proxy, the managed proxy must be initialized before merging 2015-01-16 21:23:47 +01:00
Marco Pivetta
a18f258b4d #1172 - covering merging of managed proxies 2015-01-16 21:15:39 +01:00
Marco Pivetta
0329ac5074 #1172 - covering also detached proxies - merging operations should not initialize either proxy 2015-01-16 21:14:13 +01:00
Marco Pivetta
dde09872df #1172 - writing a more concise test case about merging detached proxies 2015-01-16 21:09:53 +01:00
Mathieu De Zutter
318b23097b Don't load uninitialized proxies after merging.
Previous patch avoided initialization of proxies before merging, mainly to
fix a bug with merging. However, later on, doctrine tries again to load
the proxy. This is unnecessary and thus has been removed. This way, a
round trip to the database is saved.
2015-01-16 20:54:15 +01:00
Mathieu De Zutter
ec35d4886c Don't load detached proxies when merging them.
Ticket DDC-1392 fixed an issue where uninitialized proxies could not be merged
because the merge routine couldn't get the identifier from them. The soution
was to initialize the proxy.
Ticket DDC-1734 fixed the merging of *unserialized* uninitialized proxies by
resetting their internals, so these proxies were able to initialize, as required
by the fix for DDC-1392.

Somehow, in the meanwhile, the fix for DDC-1392 is not needed anymore:
reverting the patch will not break the associated test (but it does break the
test for DDC-1734). This means it is not needed anymore to initialize the proxy
when merging.

Uninitialized proxies that get merged should not be loaded at all.  Since they
are not initialized, the entity data for sure hasn't changed, so it can be
safely ignored. Actually, the only thing the data is needed for while merging,
is to copy it into the managed entity, but that one is already supposed to be
up to date. By not initializing the proxy, a potential database roundtrip is
saved, and the fix for DDC-1734 is not needed anymore.

Besides optimizing the merge, this patch also solves an issue with merging.
Currently, when a detached uninitialized proxy is merged while there is already a
corresponding managed entity (proxy or not), the ORM returns a blank entity
instead of returning the already managed entity. This patch makes sure that
already existing managed entities are re-used.
2015-01-16 20:54:15 +01:00
Marco Pivetta
f28654de12 Merge branch 'hotfix/#1133-better-exception-message-on-missing-embeddable-class-in-metadata'
Close #1133
2015-01-16 19:50:26 +01:00
Marco Pivetta
935a79e15f #1133 DDC-3305 - minor cs fix (spacing) 2015-01-16 19:46:04 +01:00
Marco Pivetta
7e4dab17ec #1133 DDC-3305 - test case with embeddable without referenced embeddable class 2015-01-16 19:45:16 +01:00
Javier Spagnoletti
705a7d2cc2 [Embeddables] Improved exception message when embeddables is missing 'class' attribute. 2015-01-16 19:18:46 +01:00
Marco Pivetta
655394d433 Merge branch 'hotfix/abstract-id-generator-revert-bc-break' 2015-01-16 18:53:36 +01:00
Marco Pivetta
6acfdc1439 Removing Doctrine\ORM\Id\AbstractIdGenerator#generate(EntityManagerInterface $em, $entity) from upgrade notes (BC break reverted) 2015-01-16 18:53:27 +01:00
Marco Pivetta
f799986be1 Reverting BC break in AbstractIdGenerator signature 2015-01-16 18:52:58 +01:00
Marco Pivetta
de589799e8 Merge pull request #1209 from Ocramius/hotfix/DDC-3427-allow-entitymanagerinterface-globally
s/EntityManager/EntityManagerInterface in type-hints
2015-01-16 15:06:58 +01:00
Marco Pivetta
efe9e3ab28 #1209 DDC-3427 - documenting s/EntityManager/EntityManagerInterface signature BC breaks 2015-01-16 14:55:16 +01:00
Marco Pivetta
339bd23ac8 #1209 DDC-3427 - removing leftover EntityManager hints (using interface instead) 2015-01-16 14:44:31 +01:00
Marco Pivetta
dd8db1acd2 DDC-3427 - s/EntityManager/EntityManagerInterface in relevant tests about identifier generation 2015-01-16 14:22:03 +01:00
Marco Pivetta
6fc0d84b7a DDC-3427 - s/EntityManager/EntityManagerInterface in type-hints 2015-01-16 14:21:30 +01:00
Marco Pivetta
0e7646cf4b Merge branch 'namespace-persisters'
Close #1258
2015-01-16 00:10:56 +01:00
Guilherme Blanco
f90475772d Classify persisters into more granular namespaces. 2015-01-16 00:10:25 +01:00
Fabio B. Silva
f97bb00dff Merge pull request #1259 from Ocramius/hotfix/cache-region-cache-namespace-mutability-removal
Hotfix: Cache region should not mutate injected cache instance settings
2015-01-15 15:26:23 -05:00
Marco Pivetta
0f2c117f3e Cloning and configuring the cache adapter for each newly created cache region (fixes cache namespacing) 2015-01-15 21:17:49 +01:00
Marco Pivetta
6564f95260 Typo fix (region should be named 'bar', not 'foo' 2015-01-15 21:17:25 +01:00
Marco Pivetta
a82eecfc07 Each cache region built by the DefaultCacheFactory should have its own cache with its own unique namespace 2015-01-15 21:15:38 +01:00
Marco Pivetta
514fd008b9 Cache regions will not modify the injected cache instance settings 2015-01-15 21:01:35 +01:00
Marco Pivetta
f38d4551f1 Cache regions should not modify the injected cache instance settings 2015-01-15 21:01:02 +01:00
Guilherme Blanco
0b2fb7fd78 Fixed identifier quoting in functional tests. 2015-01-15 03:55:29 +00:00
Guilherme Blanco
8a0989aa50 Fixed identifier quoting in functional tests. 2015-01-15 03:50:18 +00:00
Marco Pivetta
5bd921139e Merge branch 'hotfix/#1250-DDC-3493-fix-class-pseudo-constant-parsing-in-entitygenerator' 2015-01-15 04:16:44 +01:00
Guilherme Blanco
a1d77bdc65 Renamed coll to collection and some small updates to tests. 2015-01-15 03:14:48 +00:00
Marco Pivetta
5be57d0f4a Merge branch 'hotfix/#1256-DDC-3493-fix' into hotfix/#1250-DDC-3493-fix-class-pseudo-constant-parsing-in-entitygenerator
Close #1250
Close #1256
2015-01-15 04:13:28 +01:00
Andrea Sprega
243210e896 DDC-3493 - fixed EntityGenerator parsing for php 5.5 "::class" syntax 2015-01-15 04:13:09 +01:00
lukasmaz
41dd584f62 Test case for "class" keyword
Test case for http://www.doctrine-project.org/jira/browse/DDC-3493
2015-01-15 04:12:31 +01:00
Marco Pivetta
55a75bfb1b Merge pull request #1249 from doctrine/extra-lazy-get-m2m
Support for extra lazy get for both owning and inverse side on many to many associations.
2015-01-15 03:36:35 +01:00
Steve Müller
d343617f13 Merge pull request #1255 from Ocramius/cleanup/php-5.3-support-end
Cleanup: PHP 5.3 support end
2015-01-15 01:29:00 +01:00
Marco Pivetta
934e4fdde4 Merge pull request #1251 from TomasVotruba/travis-optimize
travis: optimize to run coverage only once
2015-01-15 01:20:02 +01:00
Marco Pivetta
a88726d84e Merge branch 'hotfix/#1072-fix-iteration-of-file-lock-region-on-no-match'
Close #1072
2015-01-15 00:55:16 +01:00
Marco Pivetta
8b223c5c83 #1072 DDC-3191 - test cleanup: reflection is better than mixing up I/O operations and global state 2015-01-15 00:54:25 +01:00
Marco Pivetta
e2acd74cb4 #1072 DDC-3191 - minor performance optimization 2015-01-15 00:37:41 +01:00
Marco Pivetta
aca719be41 #1072 DDC-3191 - adding test for failing glob() operations on the FileLockRegion 2015-01-15 00:36:26 +01:00
Alexander Kurilo
58cd520e32 Fix attempt of traversing bool in FileLockRegion 2015-01-14 23:51:41 +01:00
Tomas Votruba
57cad1f232 travis: optimize to run coverage only once 2015-01-14 23:08:15 +01:00
Marco Pivetta
a1e40fc3f1 Removing PHP 5.3 references, simplified getting started docs 2015-01-14 21:02:15 +01:00
Marco Pivetta
3ee47bef41 Updating readme minimum required PHP version 2015-01-14 21:00:59 +01:00
Marco Pivetta
89520b1f38 Updating readme minimum required PHP version 2015-01-14 21:00:37 +01:00
Marco Pivetta
9024c04c72 Removing conditionals checking for PHP 5.4 support 2015-01-14 20:14:39 +01:00
Marco Pivetta
541e7bdf72 Refactoring test method: no need to test for PHP version 2015-01-14 20:13:46 +01:00
Marco Pivetta
8e28cb9119 Removing useless $self use statements, as PHP 5.4 supports $this in closures 2015-01-14 20:12:27 +01:00
Marco Pivetta
effe33096d Dropping PHP 5.3 from the build matrix 2015-01-14 20:03:49 +01:00
Marco Pivetta
e05858b09c Requiring PHP 5.4 as a minimum runtime 2015-01-14 20:02:48 +01:00
Marco Pivetta
e030dac3d0 Merge pull request #1253 from SofHad/fix-dbal-configuration-404
Fix dead link
2015-01-14 19:43:03 +01:00
Marco Pivetta
1d4b96eed0 Merge branch 'hotfix/#881-support-schema-on-platform-without-schema-emulation'
Close #881
2015-01-14 19:18:22 +01:00
Marco Pivetta
0106cba602 #881 DDC-2825 - reusing mapping files that already exist in models, where applicable 2015-01-14 19:17:39 +01:00
Marco Pivetta
7164e28138 #881 DDC-2825 - renaming table/schema name for clarity and to avoid collisions 2015-01-14 19:16:42 +01:00
Marco Pivetta
7b168de236 #881 DDC-2825 - removing unused imports 2015-01-14 19:05:40 +01:00
Marco Pivetta
962f479318 #881 DDC-2825 - refactoring test logic, removing dead private method 2015-01-14 19:04:58 +01:00
Marco Pivetta
80ce601eae #881 DDC-2825 - refactoring test logic to use data-provider instead of code repetitions 2015-01-14 19:02:44 +01:00
Marco Pivetta
f874189456 #881 DDC-2825 - refactoring tests for clarity/readability and ease of use 2015-01-14 18:56:37 +01:00
Marco Pivetta
9d6890e6ca #881 DDC-2825 - expectations are the first parameter in an assertion 2015-01-14 18:50:17 +01:00
Marco Pivetta
67788d89b5 #881 DDC-2825 - simplifying/extracting test logic: moved verifying metadata into separate test method 2015-01-14 18:47:17 +01:00
SofHad
9ba7c9a74d Fix dead link 2015-01-14 18:43:46 +01:00
Marco Pivetta
0a91b83e27 #881 DDC-2825 - exploding test case into smaller units 2015-01-14 18:34:58 +01:00
Marco Pivetta
6f85ca3356 #881 DDC-2825 - exploding test case into smaller units 2015-01-14 18:31:11 +01:00
Marco Pivetta
3ba9689448 #881 DDC-2825 - aligning assignments 2015-01-14 18:19:22 +01:00
Marco Pivetta
f0102a69f9 #881 DDC-2825 - refactoring mapping driver to use ClassMetadata#setPrimaryTable() instead of duplicating explode() logic 2015-01-14 18:12:12 +01:00
Marco Pivetta
eefa3b2e53 #881 DDC-2825 - correcting YAML driver implementation (wasn't using extracted schema) 2015-01-14 18:06:29 +01:00
Marco Pivetta
04467218a3 #881 DDC-2825 - providing YAML mappings for explicit schema definition 2015-01-14 18:05:58 +01:00
Marco Pivetta
7911beaf1c #881 DDC-2825 - providing YAML mappings for implicit schema definition 2015-01-14 18:05:38 +01:00
Marco Pivetta
51bf82b7e7 #881 DDC-2825 - correcting PHP mapping behavior when using implicit schema in table name 2015-01-14 17:54:00 +01:00
Marco Pivetta
0fd51cf852 #881 DDC-2825 - providing PHP mappings for implicit schema definition 2015-01-14 17:53:01 +01:00
Marco Pivetta
d96cd1b690 #881 DDC-2825 - providing PHP mappings for explicit schema definition 2015-01-14 17:52:51 +01:00
Marco Pivetta
53845b79e1 #881 DDC-2825 - providing XML mappings for implicit schema definition 2015-01-14 17:34:44 +01:00
Marco Pivetta
3820fa57d3 #881 DDC-2825 - XML mappings should handle explicitly defined schema name 2015-01-14 17:33:17 +01:00
Marco Pivetta
941bfca68c #881 DDC-2825 - providing XML mappings for explicit schema definition 2015-01-14 17:27:53 +01:00
Marco Pivetta
617fd6cfdc #881 DDC-2825 - moving YAML and XML mapping tests to base mapping driver tests. Excluding Static PHP mapping tests 2015-01-14 16:59:01 +01:00
Marco Pivetta
cf641cd0a3 #881 DDC-2825 - testing annotation driver with table name defining schema name as part of the name 2015-01-14 16:47:05 +01:00
Marco Pivetta
8b2b54c033 #881 DDC-2825 - typo fix (causing test failure) 2015-01-14 16:32:02 +01:00
Marco Pivetta
c6d839869b #881 DDC-2825 - annotation mapping tests for explicitly defined schema name on mappings 2015-01-14 16:30:20 +01:00
Michaël Perrin
0dbc6a12ee Update mapping documentation for schema support
Updated documentation:

* Annotations
* XML
* Yaml
* PHP
2015-01-14 15:48:49 +01:00
Michaël Perrin
54b3c0548d Fix persistence exception on a table with a schema on a platform without schema support 2015-01-14 15:48:49 +01:00
Marco Pivetta
c571f6f6a9 Correctly dealing with emulated cascades in ExtraLazyCollectionTest 2015-01-14 14:36:01 +01:00
Steve Müller
00a8265fb9 Merge pull request #1181 from Ocramius/feature/#385-support-fetching-entities-by-aliased-name
Support fetching entities by aliased name
2015-01-14 13:54:33 +01:00
Marco Pivetta
ba5378fecc #385 #1181 DDC-3385 - fixing Events docblocks as per @deeky666's review 2015-01-13 21:15:34 +01:00
Marco Pivetta
ae8ab0812e #385 #1181 DDC-3385 - fixing OnClassMetadataNotFoundEventArgs docblocks as per @deeky666's review 2015-01-13 21:14:32 +01:00
Marco Pivetta
d712ad97a5 #385 #1181 DDC-3385 - test coverage for OnClassMetadataNotFoundEventArgs impl 2015-01-13 21:04:50 +01:00
Marco Pivetta
662b49608c #385 #1181 DDC-3385 - aligning tests and implementation to new OnClassMetadataNotFoundEventArgs API 2015-01-13 20:56:57 +01:00
Marco Pivetta
6debf2c909 #385 #1181 DDC-3385 - aligning tests to new OnClassMetadataNotFoundEventArgs API 2015-01-13 20:56:40 +01:00
Marco Pivetta
762e798d22 #385 #1181 DDC-3385 - extending OnClassMetadataNotFoundEventArgs from ManagerEventArgs instead of generic EventArgs 2015-01-13 20:56:21 +01:00
Marco Pivetta
6021e3a1b8 #385 #1181 DDC-3385 - Updating docblock of OnClassMetadataNotFoundEventArgs 2015-01-13 20:49:08 +01:00
Marco Pivetta
06f256b410 #385 #1181 DDC-3385 - documenting onClassMetadataNotFound event 2015-01-13 20:45:00 +01:00
Marco Pivetta
f14063def5 #385 #1181 DDC-3385 - splitting test case to verify interface-first fetching of metadata (via fallback logic) 2015-01-13 20:38:01 +01:00
Marco Pivetta
94a2036d50 #385 #1181 DDC-3385 - adding @group annotation to newly introduced tests 2015-01-13 20:37:28 +01:00
Marco Pivetta
eaa9187dd8 #385 #1181 DDC-3385 - minor CS fix (spacing) 2015-01-13 20:33:30 +01:00
Marco Pivetta
8ea394e778 #385 #1181 DDC-3385 - removing @todo that was discussed/cleared 2015-01-13 20:33:10 +01:00
Marco Pivetta
a710706c81 #385 #1181 DDC-3385 - optimized imports, removing duplicate imports (caused by rebase conflicts) 2015-01-13 20:00:40 +01:00
Marco Pivetta
ce4df761df Explicitly requiring doctrine/common with at least version 2.5 2015-01-13 19:51:35 +01:00
Marco Pivetta
e4cbdb57ad Enabling fallback logic in metadata loading 2015-01-13 19:50:55 +01:00
Marco Pivetta
d91b0b4938 Minor CS fixes in the ResolveTargetEntityListener 2015-01-13 19:50:17 +01:00
Marco Pivetta
f5eb20b63d OnClassMetadataNotFoundEventArgs should support setting the actually resolved ClassMetadata as a mutable event result vector 2015-01-13 19:50:17 +01:00
Marco Pivetta
efd4500e6b ClassMetadataFactory should support fallback (event-based) logic for hooking into failed ClassMetadata loading 2015-01-13 19:50:15 +01:00
Bart van den Burg
d66356542d added use statement 2015-01-13 19:49:58 +01:00
Bart van den Burg
3be43a1def Rebased and renamed PreLoadClassMetadata to OnClassMetadataNotFound 2015-01-13 19:49:57 +01:00
Bart van den Burg
437f812718 Added new event to allow actions to be done before trying to load class metadata 2015-01-13 19:49:57 +01:00
Bart van den Burg
19c52e4ae1 added failing test 2015-01-13 19:49:57 +01:00
Bart van den Burg
51528fbdea set metadata for interface to be able to fetch entites by interface name 2015-01-13 19:49:57 +01:00
Guilherme Blanco
25b7c64dc6 Implemented support for extra lazy get for both owning and inverse side on many to many associations. 2015-01-13 17:50:20 +00:00
Marco Pivetta
9c3cb57931 Merge branch 'optimize-persisters'
Close #1246
2015-01-13 15:05:45 +01:00
Marco Pivetta
35dd7f8e2b #1246 DDC-3487 - docblock args fixes 2015-01-13 15:03:04 +01:00
Marco Pivetta
278b8bfa08 #1246 DDC-3487 - minor alignment fixes 2015-01-13 14:58:56 +01:00
Marco Pivetta
7f71cbc8c7 #1246 DDC-3487 - removed unused assignment, minor alignment fixes 2015-01-13 14:54:00 +01:00
Marco Pivetta
97d1d5343e #1246 DDC-3487 - removed unused assignment, making $association variable overwrite more obvious 2015-01-13 14:46:34 +01:00
Marco Pivetta
c4366124c7 #1246 DDC-3487 - removed unused assignment, direct return instead 2015-01-13 14:45:13 +01:00
Marco Pivetta
17a865ec7f #1246 DDC-3487 - correcting docblock (static introspection fix) 2015-01-13 14:39:05 +01:00
Marco Pivetta
b99f4461be #1246 DDC-3487 - re-aligning SQL string concatenation for readability, fixed docblock return value hint 2015-01-13 14:37:32 +01:00
Marco Pivetta
5942b6c302 #1246 DDC-3487 - re-aligning SQL string concatenation for readability 2015-01-13 14:31:22 +01:00
Marco Pivetta
77234d6aec #1246 DDC-3487 - removing unused assignment 2015-01-13 14:30:51 +01:00
Marco Pivetta
a8dcc2acf3 #1246 DDC-3487 - removing possible undefined value path for $newValId for clarity 2015-01-13 14:05:27 +01:00
Guilherme Blanco
c49b0795db Update UPGRADE.md 2015-01-12 22:53:55 -05:00
Guilherme Blanco
de4723883f Merge pull request #1171 from jaimz22/master
Improvements for complex select statements when using new object expression
2015-01-12 22:48:56 -05:00
Guilherme Blanco
bc268da8c2 Small optimization. 2015-01-13 03:30:07 +00:00
Guilherme Blanco
678f47f494 More deprecated code removal. 2015-01-13 02:52:31 +00:00
Guilherme Blanco
965cdbdbbb Optimized column to field resolutions. 2015-01-13 02:18:49 +00:00
Guilherme Blanco
96955d6e79 Some small improvements to persisters. 2015-01-13 02:05:33 +00:00
Marco Pivetta
5630c37b35 Merge branch 'feature/#1240-include-identifiers-in-exception-messages'
Close #1240
2015-01-13 02:56:06 +01:00
Marco Pivetta
1bfa7ea754 #1240 DDC-3479 - Basic coverage for EntityNotFoundException 2015-01-13 02:55:51 +01:00
Marco Pivetta
fc72b41953 #1240 DDC-3479 - Using a static proxy constructor rather than the default constructor 2015-01-13 02:51:47 +01:00
Marco Pivetta
66c556fbfd #1240 DDC-3479 - Fixing minor CS issues (naming, alignment) 2015-01-13 02:48:57 +01:00
Lars Strojny
8e4092750d Include IDs in the exception message to ease debugging 2015-01-13 02:41:05 +01:00
Marco Pivetta
1ac688644a Merge branch 'hotfix/#1242-lock-uninitialized-proxies'
Close #1242
2015-01-13 02:37:09 +01:00
Carnage
00b6f62287 Fixed issue 2015-01-13 02:36:58 +01:00
Carnage
36f9822466 Added test to demonstrate issue 2015-01-13 02:36:58 +01:00
Marco Pivetta
ef113e52ab Merge branch 'feature/#1054-DDC-3161-allow-connection-access-in-filters'
Close #1054
2015-01-13 02:06:49 +01:00
Marco Pivetta
ef5a3f1bb7 #1054 DDC-3161 - adding @group annotation for newly introduced tests 2015-01-13 02:06:39 +01:00
Vladislav Veselinov
759836113f assertion fix 2015-01-13 02:05:49 +01:00
Vladislav Veselinov
79bf84e1ad revert typehint change 2015-01-13 02:05:49 +01:00
Vladislav Veselinov
9cb17d2915 EntityManagerInterface instead of EntityManager
Make connection available in filters
Add test for the changes
2015-01-13 02:05:49 +01:00
Marco Pivetta
14c3adbec0 Merge branch 'hotfix/#470-DDC-54-postLoad-deferred-event-triggering-tests'
Close #470
2015-01-13 01:43:44 +01:00
Marco Pivetta
b81209c278 #470 DDC-54 DDC-3005 - documenting postLoad and Doctrine\ORM\AbstractQuery#iterate() partial incompatibility 2015-01-13 01:43:12 +01:00
Marco Pivetta
f571a9ef88 #470 DDC-54 DDC-3005 - query iteration must cause eager hydrationComplete logic to be fired 2015-01-13 01:42:38 +01:00
Marco Pivetta
0ffc752f6f #470 DDC-54 DDC-3005 - simple-object hydration should also trigger postLoad events when iterating over single results 2015-01-13 01:42:03 +01:00
Marco Pivetta
5cd73f0d12 #470 DDC-54 DDC-3005 - reverting assertion
`postLoad` should be triggered eagerly when using `iterate()`, as worse problems may be experienced with
missed initialization via listeners.
2015-01-13 01:36:13 +01:00
Marco Pivetta
0a19fbb376 #470 DDC-54 DDC-3005 - minor test cleanups, changing test according to current limitation to document the actual expected behavior 2015-01-13 01:26:04 +01:00
Marco Pivetta
a884452ffc #470 DDC-54 DDC-3005 - removing unused PostLoadEventDispatcher 2015-01-13 01:16:46 +01:00
Marco Pivetta
b1144e74ea #470 DDC-54 DDC-3005 - reverting hydrator changes, as patch DDC-3005 already deals with the issue 2015-01-13 01:09:23 +01:00
Lukasz Cybula
aa4796cd0d Moved postLoad dispatching from UnitOfWork to object hydrators 2015-01-13 01:03:48 +01:00
Marco Pivetta
a906295c65 Merge branch 'hotfix/#1001-DDC-3005-defer-postload-event-after-fully-populated-associations'
Close #1001
2015-01-13 00:54:31 +01:00
Marco Pivetta
d09280a1dc #1001 DDC-3005 - HydrationCompleteHandler cs fixes (line-wrap) 2015-01-13 00:52:12 +01:00
Marco Pivetta
45221b1951 #1001 DDC-3005 - removed HydrationCompleteHandler#invokeAllDeferredPostLoadEvents() (useless method call indirection) 2015-01-13 00:51:44 +01:00
Marco Pivetta
c9ccd91421 #1001 DDC-3005 - optimized HydrationCompleteHandler imports 2015-01-13 00:50:19 +01:00
Marco Pivetta
730c2a81f7 #1001 DDC-3005 - HydrationCompleteHandler static introspection cleanups, as well as memory and performance improvements 2015-01-13 00:50:05 +01:00
Marco Pivetta
8c54a65aa5 #1001 DDC-3005 - Verifying HydrationCompleteHandler skips over registered deferred loads that were already handled by hydrationComplete 2015-01-13 00:48:53 +01:00
Marco Pivetta
29d4d342bd #1001 DDC-3005 - Testing HydrationCompleteHandler with multiple deferred entities postLoads 2015-01-13 00:45:07 +01:00
Marco Pivetta
948d6c2b9f #1001 DDC-3005 - Testing HydrationCompleteHandler against all possible ListenersInvoker flags 2015-01-13 00:39:28 +01:00
Marco Pivetta
833058fd2e #1001 DDC-3005 - Testing HydrationCompleteHandler when no events should be triggered 2015-01-13 00:36:17 +01:00
Marco Pivetta
7b81cfb6ea #1001 DDC-3005 - Minor CS fixes in HydrationCompleteHandler 2015-01-13 00:33:15 +01:00
Marco Pivetta
89530f88f7 #1001 DDC-3005 - Removing dead assignment HydrationCompleteHandler#__construct() 2015-01-13 00:32:10 +01:00
Marco Pivetta
516d04c391 #1001 DDC-3005 - Removing useless dependency from the HydrationCompleteHandler to the UnitOfWork 2015-01-13 00:31:32 +01:00
Marco Pivetta
fccd08afa5 #1001 DDC-3005 - Basic coverage for the HydrationCompleteHandler 2015-01-13 00:29:50 +01:00
Marco Pivetta
af93539576 #1001 DDC-3005 - HydrationCompleteHandler should accept EntityManagerInterface instances 2015-01-13 00:06:07 +01:00
Marco Pivetta
22e12e0043 #1001 DDC-3005 - coverage annotations, minor CS fixes 2015-01-12 23:50:16 +01:00
Guilherme Blanco
dd883f2136 Moved delete() and update() to proper locations. 2015-01-12 22:04:04 +00:00
Strate
0c8a31bf2b DDC-3005. Revert empty line. Removed @since annotation 2015-01-12 22:34:24 +01:00
Strate
96184b9541 DDC-3005.Removed warning in documentation 2015-01-12 22:34:24 +01:00
Strate
367a79206d DDC-3005. Renamed class by removing underscore 2015-01-12 22:34:24 +01:00
Strate
35ea399d33 DDC-3005 Defer invoking of postLoad event to the end of hydration cycle.
1. Refactor handling of hydration complete: delegate this task to special object
2. Write test case for situation, when inside postLoad listener other entity is loading.
3. Make test, written on second step, be able to pass :)
2015-01-12 22:34:24 +01:00
Strate
f3b31c2807 DDC-3005 Defer invoking of postLoad event to the end of hydration cycle.
This feature makes guarantee, that postLoad event fires after all associations are populated
2015-01-12 22:33:40 +01:00
Marco Pivetta
b9c0868f08 Merge branch 'one-to-many-extra-lazy-joined-inheritance'
Close #1245
2015-01-12 22:05:12 +01:00
Marco Pivetta
0f362b0650 #1245 DDC-2504 - removing duplicate test 2015-01-12 22:03:54 +01:00
Marco Pivetta
ebf5811761 #1245 DDC-2504 - extracting test:
Removing an unmanaged/persisted/new item from a one-to-many extra-lazy association to a JTI does not initialize the collection
2015-01-12 21:55:57 +01:00
Marco Pivetta
25d40caf1e #1245 DDC-2504 - extracting test:
Removing a managed item from a one-to-many extra-lazy association to a JTI does not initialize the collection
2015-01-12 21:43:37 +01:00
Marco Pivetta
ec08286173 #1245 DDC-2504 - constants over string references 2015-01-12 21:37:53 +01:00
Marco Pivetta
7a0cb1c370 #1245 DDC-2504 - splitting test method into a test about count() and one about contains() on a lazy persistent collection 2015-01-12 21:34:12 +01:00
Marco Pivetta
8d287b17d7 #1245 DDC-2504 - splitting test method into single feature checks 2015-01-12 21:29:48 +01:00
Guilherme Blanco
932a56f26f Internalize UnitOfWork in CollectionPersisters. Updated related code. 2015-01-12 19:52:27 +00:00
Guilherme Blanco
c5f1b99721 Fixed wrong return. 2015-01-12 18:18:15 +00:00
Guilherme Blanco
73afcec22a Implemented support for one to many extra lazy with joined inheritance. 2015-01-12 18:15:13 +00:00
Marco Pivetta
573153669c Merge pull request #1244 from BenMorel/static
Change $this return type to static in AbstractQuery
2015-01-11 18:02:45 +01:00
Benjamin Morel
fbcf18cf33 Changed $this return type to static in AbstractQuery
This allows IDEs and static code analysis tools to properly understand the return type when chaining methods, for example when using the QueryBuilder.
2015-01-11 16:48:09 +00:00
Guilherme Blanco
4dbfdfb9d6 Merge pull request #1243 from doctrine/composer-autoloader-dev
Fixed phpunit tests autoload requirements and moved to composer autoload-dev
2015-01-10 16:05:14 -05:00
Guilherme Blanco
9201d09ab7 Fixed phpunit tests autoload requirements and moved to composer autoload-dev configuration. 2015-01-10 20:28:57 +00:00
Marco Pivetta
be91cc9bb3 Merge pull request #1239 from deeky666/fix-index-duplication
Fix index duplication for unique association join columns
2015-01-09 23:07:50 +01:00
Marco Pivetta
664b6bf4c5 Merge pull request #1227 from c960657/production-settings-query-cache
Ensure query cache is not ArrayCache in production
2015-01-09 16:58:38 +01:00
Steve Müller
d1e5034659 fix index duplication for unique association join columns 2015-01-08 15:39:41 +01:00
Marco Pivetta
0cbab230bf Merge branch 'feature/#1238-allow-skipping-column-prefixing-in-xml-mapped-embeddables'
Close #1238
2015-01-08 13:33:52 +01:00
Marco Pivetta
6fdb100793 #1238 DDC-3293 DDC-3477 - exploding tests with set use-column-prefix="true" and use-column-prefix="false" xml mappings 2015-01-08 13:33:38 +01:00
Marco Pivetta
43db4a4182 #1238 DDC-3293 DDC-3477 - adding @group annotations for newly introduced tests 2015-01-08 13:28:11 +01:00
Andrey Knupp Vital
a701c9d046 Removing warning about non-availability of no-prefix in XML mappings 2015-01-08 10:11:22 -02:00
Andrey Knupp Vital
74a2cfc83b Also adding docs for the new attribute use-column-prefix 2015-01-08 09:37:41 -02:00
Andrey Knupp Vital
08e8af9372 Type-hinting SimpleXMLElement (_getCascadeMappings) 2015-01-08 09:28:15 -02:00
Andrey Knupp Vital
b90943c56b Minor improvements 2015-01-08 09:04:37 -02:00
Andrey Knupp Vital
bacadbf366 Adding tests for the attribute use-column-prefix 2015-01-08 00:11:34 -02:00
Andrey Knupp Vital
4935da138d Respecting use-column-prefix instead of relying on false/0 of column-prefix 2015-01-08 00:10:24 -02:00
Andrey Knupp Vital
c964dd0cd2 Adding use-column-prefix attribute as proposed (DDC-3293) #1239 2015-01-08 00:09:30 -02:00
Andrey Knupp Vital
8bbc492978 Removing weird strict comparison on different types 2015-01-07 17:24:44 -02:00
Andrey Knupp Vital
82cda1ecb0 Prevents prefixing a column when false on column-prefix (XML) 2015-01-07 17:22:48 -02:00
Guilherme Blanco
ef65270387 Merge pull request #1230 from johannes/master
Allow dumping SQL query when passing DQL on cli
2015-01-06 21:39:11 -05:00
Marco Pivetta
6448627bc9 Merge pull request #1233 from SofHad/refactoring-duplicate-code
[Minor] Refactoring to avoid duplicate code
2015-01-04 22:59:05 +01:00
SofHad
eb22db0dcf remove the unnecessary check 2015-01-04 21:01:32 +01:00
Marco Pivetta
5237692979 Merge pull request #1236 from abackstrom/patch-1
Minor docs fix: missing word 'do'
2014-12-31 09:59:33 +01:00
Marco Pivetta
d13e2fbb83 Merge branch 'hotfix/#1235-consistent-joined-subclass-persister-return-types'
Close #1235
2014-12-31 09:46:31 +01:00
Marco Pivetta
0f165bce50 #1235 DDC-3470 - coverage annotations 2014-12-31 09:46:19 +01:00
Marco Pivetta
a93e5fa1c2 #1235 DDC-3470 - license headers 2014-12-31 09:45:46 +01:00
Marco Pivetta
74f00327bd #1235 DDC-3470 - adding @group annotation for newly introduced test cases 2014-12-31 09:45:33 +01:00
Marco Pivetta
e2b34ff5d2 #1235 DDC-3470 - joined subclass persister empty executeInserts() method return type test 2014-12-31 09:44:39 +01:00
Annika Backstrom
27fe4d78b7 Minor docs fix: missing word 'do' 2014-12-30 20:12:11 -05:00
Martin Prebio
8f15c5e905 Consistent return type confirming with interface 2014-12-31 01:28:05 +01:00
Sofiane HADDAG
8d91f7de60 Rename handleCache to updateCache 2014-12-30 14:49:12 +01:00
shaddag
ccb09ad0ac Rename the private method 2014-12-30 14:10:56 +01:00
shaddag
12b5a0cdd7 Extracted ony the common logic 2014-12-30 14:06:48 +01:00
shaddag
50ef1369c3 [Minor] Refactoring to avoid duplicate code 2014-12-30 10:03:49 +01:00
Johannes Schlüter
cdb62a70cd Allow dumping SQL query when passing DQL on cli 2014-12-24 14:15:23 +01:00
Christian Schmidt
61c72e4aa7 Ensure query cache is not ArrayCache in production 2014-12-19 20:18:45 +01:00
James Murray
d9cbe1a8b7 removed unnecessary fieldIdentificationVariable property check 2014-12-19 14:10:47 -05:00
James Murray
2f76571d3a Added a fix for ObjectHydrator when the same number of scalar results and new object results exist
Adding additional tests for mixed New object and scalar query
2014-12-19 14:06:03 -05:00
Marco Pivetta
193e31f22a Merge pull request #1226 from stof/patch-2
Update Travis badges to use the SVG version
2014-12-19 19:19:48 +01:00
Christophe Coevoet
92efd887e2 Update Travis badges to use the SVG version 2014-12-19 19:04:04 +01:00
Guido Contreras Woda
82847e1851 Added more docblock 2014-12-16 22:37:50 -03:00
Guido Contreras Woda
8fd28fcd8f Added embedded and embeddables to ClassMetadataBuilder 2014-12-16 22:30:28 -03:00
Marco Pivetta
5a6bbbd624 Merge branch 'hotfix/#1216-tests-for-#1214-xml-driver-exporting'
Close #1216
Close #1214
2014-12-10 01:33:23 +01:00
Marco Pivetta
b6bbf6ac22 #1214 #1216 - adding @group annotation for newly introduced test cases 2014-12-10 01:33:09 +01:00
Fedik
68ed56ce27 test for #1214, XML export the field options 2014-12-09 20:49:51 +02:00
Marco Pivetta
1cc42d6a63 Merge branch 'hotfix/#1202-nullable-options-should-be-allowed'
Close #1202
2014-12-08 01:35:11 +01:00
Marco Pivetta
78ba7f1073 #1202 - simplified test and test asset 2014-12-08 01:34:30 +01:00
Gareth Evans
c1000d23db Added test that passes following previous commit 2014-12-08 01:31:14 +01:00
Gareth Evans
2fac6272a1 Checks key exists rather than isset
If the default value is set to `null`, `isset` will return `false` even though the key is actually there for a reason.
2014-12-08 01:31:14 +01:00
Marco Pivetta
9509bec79a Merge branch 'hotfix/#1213-DDC-3437-reflection-embeddable-with-abstract-embeddable-ancestor'
Close #1213
2014-12-08 01:22:31 +01:00
Marco Pivetta
cf1b16a505 #1213 - DDC-3437 - renaming variables/alignment/clarifications in docblocks 2014-12-08 01:22:20 +01:00
Marco Pivetta
357292de44 #1213 - DDC-3437 - removing unused test assets 2014-12-08 01:20:00 +01:00
Marco Pivetta
55bcc193ae #1213 - DDC-3437 - removing redundant test method 2014-12-08 01:19:15 +01:00
Marco Pivetta
af0be57538 #1213 - DDC-3437 - integrating new tests into the pre-existing data-provider 2014-12-08 01:18:36 +01:00
Marco Pivetta
d75d6ffb11 #1213 - DDC-3437 - adding relevant test assets 2014-12-08 01:17:57 +01:00
Marco Pivetta
d259ba91b3 #1213 - DDC-3437 - refactoring tests to support embeddable class name != embeddable class property declaring class 2014-12-08 01:17:25 +01:00
Austin Morris
d48546d2dd fix instantiation of embedded object in ReflectionEmbeddedProperty 2014-12-08 01:06:11 +01:00
Guilherme Blanco
9900d35367 Merge pull request #1214 from Fedik/fix-xml-export-options
XML export driver: fix the options export
2014-12-07 10:52:45 -05:00
Fedik
c1eff7045a XML export driver: fix export options 2014-12-07 13:05:19 +02:00
Guilherme Blanco
0059e01936 Merge pull request #1208 from Ocramius/hotfix/DDC-3427-class-metadata-factory-should-accept-entitymanagerinterface-instances
DDC-3427 - class metadata factory should accept `EntityManagerInterface` instances
2014-12-05 12:22:23 -05:00
Marco Pivetta
590d971f83 Merge pull request #1211 from Ocramius/hotfix/DDC-3434-paginator-ignores-hidden-fields-in-order-by-query
DDC-3434 - paginator ignores `HIDDEN` fields in `ORDER BY` query
2014-12-05 18:02:39 +01:00
Marco Pivetta
ac67a10d4c DDC-3434 - adding note on why restoring 'HIDDEN' selected fields is relevant 2014-12-05 18:02:12 +01:00
Marco Pivetta
6169175a89 DDC-3434 - HIDDEN modifier marked fields in ORDER BY clause are always preserved when creating a paginator subquery 2014-12-05 17:11:57 +01:00
Marco Pivetta
6e8057b6ea DDC-3434 - adding test case for HIDDEN modifier fields in ORDER BY sequences: should be preserved in any case 2014-12-05 17:10:39 +01:00
Marco Pivetta
0c9a898ccd DDC-3434 - removed unneeded escaping sequences 2014-12-05 17:09:59 +01:00
Guilherme Blanco
a6cf714f41 Merge pull request #1210 from Ocramius/hotfix/DDC-3336-undefined-property-with-paginator-and-scalar-expression-select
DDC-3336 - undefined property with paginator walker and scalar expression in ORDER BY clause
2014-12-05 10:42:55 -05:00
Marco Pivetta
e53e8bfe8e DDC-3336 - applied hotfix: only PathExpression instances have a $field property 2014-12-05 14:56:47 +01:00
Marco Pivetta
c689ff081d DDC-3336 - adding missing type-hint docblock 2014-12-05 14:55:56 +01:00
Marco Pivetta
2bc8811e62 DDC-3336 - renamed test method for clarity 2014-12-05 14:55:26 +01:00
Marco Pivetta
42e0e6b0b8 DDC-3336 - adding failing test case: scalar expressions in the ORDER BY clause crash the LimitSubqueryOutputWalker 2014-12-05 14:54:26 +01:00
Marco Pivetta
529a268bbc DDC-3336 - importing platform classes 2014-12-05 14:53:42 +01:00
Steve Müller
38650b748d Merge pull request #1207 from Ocramius/hotfix/embedded-classes-reflection-new-instance-creation
Embedded classes reflection new instance creation with internal PHP classes
2014-12-05 14:24:23 +01:00
Marco Pivetta
e65417f1f6 DDC-3427 - Adding setting an EntityManagerInterface instance in the ClassMetadataFactory#setEntityManager() 2014-12-05 13:49:42 +01:00
Marco Pivetta
d20e018081 DDC-3427 - Adding a test to verify that the ClassMetadataFactory supports setting an EntityManagerInterface instance 2014-12-05 13:38:45 +01:00
Marco Pivetta
dcf824688a Verifying that reflection properties that don't contain an embeddable will not crash reading properties, but will return null instead 2014-12-05 13:15:15 +01:00
Marco Pivetta
b4a23e97a9 ReflectionEmbeddedProperty should be like any ReflectionProperty, and should therefore extend it for type compatibility 2014-12-05 13:06:41 +01:00
Marco Pivetta
112fdf46d0 Using instantiator to work with internal PHP classes as embeddables 2014-12-05 13:00:54 +01:00
Marco Pivetta
a8b0ac82b4 Adding a data-provider case for a generic model (non-internal class) 2014-12-05 12:57:48 +01:00
Marco Pivetta
ecf028490f Test to verify that Doctrine\ORM\Mapping\ReflectionEmbeddedProperty is able to interact with internal PHP classes 2014-12-05 12:56:34 +01:00
Marco Pivetta
7f84bc76a6 Namespace correction 2014-12-05 12:43:12 +01:00
Marco Pivetta
56cb47c585 Adding a test asset to play around with reflection and internal classes 2014-12-05 12:41:22 +01:00
Marco Pivetta
fc3f233923 Yodaism good for you: is. 2014-12-05 11:18:10 +01:00
Marco Pivetta
1d5a0a0a1b Adding docblocks 2014-12-05 11:17:43 +01:00
Marco Pivetta
b9506ac64a Merge pull request #1195 from decoursin/patch-1
Correction Events.rs - Entity Listeners Resolver
2014-12-04 14:03:09 +01:00
Marco Pivetta
8d4b46d014 Merge branch 'hotfix/#1204-metadata-xml-exporter-should-export-sequence-generator-info'
Close #1204
2014-12-04 14:00:34 +01:00
Marco Pivetta
c35f1310bc #1204 - using specific XML assertions to build a less-fragile test (asserting on the entire string may cause failures if the XML structure changes) 2014-12-04 14:00:05 +01:00
Marco Pivetta
ce308dc476 #1204 - refactored sequence-generator metadata exporting into own private method for simplicity 2014-12-04 14:00:05 +01:00
Paulo de Freitas
aa1454562c Fix sequence-generator in MetaData exporter for XML Driver. 2014-12-04 14:00:05 +01:00
Marco Pivetta
798a8b6d91 Merge pull request #1205 from Ocramius/hotfix/#1200-Yaml-parse-does-not-accept-files-in-symfony-2-6-fix
Hotfix - #1200 - Symfony 2.7.x deprecation fixes
2014-12-04 13:59:02 +01:00
Marco Pivetta
351707f1f1 #1200 - bumping symfony/console dependency to ~2.5 because of the Symfony\Component\Console\Helper\Table not being available in < 2.5 2014-12-04 13:42:38 +01:00
Marco Pivetta
9d2c0481ae #1200 - removing console deprecation errors by using the new Symfony\Component\Console\Helper\Table instead of the deprecated TableHelper 2014-12-04 13:40:22 +01:00
Marco Pivetta
d3b1bf571b #1200 - removing Yaml::parse() deprecation errors by passing in file contents instead of file paths 2014-12-04 13:37:59 +01:00
Guilherme Blanco
30bf192cf4 Merge pull request #1201 from marcosdsanchez/master
Update working-with-objects.rst
2014-12-01 10:52:56 -05:00
Marcos Sánchez
8e26705693 Update working-with-objects.rst
Fix syntax error in constructor.
2014-12-01 12:50:11 -03:00
Marco Pivetta
c2ad338707 Merge pull request #1198 from Bilge/patch-2
Tables for buttons.
2014-11-28 12:23:23 +01:00
Marco Pivetta
18fd892c85 Merge pull request #1199 from kormik/patch-1
minor typo
2014-11-28 11:14:09 +01:00
Tomas Kormanak
27e671378b minor typo 2014-11-28 08:40:00 +00:00
Bilge
13c03b573c Tables for buttons. 2014-11-28 05:18:18 +00:00
Marco Pivetta
ee13405a13 Merge pull request #1197 from Bilge/patch-1
Minor grammar fix.
2014-11-27 19:16:00 +01:00
Marco Pivetta
9eae0d5ce8 Merge branch 'hotfix/#1196-inherit-mapped-superclass-indexes'
See DDC-3418
See DDC-3419

Close #1196
2014-11-27 19:10:57 +01:00
Marco Pivetta
b3fe0904eb #1196 DDC-3418 DDC-3419 - Minor CS fixes, explicit setExpectedException calls 2014-11-27 19:10:45 +01:00
Marco Pivetta
71135972c6 #1196 DDC-3418 DDC-3419 - Renamed _factory to cmf 2014-11-27 19:08:10 +01:00
Marco Pivetta
291b68634e #1196 DDC-3418 DDC-3419 - Adding missing docblock for test private property 2014-11-27 19:07:16 +01:00
Bilge
f9b4df70ff Minor grammar fix. 2014-11-27 18:07:10 +00:00
Marco Pivetta
34d2af8a77 #1196 DDC-3418 DDC-3419 - assertArrayHasKey() instead of assertTrue(isset(...)) 2014-11-27 19:06:42 +01:00
Marco Pivetta
084ce7ecc0 #1196 DDC-3418 DDC-3419 - reducing test assets annotations spacing for readability 2014-11-27 18:57:49 +01:00
Marco Pivetta
b761d84d4f #1196 DDC-3418 DDC-3419 - refactoring class metadata factory to avoid duplicate checks 2014-11-27 18:54:10 +01:00
Marco Pivetta
7648a3c590 #1196 DDC-3418 DDC-3419 - refactoring inherited indexes copying logic into separate private method 2014-11-27 18:52:03 +01:00
Dustin Thomson
17ec1aab77 Modified class metadata factory to have entity tables inherit indexes from mapped superclasses 2014-11-27 18:41:33 +01:00
Marco Pivetta
ec6781954a Merge branch 'hotfix/#1188-support-count-queries-with-parameters-in-removed-query-parts'
Close #1188
2014-11-27 18:16:22 +01:00
Marco Pivetta
f536daa1e4 #1188 - Simplified and optimized parameter un-setting logic 2014-11-27 18:08:11 +01:00
Marco Pivetta
ac0f1b2ce2 #1188 - Importing parser class 2014-11-27 17:59:12 +01:00
Marco Pivetta
64752532dd #1188 - assertCount instead of assertEquals 2014-11-27 17:57:42 +01:00
Marco Pivetta
42547234d2 #1188 - minor CS fixes (avoiding DQL one-liner) 2014-11-27 17:54:02 +01:00
Marco Pivetta
ecb09b5627 #1188 - accessing Doctrine\ORM\Tools\Pagination\Paginator#getCountQuery() via reflection for test purposes 2014-11-27 17:50:27 +01:00
Marco Pivetta
69064ac13d #1188 - making Doctrine\ORM\Tools\Pagination\Paginator#getCountQuery() private, as it is an implementation detail 2014-11-27 17:48:37 +01:00
Marco Pivetta
a80117a4ee #1188 - removing unused variable assignments 2014-11-27 17:42:14 +01:00
Paweł Kolanowski
af39fce6e5 Missing doc block, removed parse() parameter.
Missing doc block, removed parse() parameter.
2014-11-27 17:27:22 +01:00
Merixstudio
18244161f7 Filtering by auto-increnement field causes test error.
Executing the same test many times causes error because AI fields.
2014-11-27 17:27:22 +01:00
Merixstudio
de1843ad30 Testing SQLs in functional test is not necessary 2014-11-27 17:27:22 +01:00
Merixstudio
fa014ee55d Test parameter removing parameters passed to select part of query. 2014-11-27 17:27:22 +01:00
Merixstudio
d02ea224df Allowed to get count query from paginator. 2014-11-27 17:27:22 +01:00
Merixstudio
42aff75108 Fixed counting exception
Fixed "Invalid parameter number: number of bound variables does not match number of tokens " exception during execution count on Query where select part of query contains :parameters.
2014-11-27 17:27:22 +01:00
Nick DeCoursin
82c5547931 Correction Events.rs - Entity Listeners Resolver
Configuring the Entity Listener Resolver can only be done before Entity Manager is initialized as described here: https://github.com/doctrine/doctrine2/pull/1193
2014-11-26 19:29:58 -05:00
Steve Müller
bf5003f25e Merge pull request #1192 from javiereguiluz/patch-4
Fixed a very minor typo
2014-11-25 09:42:10 +01:00
Javier Eguiluz
7e64d606d2 Fixed a very minor typo 2014-11-25 09:41:13 +01:00
Marco Pivetta
88ce68e733 Merge pull request #1190 from c960657/autogenerate-integer
Document that AUTOGENERATE_ constants are allowed
2014-11-21 21:54:00 +01:00
Christian Schmidt
89684b4ce9 Document that AUTOGENERATE_ constants are allowed 2014-11-21 21:11:32 +01:00
Marco Pivetta
e7be0c4dc9 Merge pull request #1184 from goetas/patch-2
Postgres SERIAL is not a post-insert identifier generation strategy
2014-11-12 10:31:52 +01:00
Asmir Mustafic
a1660997ff Postgres SERIAL is not a post-insert identifier generation strategy 2014-11-12 10:10:06 +01:00
Marco Pivetta
9280a4621d Merge pull request #1183 from NAYZO/patch-2
Update tools.rst
2014-11-12 10:04:49 +01:00
Ala Eddine Khefifi
44304c30b3 Update tools.rst 2014-11-12 09:55:51 +01:00
Marco Pivetta
ab62914f87 Merge pull request #1089 from encoder32/EntityRepositoryGeneratorDefaultRepository
EntityRepositoryGenerator default repository
2014-11-11 16:22:51 +01:00
Marco Pivetta
f987cf77b5 Merge branch 'hotfix/#1173-merge-association-to-identical-entities'
Close #1173
2014-11-11 12:38:08 +01:00
Marco Pivetta
2888791e5c #1173 - test CS fixes, reduced clutter code, made method names more explicit 2014-11-11 12:37:16 +01:00
Marco Pivetta
511893e182 #1173 - applying CS fixes on top of the patch 2014-11-11 12:27:57 +01:00
Mathieu De Zutter
2ead9e23ab Fix merging of entities with associations to identical entities.
Without this patch, when an entity that refers multiple times to the same
associated entity gets merged, the second references becomes null.

The main issue is that even though doMerge returns a managed copy, that value
is not used while cascading the merge. These identicial entities are already
detected through the visitor map, but they are ignored.  There should be some
refactoring so cascadeMerge calls a function that checks if the parent must be
updated, based on the return value of its call to doMerge.  However, this patch
tries to impact the code as little as possible, and only introduces a new
function to avoid duplicate code.

The secondary issue arises when using inverted associations. In that case, it
is possible that an entity to be merged is already merged, so the the visitor
map is looked up by the hash of a managed copy instead of the original entity.
This means that in this case the visitor map entries should also be set to the
entity, instead of being set to 'true'.
2014-11-11 12:12:25 +01:00
Mathieu De Zutter
9caef62489 Test case for merging entities with associations to identical entities. 2014-11-11 12:12:25 +01:00
Marco Pivetta
25849a3412 Merge pull request #1177 from c960657/production-settings-arraycache
Ensure metadata cache is not ArrayCache in production
2014-11-11 10:43:29 +01:00
Christian Schmidt
3287ce12a4 Fix namespace collission 2014-11-11 08:31:36 +01:00
Christian Schmidt
c973d8df1a Code style fixes. 2014-11-11 07:35:52 +01:00
jaimz22
dd012dfd90 oops.. forgot to add a condition 2014-11-08 16:56:42 +00:00
jaimz22
e2f1ea7f23 stupid cloud 9 ide broke my code :( sorry 2014-11-08 16:45:58 +00:00
jaimz22
c47a072815 fixed for failing test case. when a single DTO is specified in the query, you no longer get a multidimensional array returned. 2014-11-08 16:36:55 +00:00
jaimz22
2ffda34f23 fixing a missing index error 2014-11-08 10:15:33 -05:00
Christian Schmidt
0990d64756 Ensure metadata cache is not ArrayCache in production 2014-11-08 15:05:56 +01:00
Marco Pivetta
76e1a469ef Merge pull request #1027 from PowerKiKi/feature-partial-indexes
Support for Partial Indexes for PostgreSql and Sqlite
2014-11-05 13:19:29 +01:00
James Murray
da7e4ed8de removing orphaned scalar results and allowing mixed results when use new object expressions 2014-10-28 17:59:37 -04:00
James Murray
85eac7200d Adding the ability to alias new object expressions 2014-10-28 17:34:57 -04:00
Marco Pivetta
20c6bfd360 Aligning expected exception test to typo fix in doctrine/doctrine2@b7d104d2a2, which was breaking the build 2014-10-23 07:01:59 +02:00
Guilherme Blanco
b7d104d2a2 Fixed typo 2014-10-21 22:43:26 -04:00
Guilherme Blanco
3a0d7d1d6b Merge pull request #1146 from c960657/order-by-assoc
Allow orderBy to reference associations
2014-10-21 21:40:04 -04:00
Guilherme Blanco
3924ede3ad Merge pull request #1128 from Erikvv/patch-1
Add QueryBuilder::addSelect()
2014-10-21 21:35:26 -04:00
Kim Hemsø Rasmussen
6fc6d18882 Merge pull request #1165 from Ocramius/feature/#1120-metadata-info-command
[DDC-3205] #1120 - metadata info command
2014-10-20 20:46:33 +02:00
Marco Pivetta
ea6f2130b4 #1120 - downgrading requirement for symfony/console to ~2.3
Just need `Symfony\Component\Console\Helper\TableHelper` availability
2014-10-20 18:51:39 +02:00
Marco Pivetta
95bc0fb456 #1120 - using the Symfony\Component\Console\Helper\TableHelper for symfony/symfony:~2.3 compatibility
(Instead of `Symfony\Component\Console\Helper\Table`)
2014-10-20 18:49:54 +02:00
Marco Pivetta
a0e107249f Removing public properties validation (supported) 2014-10-20 15:15:05 +02:00
Marco Pivetta
9ccb56a7ab #1120 - applying CS fixes as per @dantleech's review 2014-10-19 19:56:21 +02:00
Marco Pivetta
9bf8f6ed4c DDC-3261 - fixed link to DBAL documentation (should always reference latest) 2014-10-19 19:18:11 +02:00
Marco Pivetta
29e99b2b89 #1120 - removed duplication: field and association mappings actually use the same dump format 2014-10-19 18:57:58 +02:00
Marco Pivetta
d5d64b756d #1120 - removed redundant if block 2014-10-19 18:42:14 +02:00
Marco Pivetta
1208cc836a #1120 - registering the new MappingDescribeCommand with the ORM's ConsoleRunner 2014-10-19 18:41:14 +02:00
Marco Pivetta
806068b0df #1120 - removing useless variables, refactoring 2014-10-19 18:36:08 +02:00
Marco Pivetta
39a8a31de9 #1120 - removing unused private properties 2014-10-19 18:34:42 +02:00
Marco Pivetta
574f3ea909 #1120 - map functions over array iteration/mutation 2014-10-19 18:34:06 +02:00
Marco Pivetta
254a46e79c #1120 - avoiding mutable state for rows/output 2014-10-19 18:32:12 +02:00
Marco Pivetta
250b38710c #1120 - missing docblock parameter 2014-10-19 18:23:50 +02:00
Marco Pivetta
db74efbe34 #1120 - test coverage annotations 2014-10-19 18:22:28 +02:00
Marco Pivetta
0f289a1270 #1120 - cs cleanups - moving success cases at the end of methods 2014-10-19 18:21:45 +02:00
Marco Pivetta
97fdd0adb7 #1120 - cleaning up try-catch code when fetching metadata 2014-10-19 18:14:33 +02:00
Marco Pivetta
100766e360 #1120 - Removing example array('Foo', 'Bar', 'Boo') dumped data 2014-10-19 18:13:46 +02:00
Marco Pivetta
dcdffbffc7 #1120 - assuming existence of Symfony\Component\Console\Helper\Table 2014-10-19 18:13:01 +02:00
Marco Pivetta
a762158e99 #1120 - since we want to use Symfony\Component\Console\Helper\Table, symfony/console:~2.5 is required 2014-10-19 18:11:42 +02:00
Marco Pivetta
7cf427cfbf #1120 - avoiding version comparisons when working with version-dependant constants 2014-10-19 17:53:40 +02:00
Marco Pivetta
ed79648d7d #1120 - avoiding storing the Doctrine\ORM\EntityManager in the command itself 2014-10-19 17:51:17 +02:00
Marco Pivetta
cf078d8da8 #1120 - avoiding storing the Doctrine\ORM\EntityManager in the command itself 2014-10-19 17:49:28 +02:00
Marco Pivetta
e9d7c23261 #1120 - MappingDescribeCommand can be final 2014-10-19 17:43:32 +02:00
dantleech
37de75b2ae Split new functionality into new command 2014-10-19 17:40:50 +02:00
dantleech
c71b489e9e Added preg_quote and doc blocks 2014-10-19 17:40:50 +02:00
dantleech
b5552a82e3 Code review fixes 2014-10-19 17:40:50 +02:00
dantleech
51cd8f7ce8 Added test 2014-10-19 17:40:50 +02:00
dantleech
45ce6a41a3 Expanded scope of orm:info to include metadata information 2014-10-19 17:40:50 +02:00
Marco Pivetta
a9bd51c0e4 Merge branch 'hotfix/#615-enforce-A-to-Z-sql-table-aliases'
Close #615
2014-10-19 17:25:09 +02:00
Marco Pivetta
b989175754 #615 - Removing unused assignment 2014-10-19 17:24:07 +02:00
Marco Pivetta
264cd8ee11 #615 - Refactoring test case to remove duplication 2014-10-19 17:21:13 +02:00
Marco Pivetta
69494dc624 #615 - sql table aliases should stay constant over time 2014-10-19 17:18:30 +02:00
Marco Pivetta
10da2eb85b #615 - Using a data provider to build aliases for the SqlWalkerTest 2014-10-19 17:16:07 +02:00
Marco Pivetta
17c9388473 #615 - Test coverage annotations 2014-10-19 17:10:39 +02:00
Marco Pivetta
435befd25c #615 - EOF EOL fixes 2014-10-19 17:09:41 +02:00
Marco Pivetta
d557a0e01b #615 - assignment alignment 2014-10-19 17:09:27 +02:00
Marco Pivetta
a4e9c235f8 #615 - assignment alignment 2014-10-19 17:08:33 +02:00
Mike Meier
109b0444f5 add SqlWalkerTest for getSQLTableAlias method 2014-10-19 17:05:34 +02:00
Mike Meier
fb5f76f025 rewrite tablePrefixAlias 2014-10-19 17:05:34 +02:00
Mike Meier
ebc996c820 Update SqlWalker.php
Always be sure that only a-z characters are used for table alias, otherwise use generic "t" for "table"
2014-10-19 17:05:34 +02:00
Steve Müller
06b5c84728 Merge pull request #1160 from Ocramius/hotfix/#1159-multiple-entity-managers-per-repository-factory
#1159 - multiple entity managers per repository factory should be supported
2014-10-19 14:58:04 +02:00
Marco Pivetta
0f26c62e73 Merge pull request #1143 from MajorCaiger/master
Fixed a bug so that a versioned entity with a oneToOne id can be created
2014-10-19 11:52:37 +02:00
Marco Pivetta
d361ed904e Merge pull request #1164 from AlphaStream/fix-querybuilder-on-hhvm
[QueryBuilder] Remove unused method parameters to run on HHVM/PHP7
2014-10-19 10:56:32 +02:00
Marco Pivetta
697640f561 Setting default timezone, as HHVM is misconfigured on travis-ci 2014-10-19 10:54:35 +02:00
Alex Bakhturin
b33c9befb7 [QueryBuilder] Remove unused method parameters that are shadowed by local variables
PHP5 treats the left part of such assignment as an independent local variable, while HHVM treats it as a reference to the method parameter. This leads to the value of the parameter being changed, which, in turn, causes func_get_args() to return not what is expected.
This commit is a part of the effort to make Symfony run flawlessly on HHVM. This issue causes a bunch of Symfony tests to fail on HHVM.
2014-10-17 11:17:33 -07:00
Marco Pivetta
f5ecabbc21 Merge pull request #1163 from taavit/patch-1
Update xml-mapping.rst
2014-10-17 00:13:28 +02:00
Dawid Królak
143f87960e Update xml-mapping.rst
Fixed closing entity tag.
2014-10-17 00:11:56 +02:00
Marco Pivetta
35d4405727 Merge pull request #1161 from gammamatrix/patch-1
Fixing error with from() parameters in example
2014-10-14 13:18:27 +02:00
Jeremy Postlethwaite
abe97bf0df Fixing error with from() parameters in example
The from method requires $from and the $alias to be separate parameters.

    public function from($from, $alias, $indexBy = null);

The examples show: from('User u')
2014-10-13 20:37:19 -07:00
Marco Pivetta
f28fa2d3a1 #1159 - EOF EOL CS fixes for Doctrine\ORM\Repository\DefaultRepositoryFactory tests 2014-10-14 01:49:57 +02:00
Marco Pivetta
b61496a36b #1159 - adding UPGRADE.md notes for Doctrine\ORM\Repository\DefaultRepositoryFactory becoming final 2014-10-14 01:48:25 +02:00
Marco Pivetta
8093c6ddb0 #1159 - protecting Doctrine\ORM\Repository\DefaultRepositoryFactory API by making it final and its protected members private 2014-10-14 01:46:50 +02:00
Marco Pivetta
a9847533e5 #1159 - Doctrine\ORM\Repository\DefaultRepositoryFactory keeps separate caches per entity manager used to build repositories 2014-10-14 01:46:14 +02:00
Marco Pivetta
56378b9bf0 #1159 - optimized imports 2014-10-14 01:40:38 +02:00
Marco Pivetta
7142c9029c #1159 - Doctrine\ORM\Repository\DefaultRepositoryFactory should create different repositories for different entity managers 2014-10-14 01:40:19 +02:00
Marco Pivetta
9ef3285ebb #1159 - verifying that Doctrine\ORM\Repository\DefaultRepositoryFactory considers custom repository class from metadata when instantiating repositories 2014-10-14 01:35:51 +02:00
Marco Pivetta
1e467fd23c #1159 - verifying that Doctrine\ORM\Repository\DefaultRepositoryFactory caches instantiated repositories locally 2014-10-14 01:32:04 +02:00
Marco Pivetta
5adce9a1e3 #1159 - base coverage for the Doctrine\ORM\Repository\DefaultRepositoryFactory implementation 2014-10-14 01:29:45 +02:00
Marco Pivetta
3ca0dae606 Merge pull request #1156 from NAYZO/patch-1
Fixed missed initialization in CommitOrderCalculator.php
2014-10-13 02:36:00 +02:00
Marco Pivetta
1e6ca40ffa Merge pull request #1157 from gennadiylitvinyuk/patch-1
Fixing calls of schema-update tools
2014-10-13 02:32:42 +02:00
Marco Pivetta
1d8ef5ed18 Merge pull request #1158 from josemalonsom/update-query-builder-ref-doc
Update QueryBuilder reference documentation.
2014-10-13 02:26:42 +02:00
Jose M. Alonso M
82887d0361 Update QueryBuilder reference documentation.
- Updated the signature of methods "from", "innerJoin" and "leftJoin"
  since it does not match the actual implementation.

- Added reference to the "join" method.
2014-10-12 20:31:33 +02:00
Gennadiy Litvinyuk
83cd44697d Fixing calls of schema-update tools
composer-generated binaries should be called without php interpreter.

Added reminder to update schema.
2014-10-12 17:50:47 +02:00
Ala Eddine Khefifi
f2bdfe102e Fixed missed initialization in CommitOrderCalculator.php 2014-10-12 14:04:41 +01:00
Marco Pivetta
10b801dec0 Adding note about a minor BC break: d2 does not call __clone on new objects anymore. 2014-10-06 14:57:03 +02:00
Christian Schmidt
94f5f53d2a Allow orderBy to reference associations 2014-10-05 10:16:58 +02:00
Marco Pivetta
0bff6aadbc Merge pull request #1147 from naitsirch/master
Extended the docs for mapping attributes precision and scale
2014-10-03 00:50:00 +02:00
Rob Caiger
dd398ce577 - Fixed the basic entity persister so that versioned OneToOne entities can be created
- Created an IdentifierFlattener utility class
- Moved the logic for the flatten identifier method into the new utility class
- Replaced calls for private flattenIdentifier to use new utility
- Added appropriate unit tests
2014-10-01 14:01:44 +01:00
Steve Müller
05045d9544 Merge pull request #1148 from naitsirch/hotfix/DWEB-118
[DWEB-118] Fixed small typo in documentation about extra lazy associations
2014-09-27 18:19:53 +02:00
naitsirch
547a902bd3 Fixed small typo in documentation about extra lazy associations #DWEB-118 2014-09-26 19:49:12 +02:00
Christian Stoller
d93f648230 Extended the docs for mapping attributes precision and scale 2014-09-25 09:38:34 +02:00
Marco Pivetta
3f8865c6fb Merge pull request #1092 from birko/pagination-count-walker
[DDC-2794] Arbitrary Join count walkers solution
2014-09-23 00:30:30 +02:00
Marco Pivetta
15a00ea807 Clearing cache by --id, --regex, --prefix and --suffix is not supported anymore. 2014-09-14 17:30:47 +02:00
Marco Pivetta
f12c311a79 Merge pull request #1135 from deeky666/DDC-3304
[DDC-3304] Add support for embeddables in entity generator
2014-09-12 21:54:45 +02:00
Steve Müller
b291d8d589 add support for embeddables in entity generator 2014-09-12 20:29:37 +02:00
Steve Müller
b249aa9f65 Merge pull request #1132 from Ocramius/hotfix/DDC-3272-entity-generator-mapped-superclass-casing
DDC-3272 entity generator mapped superclass casing
2014-09-10 18:27:51 +02:00
Marco Pivetta
4974edc70a DDC-3272 - fixing issue with mapped superclass name, minor refactoring 2014-09-10 17:00:06 +02:00
Marco Pivetta
dd9a6bea0a DDC-3272 - minor cleanups - inspecting a test failure related with @Doctrine\ORM\Mapping\Table autoloading 2014-09-10 16:57:35 +02:00
Marco Pivetta
ffe38e5088 DDC-3272 - cleanups, importing classes, optimized imports 2014-09-10 16:41:49 +02:00
Marco Pivetta
b9090ef73e DDC-3272 - failing test (to be run in insulation because of autoloading) that verifies that a wrong annotation is generated for @MappedSuperclass 2014-09-10 16:40:17 +02:00
Marco Pivetta
e2fea427a4 Merge pull request #1127 from crybat/master
Document embeddables column prefixing
2014-09-10 16:12:22 +02:00
encoder64
6bc003e47d simple fixes 2014-09-10 01:07:22 +03:00
encoder64
e295a6d05e visibility changed && few simple fixes 2014-09-09 22:17:10 +03:00
encoder64
409f6b4bc1 Unit Tests && simple fixes 2014-09-07 18:26:09 +03:00
encoder64
cd547fecea Corrected names to DDC3231 2014-09-06 18:29:14 +03:00
encoder64
859a5f88cb Unit Tests && simple fixes 2014-09-06 18:14:16 +03:00
encoder64
dc3bc45d1d Merge remote-tracking branch 'upstream/master' into EntityRepositoryGeneratorDefaultRepository 2014-09-06 15:33:48 +03:00
Mauro Pinto
857fed0310 Make embeddable doc more succinct, fix xml 2014-09-03 11:13:28 +01:00
Erik van Velzen
ba50f978a5 Add QueryBuilder::addSelect() 2014-09-02 13:52:52 +02:00
František Bereň
589d26fc5e Changed calling $from[0] to using reset($from)
changed usage $from[0] according suggestion from @Ocramius  to use array
reset function
2014-09-02 08:39:29 +02:00
Mauro Pinto
3bd916f763 Document embeddables column prefixing 2014-09-01 12:48:10 +01:00
Marco Pivetta
d9b43dc649 Merge pull request #1116 from deeky666/DDC-3265
[DDC-3265] Fix DocBlock
2014-08-30 04:22:47 +02:00
Marco Pivetta
6e79515a75 Merge pull request #1123 from stof/patch-1
Fixed the structure of the reverse-engineered mapping
2014-08-30 04:19:55 +02:00
Marco Pivetta
6e34985b51 Merge pull request #1126 from phansys/master
Fixed new line in docblock
2014-08-30 04:13:55 +02:00
Javier Spagnoletti
f731a66e1c Removed extra line breaks for docblocks in set, get, add and remove method templates. 2014-08-29 23:11:49 -03:00
Javier Spagnoletti
1378626937 Fixed new line in docblock (247803715b). 2014-08-29 22:49:23 -03:00
Guilherme Blanco
2a80e34179 Merge pull request #1125 from kcassam/patch-1
Update improving-performance.rst
2014-08-29 18:40:20 -04:00
Ka
2120d41029 add a link to said chapter 2014-08-29 08:47:28 +02:00
Ka
398688ab38 Update improving-performance.rst 2014-08-29 08:42:14 +02:00
František Bereň
d48be34696 CS Fixes 2014-08-28 13:17:25 +02:00
Guilherme Blanco
4b504c9436 Merge pull request #1109 from doctrine/hotfix/DDC-3120-php-5.6-RC3-compat
DDC-3120 - PHP 5.6-RC3 compatibility
2014-08-27 12:27:05 -04:00
Christophe Coevoet
f0c02bb6d9 Fixed the test expectations for the DatabaseDriver 2014-08-27 14:00:34 +02:00
Christophe Coevoet
00eb0d3b67 Fixed the structure of the reverse-engineered mapping 2014-08-27 13:56:02 +02:00
Guilherme Blanco
3d4113bd1b Merge pull request #1122 from Ocramius/feature/support-arithmetic-expressions-in-count
Support arithmetic expressions in `COUNT()`
2014-08-26 21:01:56 -04:00
Marco Pivetta
48a86511cb DDC-3276 - #1122 - updating EBNF in documentation to reflect new syntax support 2014-08-27 02:17:08 +02:00
Marco Pivetta
45d74e7220 DDC-3276 - #1122 - updating EBNF in docblock to reflect new syntax support 2014-08-27 02:12:08 +02:00
Marco Pivetta
a2e0133a94 Adding DDC-3276 test group 2014-08-27 02:01:56 +02:00
Marco Pivetta
097840dc93 Allowing expression in COUNT() DQL aggregation functions 2014-08-27 01:56:11 +02:00
Marco Pivetta
02ba144c8d Adding test to verify SQL generation with an expression in COUNT() 2014-08-27 01:55:28 +02:00
Marco Pivetta
91fa4c9be3 Merge pull request #1121 from deeky666/DDC-3274
[DDC-3274] Improve schema validator error message for invalid bi-directional relations
2014-08-26 23:27:23 +02:00
encoder64
c8565c2772 Visibility for EntityRepositoryGenerator::generateClassName() 2014-08-26 21:42:55 +03:00
Steve Müller
8d3fba5540 improve schema validator error message for invalid bi-directional relations 2014-08-26 19:46:17 +02:00
Steve Müller
65f8357b46 Merge pull request #1119 from stof/travis_colors
Enabled colors for the PHPUnit output on Travis
2014-08-22 14:00:20 +02:00
Christophe Coevoet
e7739d9411 Enabled colors for the PHPUnit output on Travis 2014-08-22 13:42:43 +02:00
Steve Müller
ad1f228ef6 fix DocBlock 2014-08-22 09:26:54 +02:00
Guilherme Blanco
400acad533 Merge pull request #1105 from deeky666/nested-embeddables
Add support for nesting embeddables
2014-08-21 16:33:44 -04:00
Steve Müller
e47b31845c Merge pull request #1115 from armetiz/patch-1
Fix wrong variable name
2014-08-21 11:22:35 +02:00
Thomas Tourlourat
613119599f Fix wrong variable name 2014-08-21 10:42:22 +02:00
Marco Pivetta
ff80187930 Merge pull request #1098 from encoder32/DDC-1590
#DDC-1590: Fix Inheritance in Code-Generation
2014-08-18 22:35:52 +02:00
Marco Pivetta
c20b3a7cf2 Merge branch 'hotfix/#1112-single-repository-for-aliased-entity'
Close #1112
2014-08-18 15:22:13 +02:00
Marco Pivetta
dfbaac0401 #1112 - Fixed type-hint that is incompatible with most IDEs 2014-08-18 15:18:59 +02:00
Marco Pivetta
aab7fce2d4 #1112 - Elvis operator reduces code duplication even more 2014-08-18 15:17:54 +02:00
Marco Pivetta
bf03694e28 #1112 - Yoday need you may, better IDE hinting as well needed is. 2014-08-18 15:16:45 +02:00
Marco Pivetta
19d3552f2a #1112 - Removing useless trimming of the entity name being passed in 2014-08-18 15:14:53 +02:00
Marco Pivetta
36bbd28b75 #1112 - adding test to verify that leading backslash is not relevant when fetching repositories 2014-08-18 15:11:39 +02:00
Marco Pivetta
ae16afa428 #1112 - adding DDC-3257 group to test method 2014-08-18 15:07:07 +02:00
Marco Pivetta
01f22988b1 #1112 - cleaning up repository test - makes assertions more clear/simpler to read 2014-08-18 15:06:37 +02:00
Marco Pivetta
3fed769b40 #1112 - avoiding useless assignments/splitted return statement 2014-08-18 15:02:34 +02:00
Marco Pivetta
7865de92ab #1112 - renamed $class to $className 2014-08-18 15:01:52 +02:00
Giorgio Premi
a665cb0229 DefaultRepositoryFactory: single repository for aliased entities 2014-08-18 14:52:01 +02:00
Marco Pivetta
5ff67c92ee Merge pull request #1111 from eko/master
Fix inheritance hierarchy wrong exception message
2014-08-15 16:13:33 +02:00
Vincent Composieux
edc2ed9512 Fix QueryException::instanceOfUnrelatedClass() message 2014-08-15 15:39:56 +02:00
Guilherme Blanco
ebc70d1baf Merge pull request #1110 from baileylo/patch-2
Changed table name to be more appropriate.
2014-08-14 20:16:34 -04:00
Logan Bailey
9b7318ab4c Changed table name to be more appropriate.
This change assumes that the Article object references the articles tables, not the user table.
2014-08-14 17:07:05 -07:00
Marco Pivetta
7b145f8269 DDC-3120 - requiring doctrine\instantiator:~1.0.1 as of doctrine/instantiator#4 2014-08-14 16:55:32 +02:00
Marco Pivetta
361ec2a474 DDC-3120 - using Doctrine\Instantiator when building new instances 2014-08-14 15:51:48 +02:00
Marco Pivetta
f8a8437c95 DDC-3120 - need to wakeup reflection BEFORE using any ClassMetadata API 2014-08-14 15:51:17 +02:00
Marco Pivetta
c2993bcdeb DDC-3120 - add failing test for un-serialization of an internal PHP class from cached metadata instance 2014-08-14 15:39:58 +02:00
Marco Pivetta
d52dd39592 DDC-3120 - add failing test for un-serialization of an internal PHP class 2014-08-14 15:38:55 +02:00
Marco Pivetta
2c3126353c DDC-3120 - adding instantiator dependency 2014-08-14 15:33:09 +02:00
Steve Müller
6ac19b04bf Merge pull request #1108 from umpirsky/patch-1
Minor CS fix
2014-08-12 10:16:17 +02:00
Saša Stamenković
133bd288bf Minor CS fix 2014-08-12 09:57:19 +02:00
Steve Müller
0768916a06 fix handling infinite nesting of embeddables 2014-08-12 07:56:39 +02:00
Steve Müller
bca9d31531 add support for nesting embeddables 2014-08-11 16:53:18 +02:00
encoder64
cd4bc93483 Simple Fixes 2014-08-09 13:27:38 +03:00
encoder64
20b72ef344 Visibility for EntityRepositoryGenerator::$repositoryName 2014-08-09 13:20:27 +03:00
Adrien Crivelli
1003466a5f Surround ! with spaces according to code style 2014-08-05 18:07:00 +09:00
encoder64
94ba6e2dfc #DDC-1590: Simple Fixes 2014-08-04 20:18:26 +03:00
Marco Pivetta
723529ffff Merge pull request #1069 from anho/reuse-console-app
added method to be able to reuse the console application
2014-08-04 16:17:11 +02:00
encoder64
4e805bb59a #DDC-1590: Fix Inheritance in Code-Generation: Code Style Fixes 2014-08-03 17:07:20 +03:00
encoder64
e0ae7634d5 #DDC-1590: Fix Inheritance in Code-Generation 2014-08-03 17:02:33 +03:00
Marco Pivetta
2ae8538f96 Merge pull request #1096 from simonharris/master
Changes for grammar and clarity
2014-07-31 18:02:34 +02:00
Simon Harris
7c2ab7fff8 Changes for grammar and clarity 2014-07-31 16:45:33 +01:00
Simon Harris
bf91d03adf Merge pull request #1 from doctrine/master
Update from original
2014-07-31 16:24:31 +01:00
František Bereň
54ac6a0535 Updated Asset queries
Missing  braces and selected fields
2014-07-31 09:01:58 +02:00
František Bereň
458b953522 fixed typos in tests 2014-07-31 08:43:02 +02:00
František Bereň
164352562b Added Tests for Arbitrary Join 2014-07-31 08:31:39 +02:00
Marco Pivetta
0650bb954f Merge pull request #1094 from thekeyboardbum/master
Fix bulk insert code example
2014-07-31 00:06:05 +02:00
Justin
2d23c95c3f Fix bulk insert code example
Previous code example did not flush all entities when entity count was not a multiple of batch count.
2014-07-30 15:00:35 -07:00
Marco Pivetta
66d67445c9 Merge pull request #1093 from malukenho/patch-2
Use `null` comparation instead of `is_null()`
2014-07-30 21:58:55 +02:00
Jefersson Nathan
1b9f42ae67 Use null comparation instead of is_null() 2014-07-30 16:54:24 -03:00
František Bereň
a37f99f242 Root selection according other pagination tools
changed root selection in Walkers from looping queryComponents to using
$AST->fromClause as other walkers have
2014-07-30 15:55:14 +02:00
František Bereň
114bd2435f Arbitrary Join count walkers solution
Possible solution for Arbitrary Join problem in pagination count
walkers:
https://groups.google.com/forum/#!topic/doctrine-user/rpPYCDNKOU8

Added a condition to test query component against  SelectStatement from
clause
2014-07-30 09:56:22 +02:00
encoder64
df80d82aab Reverted visibility for EntityRepositoryGenerator::generateEntityRepositoryNamespace() 2014-07-27 20:15:18 +03:00
encoder64
5d608b6206 Private method EntityRepositoryGenerator::generateEntityRepositoryNamespace() changed to protected 2014-07-27 19:05:42 +03:00
encoder64
a4c7a89507 className fix: If namespace is not set then ClassName will be cut of 2014-07-27 17:28:06 +03:00
encoder64
c04b01cbd7 Added NS checking 2014-07-27 17:02:19 +03:00
encoder64
3dc2a68583 simple fixes 2014-07-27 15:22:51 +03:00
encoder64
90efaeec42 Code Style fixes 2014-07-27 14:54:35 +03:00
encoder64
c0ee57ae55 Default/Custom Entity Repository for Entity Repository Generator 2014-07-27 14:44:31 +03:00
Marco Pivetta
089cca636e Merge pull request #1088 from austinsmorris/fix-clt-autoload-path
Fix the composer autoload paths for the doctrine CLT
2014-07-24 17:34:21 +02:00
Austin Morris
a6a9c72a75 Fix the composer autoload paths for the doctrine CLT 2014-07-24 09:52:55 -04:00
Andreas Hörnicke
a76506c3fd amended documentation 2014-07-24 09:38:08 +02:00
Andreas Hörnicke
1d16e5322f added a simple test 2014-07-24 09:23:36 +02:00
Marco Pivetta
2b24478f05 Merge pull request #1087 from malukenho/patch-1
Remove the error control operator
2014-07-24 00:35:18 +02:00
Jefersson Nathan
70fe21b30a Remove the error control operator 2014-07-23 17:09:47 -03:00
Adrien Crivelli
bb5345b330 Adapt formatting to pre-existing content 2014-07-22 10:44:45 +09:00
Adrien Crivelli
27adf8d6e9 Refactor partial into options array
This coherent with what is done for Table. All platform specific things
are grouped into an options array. Eventually flags should be migrated
into options as well.
2014-07-22 10:32:31 +09:00
Adrien Crivelli
eeb7ff4a6d Support for Partial Indexes for PostgreSql and Sqlite
Support for Partial Indexes was available in Doctrine 1 following
http://www.doctrine-project.org/jira/browse/DC-82. This commit
reintroduce support for Doctrine 2. We use the same syntax with an
optionnal "where" attribute for Index and UniqueConstraint.
2014-07-22 10:32:30 +09:00
Marco Pivetta
499f09fc99 Merge pull request #1084 from hartca/master
Update advanced-field-value-conversion-using-custom-mapping-types.rst
2014-07-18 01:25:50 +02:00
hartca
0ab2672872 Update advanced-field-value-conversion-using-custom-mapping-types.rst 2014-07-18 00:10:47 +01:00
Marco Pivetta
205a5de4e5 Merge pull request #1083 from deeky666/DDC-3073
[DDC-3073] Add documentation about how to map column options
2014-07-17 11:56:40 +02:00
Steve Müller
040c445297 add documentation about how to map column options 2014-07-17 11:28:43 +02:00
Guilherme Blanco
c019047d6c Merge pull request #1082 from scotam/invalid-parameter-count
added more informative error messages when invalid parameter count
2014-07-15 11:06:53 -04:00
Rhodri Pugh
ad10a18071 added more informative error messages when invalid parameter count 2014-07-15 13:17:22 +01:00
Marco Pivetta
85fbf68436 Merge branch 'hotfix/#1019-detached-entity-exception-rewording'
Close #1019
2014-07-14 11:25:42 +02:00
Andreas Flack
0ade3aa62a Improve phrasing on exception message instead of trying to fix callers 2014-07-14 11:25:04 +02:00
flack
b8ef3af982 Small grammar fix
The exception was reading 

```
A detached entity was found during {removed|persisted} [entityName] 
```

I changed the verbs to infinitive now. Alternatively, the text in ``ORMInvalidArgumentException::detachedEntityCannot`` could also be changed to read 


```
Detached entity [entityName] cannot be {removed|persisted}  
```
2014-07-14 11:25:04 +02:00
Marco Pivetta
5361676bba Merge pull request #1038 from Greenflex/doc/dql-hidden-keyword
Add documentation for the `HIDDEN` keyword in DQL
2014-07-14 11:18:30 +02:00
Marco Pivetta
90dee7036d Merge pull request #1067 from albertvolkman/add-fullstop-and-newline
Add fullstop and newline after property description.
2014-07-14 11:09:40 +02:00
Marco Pivetta
b80149344d Merge pull request #1073 from kamazee/add_passing_type_to_rsm_in_sql_walker
Add missing type mapping
2014-07-14 10:51:13 +02:00
Alexander Kurilo
38fcc66c16 Add missing type mapping
Fixes DDC-3192
Refs DDC-2494

This is essentially a fix from DDC-2494 applied to SQLWalker.
The issue: type was not converted to PHP value when the result is fetched by
executing DQL query rather than using entity manager's findX(). Similar issue
for BasicEntityPersister (which is used when em's findX is executed) was fixed
in DDC-2494, but SQLWalker made the issue valid for any custom query.
2014-07-14 11:22:08 +03:00
Marco Pivetta
ae0ee72425 Merge pull request #1080 from danielsippel/DDC-2021
possible fix for DDC-2021
2014-07-11 21:35:34 +02:00
Daniel Sippel
ae2235fd3c DDC-2021 sql generation test: remove comment 2014-07-10 00:32:24 +02:00
Daniel Sippel
b31ba98076 DDC-2021 add sql generation test 2014-07-10 00:27:28 +02:00
Daniel Sippel
45358bf5d0 possible fix for DDC-2021 2014-07-09 16:39:44 +02:00
Marco Pivetta
bf1e7e150e Merge pull request #1078 from renan/patch-1
Removing Value Objects from limitations
2014-07-07 20:20:59 +02:00
Renan Gonçalves
c9901c9017 Removing Value Objects from limitations as per #835 2014-07-07 20:17:56 +02:00
Marco Pivetta
a8035f25a2 Merge pull request #1074 from zimmermanj42/DDC-3160
[DDC-3160] Alternate fix for DDC-2996 bug
2014-07-06 16:07:43 +02:00
Justin Zimmerman
6a4867512e Fix test issues. 2014-07-04 11:15:57 -04:00
Justin Zimmerman
65e7cc9143 [DDC-3160] Change to fix that was implemented for DDC-2996.
A fix for DDC-2996 was implemented that broke quite a few extensions.

This commit is an attempt to fix the DDC-2996 bug without the adverse side effects seen in DDC-3160.

Basically, if changes are detected that would cause a changeset to be made, but the entity is awaiting insertion, the code will not save the changeset nor flag the entity as awaiting updating in the Unit of Work.

Some styling tweaks based on Pull Request guidelines.
2014-07-04 10:51:04 -04:00
Guilherme Blanco
8c0166d3bf Merge pull request #1076 from velosipedist/fix-typos
Fix switch non-uniform syntax
2014-07-01 23:11:53 -04:00
velosipedist
60cb01be1f Fix switch non-uniform syntax 2014-06-29 18:00:02 +04:00
Marco Pivetta
c370426792 Merge pull request #1075 from vilartoni/master
Fixed query cache id generation: added platform to hash
2014-06-27 22:37:36 +02:00
Antonio Vilar
4e61ceb0df Added platform key 2014-06-27 22:36:02 +02:00
Antonio Vilar
0dde8585c3 Fixed query cache id generation: added platform to hash 2014-06-27 20:29:55 +02:00
Marco Pivetta
9e36a95a97 Merge pull request #1065 from egeloen/DDC-3179
[DDC-3179] EntityNotFoundException on the postRemove event if the entity is a proxy
2014-06-26 18:25:53 +02:00
Eric GELOEN
20f96cc9d3 [DDC-3179] Document postRemove limitation 2014-06-26 18:09:32 +02:00
Marco Pivetta
22d71de2c3 Merge pull request #1071 from VasekPurchart/fix-setup-cache
Setup::createConfiguration breaks Cache interface contract
2014-06-26 02:15:54 +02:00
Vasek Purchart
ee5f465a2f set namespace in setup only on CacheProvider instances 2014-06-26 01:29:35 +02:00
Andreas Hörnicke
eef32d4372 added method to be able to reuse the console application 2014-06-24 11:02:24 +02:00
Marco Pivetta
d98b4a5124 Merge pull request #1068 from jkavalik/patch-1
Fix typo in documentation
2014-06-24 08:25:19 +02:00
jkavalik
d5dd21dd79 Fix typo in documentation 2014-06-24 08:00:45 +02:00
Albert Volkman
247803715b Add fullstop and newline after property description. 2014-06-23 09:53:27 -04:00
Guilherme Blanco
38187a31d6 Merge pull request #1032 from bakura10/optimized-contains
Add support for optimized contains in LazyCriteria
2014-06-21 08:56:47 -04:00
Guilherme Blanco
381cf8022f Merge pull request #1063 from FlorianLB/master
singularize variable name on add/remove methods for EntityGenerator
2014-06-21 08:49:53 -04:00
Marco Pivetta
84a0fddaf4 Merge branch 'hotfix/#1064-xsd-on-update-removal' 2014-06-19 16:06:03 +02:00
Marco Pivetta
19b5e87cab on-update is not supported anymore 2014-06-19 16:05:12 +02:00
Marco Pivetta
e940ce1df6 Replacing " with ' to avoid escaping warnings 2014-06-19 15:54:43 +02:00
Marco Pivetta
59720370f9 Corrected FQCN reference in @expectedException 2014-06-19 15:53:37 +02:00
Marco Pivetta
7dfca09ff6 Minor CS fixes (use statements compliant with PSR-2) 2014-06-19 15:53:11 +02:00
Marco Pivetta
85c02e57b1 Merge pull request #1064 from stefanotorresi/update-xsd
remove on-update from join-column
2014-06-19 14:33:58 +02:00
Stefano Torresi
391847d627 remove on-update from join-column 2014-06-19 14:27:56 +02:00
FlorianLB
fdca5d7584 singularize variable name on add/remove methods for EntityGenerator 2014-06-19 10:00:40 +02:00
Guilherme Blanco
f7c5a0684a Merge pull request #1060 from ureimers/master
[DDC-3170] SimpleObjectHydrator fails to get discriminator column from mapped SQL result
2014-06-17 10:44:16 -04:00
Ulf
a7aa634247 Fixed mapping of discriminator column
Added fix for [DDC-3170] (http://www.doctrine-project.org/jira/browse/DDC-3170).

When querying a simple entity which uses single table- or class table inheritance using simple object hydration (``AbstractQuery::HYDRATE_SIMPLEOBJECT``), the mapped discriminator column was not retrieved correctly.

If the column got an alias during result set mapping other than it's actual name (e.g. ``type34`` insteaad of ``type``) than this alias wasn't reverted when retrieving the discriminator column from the SQL result set.
2014-06-17 14:51:19 +02:00
Ulf
7aa1c0a907 Create DDC3170Test.php
Added test for [DDC-3170] (http://www.doctrine-project.org/jira/browse/DDC-3170)
2014-06-17 14:45:59 +02:00
Marco Pivetta
ef43b223fd Merge pull request #1059 from iampersistent/patch-3
fix spacing for yaml example
2014-06-16 20:21:30 +02:00
Richard Shank
9a5fc49690 fix spacing for yaml example 2014-06-16 08:20:14 -07:00
Marco Pivetta
ca37f87c27 Merge pull request #1058 from DavidPrevot/Unicode
Drop Unicode character
2014-06-15 12:19:45 +02:00
David Prévot
3ff92f587f Drop Unicode character
It broke the LaTeX build.
2014-06-14 23:14:42 -04:00
Andreas Flack
a5cf6417b3 Add failing test for DDC-3160 2014-06-12 17:28:13 +02:00
Marco Pivetta
5c447cfb71 Merge branch 'hotfix/build-fix' 2014-06-07 15:12:09 +02:00
Marco Pivetta
50d7975fd6 Allowing failures on hhvm-nightly, as the build chokes on composer installation for now (unrecognized console flags) 2014-06-07 15:11:51 +02:00
Marco Pivetta
32b24ba155 Fixed mismatch in expected exception message, see doctrine/doctrine2#1048 2014-06-07 14:55:59 +02:00
Marco Pivetta
3ade0cf6a5 Merge pull request #1048 from MidnightDesign/patch-1
Fix typo in exception message
2014-06-06 04:34:50 +02:00
Marco Pivetta
d71159c6c5 Merge pull request #1049 from deeky666/DDC-3152
[DDC-3152] Fix redeclaration of methods on entity generation update
2014-06-06 03:48:24 +02:00
Steve Müller
dcf8d6a86e ignore case when checking for existing methods to avoid redeclaration on update 2014-06-05 15:58:54 +02:00
Rudolph Gottesheim
daa90bf32d Fix typo in exception message 2014-06-04 15:59:57 +02:00
Benjamin Eberlei
6f622ab1f7 Merge branch 'master' of github.com:doctrine/doctrine2 2014-06-03 21:42:38 +02:00
Benjamin Eberlei
46ebb57b45 Fix wrong version 2014-06-03 21:41:26 +02:00
Marco Pivetta
b3d01b6036 Merge pull request #1047 from simonharris/master
Minor grammatical corrections
2014-06-03 17:52:45 +02:00
Simon Harris
7dac285de6 A few minor changes for English and clarity 2014-06-03 16:46:37 +01:00
Simon Harris
8b1f5d71e1 Fix minor grammatical error 2014-06-03 16:26:54 +01:00
Benjamin Eberlei
e577e77867 Cleanup 93c276d 2014-06-03 17:05:02 +02:00
Marco Pivetta
2101a8fdc6 Merge branch 'hotfix/php-version-id-check-in-metadata-prototype-instantiation' 2014-05-31 13:37:50 +02:00
Marco Pivetta
72750b05e6 Using PHP_VERSION_ID instead of version_compare to see if we're using PHP 5.4+ 2014-05-31 13:37:39 +02:00
Guilherme Blanco
a851dd68fb Merge pull request #1045 from marmotz/master
Fix the "Erroneous data format for unserializing" error message
2014-05-30 09:11:34 -04:00
Renaud LITTOLFF
93c276d059 Fix the "Erroneous data format for unserializing" error message 2014-05-30 10:43:11 +02:00
Marco Pivetta
5d1275e938 Merge pull request #1044 from ronanguilloux/patch-2
Use of ->andWhere() whithout any ->where() before is valid
2014-05-29 22:42:09 +02:00
Ronan Guilloux
526c757901 Update query-builder.rst 2014-05-29 16:36:22 +02:00
Ronan Guilloux
495fe6002d Update query-builder.rst
->andWhere() can be used directly, without any ->where() before, and we can just always use ->andWhere(). This is why ->hasWhere() is useless, cf. #1043.
2014-05-29 16:29:49 +02:00
Marco Pivetta
5ee286e7e0 Merge pull request #1041 from c960657/entity-manager-interface
Allow all EntityManagerInterface implementations
2014-05-28 14:40:22 +02:00
Marco Pivetta
f941264b5e Merge pull request #1042 from bakura10/patch-1
Fix second level cache doc
2014-05-28 13:57:15 +02:00
Michaël Gallego
3d32bc47a7 Fix second level cache doc 2014-05-28 13:07:01 +02:00
Christian Schmidt
a7d072f525 Allow all EntityManagerInterface implementations
This is necessary if Doctrine\ORM\Decorator\EntityManagerDecorator is used.
2014-05-28 12:30:40 +02:00
Marco Pivetta
466808bf48 Merge pull request #1039 from iampersistent/patch-1
Add yml example to single table inheritance
2014-05-27 16:56:08 +02:00
Richard Shank
edaeaf48a8 Add yml example to single table inheritance 2014-05-27 07:47:07 -07:00
Michaël Perrin
b400ad52cc Add documentation for the HIDDEN keyword in DQL 2014-05-27 11:43:15 +02:00
Marco Pivetta
20e47ae52d Merge pull request #1037 from spiechu/patch-1
I can't look at those semicolons, sorry ;-)
2014-05-27 09:55:42 +02:00
Dawid Spiechowicz
9c24e0b510 I can't look at those semicolons, sorry ;-) 2014-05-27 09:37:40 +02:00
Marco Pivetta
b421d03f69 Merge pull request #1036 from albertvolkman/entity-mapper-remove-extra-space
Move space addition to implementation.
2014-05-22 00:15:22 +02:00
Albert Volkman
49bca5171b Move space addition to implementation. 2014-05-21 16:27:36 -04:00
Marco Pivetta
7debf736a6 Merge pull request #1034 from hashnz/master
Update caching.rst
2014-05-19 22:59:06 +02:00
hashnz
43c4c80388 Update caching.rst
Remove documentation referencing delete by regex/prefix.
2014-05-20 08:53:41 +12:00
Michaël Gallego
140dc92e5f Enforce Criteria 2014-05-18 12:47:59 +02:00
Marco Pivetta
04aea73a85 Merge branch 'tests/lazy-collection-tests'
Tests for doctrine/doctrine2@d30e3ab43c
2014-05-17 19:08:37 +02:00
Marco Pivetta
a259138180 The count in a LazyCriteriaCollection is null on initialization 2014-05-17 19:08:25 +02:00
Marco Pivetta
c68ed4c204 Verifying that the persister is used only once when matching on a lazy criteria collection 2014-05-17 19:06:16 +02:00
Marco Pivetta
d2174a893a Verifying that count is not called on the persister when the collection is initialized 2014-05-17 18:56:42 +02:00
Marco Pivetta
546bb53ef9 Verifying that count on the lazy criteria collection is cached even with 0 count 2014-05-17 18:51:33 +02:00
Marco Pivetta
c46b63f6b4 Verifying that count on the lazy criteria collection is cached 2014-05-17 18:51:01 +02:00
Marco Pivetta
81fbb049a5 LazyCriteriaCollection test setUp 2014-05-17 18:48:25 +02:00
Marco Pivetta
7cb40ed915 Mocking up tests for the lazy-criteria-collection 2014-05-17 18:45:33 +02:00
Michaël Gallego
9d7d731090 Remove BC notice 2014-05-17 16:59:43 +02:00
Michaël Gallego
8a8c6ea3a6 Remove extra phpdoc 2014-05-17 14:53:06 +02:00
Michaël Gallego
ddfc951a0e Remove useless docblock 2014-05-17 14:33:15 +02:00
Michaël Gallego
239b862665 Add missing typehint 2014-05-17 13:00:47 +02:00
Michaël Gallego
f52a512c59 Add UPGRADE note 2014-05-17 12:57:39 +02:00
Michaël Gallego
a04113f410 Add support for optimized contains 2014-05-17 12:54:25 +02:00
Guilherme Blanco
d6c727dcc1 Update LazyCriteriaCollection.php
Fixed issue where count = 0
2014-05-16 14:03:20 -04:00
Marco Pivetta
8babb77d37 Merge pull request #1031 from mnapoli/custom-functions-callback-documentation
Documentation for #991
2014-05-16 14:40:17 +02:00
Matthieu Napoli
5a4c558865 Fixed #991 to support non-closure callables on PHP 5.3 2014-05-16 10:49:59 +02:00
Matthieu Napoli
b16423b26b Documentation for #991 2014-05-16 09:32:52 +02:00
Guilherme Blanco
47ca10076b Merge pull request #991 from mnapoli/custom-functions-callback
Ability to define custom functions with callback instead of class name
2014-05-16 00:27:30 -04:00
Guilherme Blanco
d30e3ab43c Added count cache when lazy collection is not yet initialized. Some cosmetic changes (primarily, there's no ELSE). 2014-05-16 04:22:11 +00:00
Michaël Gallego
92a2b01c77 Fix tests by forcing collection initialization 2014-05-15 18:37:41 +02:00
Michaël Gallego
172df22281 Fix inconsistent mapping 2014-05-15 18:22:57 +02:00
Michaël Gallego
0a6c2027f5 Update tests 2014-05-15 18:22:57 +02:00
Michaël Gallego
45e9d6ed5a Fix test on some RDBMS 2014-05-15 18:22:57 +02:00
Michaël Gallego
11de4c2e72 Only create lazy collection for EXTRA_LAZY 2014-05-15 18:22:57 +02:00
Michaël Gallego
50832fd3bc Add tests for PersistentCollection 2014-05-15 18:22:57 +02:00
Michaël Gallego
876643e83e Add test for Entity Repository 2014-05-15 18:22:57 +02:00
Michaël Gallego
6cb5097ea8 Add method visibility 2014-05-15 18:22:57 +02:00
Michaël Gallego
8514ec7320 Remove useless imports 2014-05-15 18:22:57 +02:00
Michaël Gallego
3c522f4984 Reuse Doctrine Collection Lazy Collection 2014-05-15 18:22:57 +02:00
Michaël Gallego
28afb52734 Typehint to interface to support second level cache 2014-05-15 18:22:56 +02:00
Michaël Gallego
ac15b184b6 Fix tests for inheritance support 2014-05-15 18:22:56 +02:00
Michaël Gallego
632382b069 Add missing methods to the mock 2014-05-15 18:22:56 +02:00
Michaël Gallego
7551b1ad00 Update to latest cache API 2014-05-15 18:22:56 +02:00
Michaël Gallego
9813c2d5f1 Add tests 2014-05-15 18:22:56 +02:00
Michaël Gallego
0fa7b45a0e Also add efficient count for Persistent collection 2014-05-15 18:22:56 +02:00
Michaël Gallego
9b7dce1940 Use inner collection count if initialized 2014-05-15 18:22:56 +02:00
Michaël Gallego
b556bcb16c Remove useless dependency 2014-05-15 18:22:56 +02:00
Michaël Gallego
f1a793f2ee Initial work for efficient counting on criteria 2014-05-15 18:22:56 +02:00
Marco Pivetta
91df8f5649 Merge branch 'hotfix/DDC-3123-test-assertion-simplification' 2014-05-15 17:37:55 +02:00
Marco Pivetta
65e55a0c49 DDC-3123 - using assertAttributeEmpty (with message) instead of explicit reflection 2014-05-15 17:37:41 +02:00
Matthieu Napoli
c7eb42b04f Ability to define custom functions with callback + tests 2014-05-15 12:06:21 +02:00
Guilherme Blanco
5c828fc6c8 Merge pull request #1023 from coma/DDC-3027
[DDC-3027] Avoid duplicated mapping using Embedded in MappedSuperclass
2014-05-14 22:37:24 -04:00
Guilherme Blanco
4874070b3f Merge branch 'feature/default-query-hints' of https://github.com/Strate/doctrine2 into Strate-default-query-hints 2014-05-15 01:15:34 +00:00
Steve Müller
c16de21172 Merge pull request #1030 from doctrine/hotfix/DDC-3123-extra-updates-cleanup
DDC-3123 extra updates cleanup
2014-05-15 01:07:34 +02:00
Marco Pivetta
ccc789eadd DDC-3123 - the UoW should clear extra updates immediately 2014-05-15 00:18:50 +02:00
Marco Pivetta
9cdcba3fbc DDC-3123 - verifying that the UoW is not clearing extra inserts 2014-05-15 00:18:22 +02:00
Marco Pivetta
08347cf4f7 Adding PHP 5.6 and HHVM-nightly to build matrix 2014-05-11 17:51:23 +02:00
Marco Pivetta
94837a0105 Merge pull request #1026 from flack/patch-5
Remove some redundant clauses
2014-05-03 01:43:38 +02:00
flack
5cf906d76b Remove some redundant clauses 2014-05-02 21:52:00 +02:00
Steve Müller
7fffba80c3 Merge pull request #1025 from josemalonsom/remove-duplicate-entry-in-toc
Removed duplicate entry in documentation TOC.
2014-05-01 14:23:56 +02:00
Jose M. Alonso M
204b7fe854 Removed duplicate entry in documentation TOC. 2014-05-01 13:02:29 +02:00
Eduardo García Sanz
8a3def097f [DDC-3027] Avoid duplicated mapping using Embedded in MappedSuperclass 2014-04-30 11:46:54 +02:00
Marco Pivetta
7a305475e3 The proxy factory always expects non-null identifier values 2014-04-29 13:25:17 +02:00
Marco Pivetta
27845088e3 Merge branch 'hotfix/DDC-3103-#1020-serialize-isEmbedded-in-class-metadata'
Close #1020
2014-04-29 13:16:02 +02:00
Marco Pivetta
677cea4748 DDC-3103 - minor CS fixes/adjustments 2014-04-29 13:12:17 +02:00
Marco Jantke
f065a5c8b9 fixed bug 2014-04-29 09:30:37 +02:00
Marco Jantke
cf84183c18 created test case to reproduce error 2014-04-29 09:30:10 +02:00
Guilherme Blanco
48172f3a53 Readability update to hydrators. 2014-04-29 05:05:38 +00:00
Guilherme Blanco
9cd16ec56a More optimizations around hydrators. Pretty much same performance, just better memory footprint (-0.25MB). 2014-04-28 13:47:57 +00:00
Guilherme Blanco
be94eb9d1f Made ClassMetadata to be reused during gatherRowData() and also during hydrateRow() to share same fetches instead of recalculating all info again. Performance improvement after 100x runs comparison is around 4%. 2014-04-28 02:38:51 +00:00
Guilherme Blanco
35c8cd7f23 Added type conversion to meta column in case a type is specified (such as a foreign key or discriminator column). 2014-04-25 05:22:33 +00:00
Guilherme Blanco
21437bb276 Heavily simplified code on simple object hydrator. Code cleanup on column information cache; by reference cache variable is no longer needed and protected variable is used in a standardized way everywhere. 2014-04-25 03:41:14 +00:00
Guilherme Blanco
e8e86205f5 Merge pull request #1018 from chandon/master
DBAL-878 Wrong mapping type
2014-04-24 20:52:27 -04:00
Cédric Chandon
9ba31a394a [DBAL-878] Wrong mapping type
the type should be the mapping type, and not the name of the type. This
does the difference for simple_array, as the result should be
simple_array and not simplearray
2014-04-25 01:59:15 +02:00
Guilherme Blanco
f7de00b401 Finalized fix for scalars and newObjects. 2014-04-24 05:21:24 +00:00
Guilherme Blanco
9692fc8c5b Fixed issue if aliases were specific names, you would either get completely misleading results (dql alias: scalars) or a fatal error (dql alias: newObjects). 2014-04-24 04:47:13 +00:00
Guilherme Blanco
a3febd79de Abstract cache information of field result for hydrators. 2014-04-23 18:50:29 +00:00
Guilherme Blanco
a4dac7a292 Highlighted intention of converting scalar types during single scalar or scalar hydration, but leaving it commented and added a note about the BC reason why we cannot do that for 2.X series. 2014-04-23 18:04:06 +00:00
Marco Pivetta
9ec54b8fed Merge pull request #1015 from EvanDotPro/docs/expressionbuilder-contains
Add ExpressionBuilder::contains() to docs
2014-04-23 15:58:06 +02:00
Evan Coury
d2c2067aaf Add ExpressionBuilder::contains() to docs 2014-04-23 06:54:03 -07:00
Guilherme Blanco
9ebce31a46 Made AbstractHydrator::gatherRowData() more understandable without breaking functionality. 2014-04-23 06:08:18 +00:00
Guilherme Blanco
29de3e00ff Added support for NEW operator when using ArrayHydration if user desires to benefit from this funcionality. 2014-04-23 05:10:23 +00:00
Guilherme Blanco
63d21ca4b2 DDC-3085 Verify ResultVariable works in combination with NullComparisonExpression wihle in HAVING clause. 2014-04-21 04:01:32 +00:00
Guilherme Blanco
4185a9ce4b Merge pull request #999 from doctrine/hotfix/DDC-3065-null-value-in-in-criteria-support
DDC-3065 null value in in criteria support
2014-04-20 23:30:14 -04:00
Guilherme Blanco
1e90fd1164 Merge pull request #1014 from bakura10/patch-1
Update second level cache doc
2014-04-20 18:24:01 -04:00
Michaël Gallego
9b847f1a04 Update second-level-cache.rst 2014-04-20 23:52:06 +02:00
Guilherme Blanco
6a8ee87268 Made DQL and EBNF in sync. 2014-04-20 20:27:57 +00:00
Guilherme Blanco
a3f95d919b DDC-3075 Added support for subqueries in NEW operator. 2014-04-20 14:40:51 +00:00
Guilherme Blanco
38b6838386 DDC-2575 Fixed issue with associations when parent is not yet loaded, but child is being created and no link happens. 2014-04-18 05:21:27 +00:00
Guilherme Blanco
df806977c6 Updated fix for HHVM. 2014-04-18 03:05:41 +00:00
Guilherme Blanco
9441e063aa Updated XML Exporter to deal with some HHVM weirdness. 2014-04-18 03:04:04 +00:00
Guilherme Blanco
10a0daf620 DDC-3068 DDC-3069 EntityManager::find accept array of object as id. 2014-04-18 02:03:47 +00:00
Fabio B. Silva
54d9f05e39 Merge pull request #1009 from doctrine/feature/hhvm-tests
HHVM compatibility
2014-04-17 16:21:06 -04:00
Marco Pivetta
e1259098f5 Fixed whitespace around imported classes 2014-04-17 15:37:24 -04:00
Marco Pivetta
9ab6ef723a Removing too eager cache tests 2014-04-17 15:37:24 -04:00
Marco Pivetta
b4933d76c7 HHVM tests are not allowed to fail anymore 2014-04-17 15:37:24 -04:00
Marco Pivetta
abb4671bfc Removing usage of memcache cache in tests (HHVM gets stuck on them on local setups) 2014-04-17 15:37:23 -04:00
Marco Pivetta
e263426cdf Removing eager assertion on error suppression when generating schema via tools 2014-04-17 15:37:23 -04:00
Guilherme Blanco
6af3236ba6 Merge pull request #1012 from FabioBatSilva/DDC-3078-slc-cache-interface-ctor-removal
Ddc 3078 slc cache interface ctor removal
2014-04-17 15:34:36 -04:00
Guilherme Blanco
318f5032db Missing documentation update. 2014-04-17 19:31:06 +00:00
Guilherme Blanco
be1cc14a9c DDC-2890 Fixed pagination with association order by. 2014-04-17 19:29:18 +00:00
fabios
1dc3396ad4 DDC-3078 - Use CacheFactory instead of cache instantiator 2014-04-17 15:20:31 -04:00
Marco Pivetta
fa1cc9269c DDC-3078 - removing unused imports 2014-04-17 15:16:59 -04:00
Marco Pivetta
d57d4b71f9 DDC-3078 - default cache instantiator class name was misstyped 2014-04-17 15:16:59 -04:00
Marco Pivetta
48e227167e DDC-3078 - cache instantiator related exceptions are not needed anymore 2014-04-17 15:16:59 -04:00
Marco Pivetta
df6a411365 DDC-3078 - cache instantiator is used in the ORM instead of callables 2014-04-17 15:16:59 -04:00
Marco Pivetta
4b388b2ce8 DDC-3078 - coverage for the default cache instantiator 2014-04-17 15:16:58 -04:00
Marco Pivetta
a790639167 DDC-3078 - providing a default cache instantiator implementation 2014-04-17 15:16:58 -04:00
Marco Pivetta
6931cd08c4 DDC-3078 - using an explicit CacheInstantiator interface to replace callable cache instantiators 2014-04-17 15:16:58 -04:00
Marco Pivetta
d7f87cdd36 DDC-3078 - removing unused cache class name invalidity exception methods 2014-04-17 15:16:58 -04:00
Marco Pivetta
9b2ee88683 DDC-3078 - removing cache class name setter/getter from cache configuration API 2014-04-17 15:16:58 -04:00
Marco Pivetta
87a907f9dd DDC-3078 - switching cache initialization to use cache instantiator from config 2014-04-17 15:16:57 -04:00
Marco Pivetta
cd0f94dd6c DDC-3078 - removing tests for cache class setter/getter on cache configuration 2014-04-17 15:16:57 -04:00
Marco Pivetta
68f489ecbb DDC-3078 - cache configuration tests for the newly introduced API for cache instantiators 2014-04-17 15:16:56 -04:00
Marco Pivetta
e5f79d1f73 DDC-3078 - adding API for cache instantiation to the configuration object 2014-04-17 15:16:56 -04:00
Marco Pivetta
1b5eb55ed9 DDC-3078 - adding exception methods for invalid cache instantiator 2014-04-17 15:16:56 -04:00
Marco Pivetta
04b52149ab DDC-3078 - constructor should never be interfaced 2014-04-17 15:16:56 -04:00
Guilherme Blanco
841bdd5ca5 DDC-2827 Added support for AggregateExpressions in NullComparisonExpression. 2014-04-17 04:39:26 +00:00
Guilherme Blanco
ceada41b83 DDC-2934 Added support for function declarations in order by. 2014-04-17 04:15:35 +00:00
Guilherme Blanco
54898eca60 Added index by consideration when eagerly loading to-many associations. 2014-04-17 03:53:21 +00:00
Guilherme Blanco
13afde0140 Updated phpunit dependency. 2014-04-17 01:22:17 +00:00
Guilherme Blanco
f5e6044cf5 Provided more decriptive explanation when single scalar hydrator is used and it returns multiple columns. 2014-04-17 01:09:33 +00:00
Guilherme Blanco
1488a509b2 DDC-2937 More informative response when using single scalar hydrator when it returns single row but multiple columns. 2014-04-16 05:44:54 +00:00
Guilherme Blanco
6e9b15a48f Merge pull request #951 from md2perpe/MoreInformationalEntityNotFoundException
More informational entity not found exception
2014-04-16 01:40:02 -04:00
Guilherme Blanco
b28fa9a05a DDC-1632 Optimized query count for one-to-many associations with fetch eager. 2014-04-16 05:36:31 +00:00
Guilherme Blanco
4029dc2ea8 Merge pull request #988 from holtkamp/DDC-3047-Exporter-association-fetch-modes
Exporter support for association fetch modes
2014-04-16 00:52:51 -04:00
Guilherme Blanco
1cd0b26a40 DDC-3068 EntityManager clear() calls now follow cascade detach configuration. 2014-04-16 04:47:57 +00:00
Guilherme Blanco
5ce6dabe9b Fixes DDC-2984. Made DDC-742 more resilient to recurring failures. 2014-04-16 04:20:18 +00:00
Marco Pivetta
68d477a4c6 Merge pull request #1011 from md2perpe/patch-2
Single quotes can't nest
2014-04-15 14:25:24 +02:00
Per Persson
38911076ad Single quotes can't nest
I decided to use "... '...' ...", but perhaps you prefer '... \'...\' ...'?
2014-04-15 13:56:18 +02:00
Guilherme Blanco
2da74e5147 Merge pull request #1006 from Trainmaster/master
Handling invalid discriminator values
2014-04-15 00:07:03 -04:00
Marco Pivetta
3a1e24e680 Merge branch 'feature/#973-index-flags-in-mappings'
Close #973
2014-04-14 01:22:02 +02:00
Marco Pivetta
a87d3e080e Minor CS fixes on top of #973 2014-04-14 01:21:23 +02:00
Adrian Olek
eccd8f85bc cs fixes 2014-04-14 01:21:23 +02:00
Adrian Olek
72bb16173a Added Comment entity mapping for StaticPHPDriver test 2014-04-14 01:21:23 +02:00
Adrian Olek
32ed32cf56 Added index flags test 2014-04-14 01:21:23 +02:00
Adrian Olek
b3a2988d2c CS fixes 2014-04-14 01:21:23 +02:00
Adrian Olek
cc2fb1a070 Added index flags support in annotation, xml & yaml mapping drivers. 2014-04-14 01:21:23 +02:00
Benjamin Eberlei
da24133306 Merge pull request #980 from adrianolek/convert-mapping-options
Added options attribute export to Annotation, Xml & Yaml exporters.
2014-04-13 23:38:30 +02:00
Marco Pivetta
8b6b1c68a0 Merge pull request #1010 from BenMorel/validation-message
Fixed validation message
2014-04-12 01:49:16 +02:00
Benjamin Morel
1b4eafc873 Fixed validation message 2014-04-11 22:27:51 +00:00
Guilherme Blanco
ac956f2b8c Merge pull request #1007 from umpirsky/patch-1
Minor dockblock change
2014-04-09 07:55:12 -04:00
Saša Stamenković
dc10bb69f6 Minor dockblock change 2014-04-09 13:53:56 +02:00
Frank Liepert
8740d54210 [DDC-3076] Add/Improve tests 2014-04-09 11:31:16 +02:00
Frank Liepert
df020e08a0 [DDC-3076] Fix ObjectHydrator 2014-04-09 11:30:11 +02:00
Frank Liepert
a054b59550 [DDC-3076] Add test 2014-04-09 10:19:48 +02:00
Frank
d1c722c1d0 Fix: handle invalid discriminator value 2014-04-09 01:55:54 +02:00
Frank
f7b95c1aa5 Add: invalidDiscriminatorValue method 2014-04-09 01:55:49 +02:00
Guilherme Blanco
73e5bbecbe Merge pull request #1004 from giosh94mhz/removed_useless_testinit
Removed all useless occurrence of require_once TestInit.php
2014-04-07 08:38:39 -05:00
Giorgio Premi
6cb3fa8fb7 Removed all useless occurrence of require_once TestInit.php 2014-04-07 14:43:25 +02:00
Marco Pivetta
4d950a9e10 Merge pull request #1002 from BenMorel/propertyfix
Fixed wrongly initialized property.
2014-04-04 22:42:43 +02:00
Benjamin Morel
b3ec4df8ce Fixed wrongly initialized property. 2014-04-04 20:05:16 +00:00
Guilherme Blanco
bfb66f1d85 Merge pull request #985 from doctrine/hotfix/DDC-3042-sql-alias-collisions-in-dql
[DDC-3042] SQL Alias collisions in DQL
2014-04-03 20:41:36 -05:00
Marco Pivetta
f80fceda0e DDC-3042 - changing SQL generation tests to respect changes in naming strategy 2014-04-04 03:05:48 +02:00
Marco Pivetta
e6bf096583 Prefixing alias counter with _ to fix DDC-3042 and prevent collisions 2014-04-04 03:05:48 +02:00
Marco Pivetta
11b3065fd1 Verifying DDC-3042 - duplicate aliases in DQL SQL generation 2014-04-04 03:05:48 +02:00
Marco Pivetta
3680bb7ccc Stubbing out test for DDC-3042 - DQL aliases cause collisions when selecting from tables with similar properties 2014-04-04 03:05:48 +02:00
Marco Pivetta
733102b4a1 DDC-3065 - applying hotfix that allows NULL in IN() criteria 2014-04-03 17:36:56 +02:00
Marco Pivetta
a8b96803a4 DDC-3065 - persister tests for criteria containing NULL values in IN() conditions 2014-04-03 17:36:56 +02:00
Marco Pivetta
eb6498544f DDC-3065 - splitting tests and checking multiple values support 2014-04-03 17:36:56 +02:00
Marco Pivetta
f54d6157f4 DDC-3065 - hardening test - should support multiple values in IN(), also NULL ones 2014-04-03 17:36:56 +02:00
Marco Pivetta
f2f571e4ab DDC-3065 - failing test - IN()-alike criteria should support NULL search values 2014-04-03 17:36:56 +02:00
Menno Holtkamp
26307a0cee Added 'fetch="EXTRA_LAZY"' to many-to-many association 2014-03-31 11:55:04 +02:00
Menno Holtkamp
8d0a5958eb Code-style improvement 2014-03-31 11:02:36 +02:00
Menno Holtkamp
59842e9bc6 Code-style improvement
Also to trigger Travis CI
2014-03-31 11:00:50 +02:00
Menno Holtkamp
3044009550 Added 'fetch="EAGER"' to one-to-one association 2014-03-30 16:01:46 +02:00
Marco Pivetta
da96f4938a Merge pull request #994 from ThomasLomas/patch-1
Update EntityGenerator comment
2014-03-29 02:51:00 +01:00
Thomas Lomas
7d9630786b Update EntityGenerator comment
fieldVisibility was referred to as a boolean, where it is actually a string.
2014-03-29 01:49:12 +00:00
Marco Pivetta
8f688509c8 Merge pull request #992 from BenMorel/docfix
Fixed typos
2014-03-28 14:05:20 +01:00
Benjamin Morel
b3ec87ab09 Fixed typos 2014-03-28 12:54:49 +00:00
Marco Pivetta
ca19db34d2 Merge pull request #990 from Remper/patch-1
Typo in documentation
2014-03-27 13:51:28 +01:00
Nechaev Yaroslav
46b16a5e10 Update dql-doctrine-query-language.rst 2014-03-27 15:49:04 +03:00
Nechaev Yaroslav
b145ebf955 Typo in documentation
This method from AbstractQuery accepts constants from ClassMetadata rather than string
2014-03-27 15:45:52 +03:00
Menno Holtkamp
798075931a Exporter support for association fetch modes 2014-03-26 01:00:17 +01:00
Steve Müller
048c56bdb0 Merge pull request #987 from baileylo/patch-1
Fixes typo in dql-doctrine-query-language.rst
2014-03-25 19:11:28 +01:00
Logan Bailey
263d9f30f2 Fixes typo in dql-doctrine-query-language.rst
Changes "If you a query" to "If you have a query"
2014-03-25 11:10:43 -07:00
Benjamin Eberlei
927d69b61a Merge pull request #957 from thealjey/master
makes doctrine less dependent upon the symfony yaml component
2014-03-23 15:41:27 +01:00
Benjamin Eberlei
8addb5ffa8 Merge pull request #960 from drealecs/fixes-EntityManagerInterface
allow passing EntityManagerInterface when creating a HelperSet
2014-03-23 15:36:38 +01:00
Benjamin Eberlei
5335b2a2ad Merge pull request #955 from goatherd/patch-1
iteration risk note
2014-03-23 15:35:53 +01:00
Benjamin Eberlei
71fc425902 Merge pull request #963 from mdemo/master
SQLFilter -- allows to check if a parameter was set
2014-03-23 15:33:14 +01:00
Benjamin Eberlei
a03c8da683 Merge pull request #962 from netiul/master
Stop executeDeletions when there is nothing to to delete anymore
2014-03-23 15:32:28 +01:00
Benjamin Eberlei
dd8075ea95 Merge branch 'DDC-3018' 2014-03-23 15:16:15 +01:00
Benjamin Eberlei
2aea3036b6 [DDC-3018] Fix string literals in new operator. 2014-03-23 15:16:09 +01:00
Adrian Olek
0caeb4edbf Initialize table options annotation, fixed condition in AnnotationDriver 2014-03-23 14:37:55 +01:00
Benjamin Eberlei
24d4fd17f3 Merge branch 'DDC-2996' 2014-03-23 13:19:04 +01:00
Benjamin Eberlei
d473824279 [DDC-2996] Fix bug in UnitOfWork#recomputeSingleEntityChangeSet
When calling UnitOfWork#recomputeSingleEntityChangeSet on an entity
that didn't have a changeset before, the computation was ignored.
This method however is suggested to be used in "onFlush" and "preFlush"
events in the documentation.

Also fix a bug where recomputeSingleEntityChangeSet was used
before calculating a real changeset for an object.
2014-03-23 13:16:33 +01:00
Benjamin Eberlei
e415da7f47 Merge branch 'DDC-3033' 2014-03-23 12:38:06 +01:00
Benjamin Eberlei
ecc2857e2d [DDC-3033] Clarify restrictions in events. 2014-03-23 12:37:56 +01:00
Benjamin Eberlei
396337bd0d [DDC-3033] Fix bug in UnitOfWork#recomputeSingleEntityChangeSet.
The fix for DDC-2624 had a side effect on recomputation of
changesets in preUpdate events. The method wasn't adjusted
to the changes in its sister method computeChangeSet() and
had wrong assumptions about the computation.

Especially:
1. Collections have to be skipped
2. Comparison was changed to strict equality only.
2014-03-23 12:35:54 +01:00
Benjamin Eberlei
fb2d2bce45 Merge pull request #984 from holtkamp/patch-1
Use boolean values for 'unique' attribute
2014-03-23 10:16:04 +01:00
Benjamin Eberlei
0621b5a161 Merge branch 'DDC-3045' 2014-03-23 09:58:38 +01:00
Benjamin Eberlei
c8836a008d [DDC-3045] Check that EntityRepository APIs prevent SQL injection through field names. Improve EntityManager#find() error handling when invalid identifier fields are passed. 2014-03-23 09:58:31 +01:00
Menno Holtkamp
6e651b13c9 Added test to ensure boolean metadata is properly exported/serialized to XML 2014-03-20 21:29:52 +01:00
Guilherme Blanco
fdb9f90848 Merge pull request #983 from holtkamp/patch-new-dql-in-expression-builder
Added MEMBER OF and INSTANCE OF to ExpressionBuilder
2014-03-20 08:28:32 -05:00
Menno Holtkamp
ef4e73f987 Use boolean values for 'unique' attribute
As defined in: https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd#L294

Same as 'nullable' attribute. 

It was being exported as a "1" for TRUE and "0" for false
2014-03-20 11:08:29 +01:00
Menno Holtkamp
262e465e39 Processed code-review feedback 2014-03-20 09:02:39 +01:00
Menno Holtkamp
56e879b7aa Removed double linebreaks 2014-03-19 13:03:26 +01:00
Menno Holtkamp
400f420925 Added MEMBER OF and INSTANCE OF helpers to ExpressionBuilder 2014-03-19 13:00:45 +01:00
Thomas Lallement
6bbc07ddbf Update DDC3033Test.php 2014-03-18 22:10:15 +01:00
Thomas Lallement
7bf2bcb017 Update DDC3033Test.php 2014-03-18 15:04:48 +01:00
Thomas Lallement
263822fd19 Failing Test (since commit 53a5a48aed)
Hi,

It seems to be a regression since the commit 53a5a48aed

Doctrine\ORM\PersistentCollection can be populated in $changeSet if you set a PreUpdate and PostUpdate event.

Original issue: http://www.doctrine-project.org/jira/browse/DDC-3033
2014-03-18 15:00:43 +01:00
Marco Pivetta
9b4ae6d556 Removing note on m2m association filtering as of #885 2014-03-16 17:41:19 +01:00
Guilherme Blanco
383604d4b8 Merge pull request #978 from AntonStoeckl/embedded-empty-prefix
[DDC-2987] Enable empty prefixes for inlined embeddable
2014-03-16 11:35:25 -05:00
Guilherme Blanco
44c1dae1b9 Merge pull request #885 from bakura10/criteria-many-to-many
Add support for ManyToMany Criteria
2014-03-16 11:33:10 -05:00
Adrian Olek
49587776fa Renamed _exportOptions method 2014-03-16 17:31:15 +01:00
Adrian Olek
e403bf207c cs fix 2014-03-16 16:56:46 +01:00
Adrian Olek
553883bdd1 Added options attribute export to Annotation, Xml & Yaml
exporters.
2014-03-16 16:50:41 +01:00
Anton Stoeckl
83ef47c8d0 This fixes ticket DDC-3028
Enables columnPrefix to be "false" so no prefix is added.
Changed the structure a bit (to if/else) to be more readable with the additional condition.
2014-03-14 12:34:22 +01:00
Anton Stoeckl
871dc5d186 Test are for fix of ticket DDC-3028
Added 3 tests that check regression for:
- columnPrefix is empty
- columnPrefix is a string
- columnPrefix is false

Added some small entity / embeddable classes to support the test cases.
2014-03-14 12:32:49 +01:00
Anton Stoeckl
cd2043915c columnPrefix must support string and boolean, so changing to mixed 2014-03-14 12:29:01 +01:00
Anton Stöckl
fa79de6ea4 Enable empty prefixes for inlined embeddable
This fixes http://www.doctrine-project.org/jira/browse/DDC-2987

This makes it possible to map a field from an embeddable to a database field with the same name, without any prefix added.

Example:
- an embeddable object "Id" with a property "id"
- per default this would map inline to id_id
- supplying null or '' as columnPrefix does not work due to the ! empty() check
- with my little change, if columnPrefix : false is supplied in the mapping config this will now map to a db column "id"

To build Ids as ValueObjects is a very common approach in DDD, so ihmo this is a must have.
2014-03-13 16:47:22 +01:00
Marco Pivetta
b30b1a5999 Merge pull request #977 from mvrhov/patch-2
Fix wrong annotation
2014-03-11 14:52:49 +01:00
Miha Vrhovnik
d888d7d1c0 Fix wrong annotation
Without above fix I'm getting 
"[Semantical Error] The annotation "@array" in method Doctrine\ORM\Mapping\ClassMetadataInfo::mapEmbedded() was never imported. Did you maybe forget to add a "use" statement for this annotation?"
2014-03-11 14:44:42 +01:00
Marco Pivetta
02daf0049a Merge branch 'docs/DDC-3020' 2014-03-11 11:30:18 +01:00
Marco Pivetta
fea200043e Adding note about DDC-3020 - external XML entities may or may not work 2014-03-11 11:30:08 +01:00
Marco Pivetta
87505c8716 Merge pull request #975 from tkleinhakisa/doc-automatic-discriminator-map
Added info about automatic discriminator map
2014-03-11 10:08:58 +01:00
Klein Thomas
832127a0d6 Added info about automatic discriminator map
see https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php#L257
2014-03-11 09:54:46 +01:00
Guilherme Blanco
f197a9c9f1 Merge pull request #974 from FabioBatSilva/resolve-association-entry
[SLC] Resolve association cache entry
2014-03-06 22:38:26 -05:00
Fabio B. Silva
e9ec0a24da [SLC] resolve association cache entry 2014-03-06 20:44:59 -05:00
Fabio B. Silva
ecf242f6d4 Merge pull request #971 from FabioBatSilva/slc-query-assoc-proxy
[SLC] Fix query association proxy
2014-03-06 15:43:58 -05:00
Marco Pivetta
8d4821b4dc Merge pull request #972 from hallabro/patch-1
Capitalize @GeneratedValue (annotations-reference.rst)
2014-03-05 11:03:30 +01:00
Marco Pivetta
7843eed8bc Merge pull request #969 from aitboudad/patch-2
[Doc] added note about Criteria limits on PersistentCollection
2014-03-05 10:59:10 +01:00
Robin Hallabro
a395921fdc Capitalize @GeneratedValue (annotations-reference.rst) 2014-03-05 10:57:31 +01:00
Fabio B. Silva
cbdd8bc041 [SLC] Fix query association proxy 2014-03-05 04:10:07 -05:00
Abdellatif AitBoudad
5f429a5418 [Doc] added note Criteria limits. 2014-03-04 21:36:07 +00:00
Guilherme Blanco
15432fc55f Merge pull request #967 from FabioBatSilva/slc-query-builder
[SLC] Add query builder options
2014-03-03 21:10:48 -05:00
fabios
6e64cc101a [SLC] Add query builder options 2014-03-03 15:28:35 -05:00
Benjamin Eberlei
63d849b6f0 Merge pull request #966 from FabioBatSilva/simplify-build
Simplify build matrix
2014-03-02 12:36:50 +01:00
Fabio B. Silva
a91e05db9e Simplify build matrix 2014-03-01 17:13:28 -05:00
Benjamin Eberlei
a522aa0a81 Merge pull request #965 from FabioBatSilva/slc-criteria
[SLC] Add support for criteria
2014-03-01 12:47:57 +01:00
Benjamin Eberlei
f0a6eb8723 Merge pull request #964 from FabioBatSilva/DDC-2943
[SLC][DDC-2943] Disable slc for pagination queries
2014-03-01 12:46:52 +01:00
Fabio B. Silva
8c2aef3f14 [DDC-2943] Disable slc for pagination queries 2014-03-01 01:15:09 -05:00
Fabio B. Silva
f4c63f8238 [SLC] Support criteria 2014-03-01 00:59:34 -05:00
Miro Demovic
1921c2f74a Allow if parameter exists in SQLFilter 2014-02-26 08:55:47 +01:00
Zacharias Luiten
8a168bb2ce stop executing executeDeletions when there is nothing to to delete anymore 2014-02-25 16:02:02 +01:00
Alexandru Patranescu
1fe6dbc1f2 allow passing EntityManagerInterface when creating a HelperSet 2014-02-23 20:01:14 +02:00
Benjamin Eberlei
f5897d4b0b Merge branch 'master' of github.com:doctrine/doctrine2 2014-02-21 16:14:57 +01:00
Benjamin Eberlei
51e5db86b7 Add SECURITY.md and a chapter on security assumptions in Doctrine ORM. 2014-02-21 16:12:32 +01:00
Eugene Kuzmenko
c06201303d makes doctrine less dependent upon the symfony yamp component 2014-02-20 09:28:44 +00:00
Marco Pivetta
dfe7a68053 Removing notice about public properties support (included since 2.4)
see doctrine/doctrine2#406
2014-02-19 22:02:07 +01:00
Marco Pivetta
5a2497d482 Merge pull request #935 from da-eto-ya/remove_public_validation
Remove incorrect (outdated) validation for public fields in SchemaValidator
2014-02-19 21:21:59 +01:00
Marco Pivetta
0797feeb0f Travis must use --prefer-source because of Github API limitations 2014-02-18 10:28:13 +01:00
Michaël Gallego
b550d44cb9 CS fix 2014-02-18 10:26:26 +01:00
Michaël Gallego
a45ecb5733 Fix bug with hydrators 2014-02-18 10:26:25 +01:00
Michaël Gallego
6cbd643d4b Add test 2014-02-18 10:26:25 +01:00
Michaël Gallego
f03f991a25 Functional test 2014-02-18 10:26:25 +01:00
Michaël Gallego
0d5de64c0f Fix CS 2014-02-18 10:26:25 +01:00
Michaël Gallego
a55f2c48ca Fix test 2014-02-18 10:26:25 +01:00
Michaël Gallego
e5ba28676d fallback to persister count 2014-02-18 10:26:25 +01:00
Michaël Gallego
fbbe922cb6 Fix tests 2014-02-18 10:26:25 +01:00
Michaël Gallego
c69b7562ab Remove useless exception 2014-02-18 10:26:25 +01:00
Michaël Gallego
bb1f71f1f9 Fix docblock 2014-02-18 10:26:25 +01:00
Michaël Gallego
be39afa2f4 Add method to interface 2014-02-18 10:26:24 +01:00
Michaël Gallego
9385a600cf Fix wrong logic 2014-02-18 10:26:24 +01:00
Michaël Gallego
738cc250f8 Revert docblock 2014-02-18 10:26:24 +01:00
Michaël Gallego
07654ddd3f Revert tab changes 2014-02-18 10:26:24 +01:00
Michaël Gallego
160b07d1e3 Rebase to master 2014-02-18 10:26:24 +01:00
Guilherme Blanco
0dbd742588 Merge pull request #886 from Strate/bugfix/join-with-condition-placement-fix
[DDC-1256] Fix applying ON/WITH conditions to first join in Class Table Inheritance
2014-02-17 12:12:05 -05:00
Maik Penz
0677423d14 iteration risk note
> instead of loading the whole result into memory at once
is not the full truth.

There is a certain risk of processes getting killed due to memory allocation with large iteration. This is caused by result buffering of the client not being visible to PHP and thus not from 'within' the process.

It is not certain that this occurs with all database clients but seems rather likely to at this point.

This is only a proposal for discussion as I am not certain how to best add the information or if to add it at all (was it obvious before?). Personally I got confused by the existing description and didn't notice the memory implication until further investigation using `top` reported the process to run at 3+GB memory while PHP reported 400M real peak usage.
2014-02-17 10:33:10 +01:00
Marco Pivetta
4382304e77 Merge pull request #953 from goetas/patch-1
Update doc with latest news about extra lazy assoc
2014-02-12 23:56:00 +01:00
Asmir Mustafic
e27d963784 Update extra-lazy-associations.rst 2014-02-12 23:42:52 +01:00
Asmir Mustafic
1f0d4197a9 Update doc with latest news about extra lazy assoc 2014-02-12 23:42:13 +01:00
Fabio B. Silva
a3b4104612 Merge pull request #950 from goetas/patch-1
[SLC] Cache empty collections
2014-02-12 04:26:27 -05:00
Asmir Mustafic
94896ce552 Typo fix on many-to-many assocaition cascade test 2014-02-12 08:18:34 +01:00
Asmir Mustafic
8cdbcf1263 Merge remote-tracking branch 'origin/master' into patch-1 2014-02-12 05:15:00 -02:00
Per Persson
3543ccea7f Pass class name to constructor. 2014-02-11 23:48:31 +01:00
Per Persson
7ef1063007 Pass class name to constructor. 2014-02-11 23:44:24 +01:00
Per Persson
4b061a0e4c Add class name as argument. 2014-02-11 23:40:38 +01:00
Marco Pivetta
9b0d7dde91 Merge pull request #952 from simshaun/patch-1
Add DB-level onDelete CASCADE example
2014-02-11 23:24:38 +01:00
Shaun
57ac3bd4be Add DB-level onDelete CASCADE example
This adds `onDelete: CASCADE` to the `address` 1-1 relationship just to show how you would map a db-level cascade.
2014-02-11 17:23:19 -05:00
Asmir Mustafic
4a6d6e34f8 Test empty collections second level cache 2014-02-11 17:39:16 +01:00
Asmir Mustafic
a5fbb20fbb Can cache many to many empty relations 2014-02-11 15:08:49 +01:00
Asmir Mustafic
1c94c16234 Can cache empty collections
I should be able to cache an "empty" collection.

I have a some objects, where 90% of these have on-to-many relations with zero associated elements.
This causes doctrine to run a query each time, instead of cache it as empty relation.
2014-02-11 14:59:31 +01:00
Marco Pivetta
e8f51acdb2 Merge pull request #947 from BenMorel/unused-imports
Cleaned up further unused imports.
2014-02-10 05:48:56 +01:00
Strate
324f200f1b Merge branch 'master' into bugfix/join-with-condition-placement-fix 2014-02-10 08:22:11 +04:00
Benjamin Morel
08f6291350 Cleaned up further unused imports. 2014-02-09 23:45:22 +00:00
Marco Pivetta
c4b1d4fa28 Merge pull request #946 from BenMorel/unused-imports
Cleaned up unused imports
2014-02-09 23:33:26 +01:00
Benjamin Morel
412e4ab9da Cleaned up unused imports 2014-02-09 22:12:51 +00:00
Steve Müller
6cd0861fa3 Merge pull request #945 from raziel057/patch-1
Fix CS
2014-02-09 16:54:22 +01:00
Thomas Lallement
2a77a739dc Fix CS 2014-02-09 16:37:32 +01:00
Benjamin Eberlei
4c4e4f6d3d Merge pull request #939 from doctrine/DDC-1985
[DDC-2939] Order Preservation
2014-02-09 15:43:57 +01:00
Benjamin Eberlei
288953aa6d Merge pull request #944 from WouterJ/patch-1
Fixed InputOption modes
2014-02-09 15:43:14 +01:00
Wouter J
d7b917aa49 Fixed InputOption modes 2014-02-09 15:10:00 +01:00
Benjamin Eberlei
53a5a48aed [DDC-2624] Fix bug when persistent collection is cloned and used in a new entity. 2014-02-09 14:27:42 +01:00
Benjamin Eberlei
3c2b626102 Merge pull request #943 from jankramer/handle-embeddables-in-embeddables
Validate embeddables do not contain other embeddables.
2014-02-09 11:06:43 +01:00
Jan Kramer
43e37d4f2f Throw exception on embeddables in embeddables. 2014-02-09 10:09:28 +01:00
Marco Pivetta
496fa85641 Merge pull request #940 from WouterJ/patch-1
Fixed typo & horizontal scrolling
2014-02-08 20:22:39 +01:00
Wouter J
24feae84cd Fixed typo & horizontal scrolling 2014-02-08 20:19:54 +01:00
Benjamin Eberlei
d31f7ebf57 [DDC-1985] Fix ordering preservation in SQL limit subquery output walker. 2014-02-08 17:01:55 +01:00
Benjamin Eberlei
1a08b52ab4 Cleanup test output. 2014-02-08 17:00:21 +01:00
Benjamin Eberlei
35511db4da Merge pull request #898 from USvER/patch-1
Added note to STI
2014-02-08 16:34:30 +01:00
Benjamin Eberlei
50ba19d91b Merge pull request #937 from goetas/contains-key
Extra-lazy for containsKey on collections
2014-02-08 16:28:44 +01:00
Benjamin Eberlei
8a0901c92b Merge pull request #835 from schmittjoh/ValueObjects
Value objects (Based on #634)
2014-02-08 16:24:47 +01:00
Benjamin Eberlei
8e3f4561c0 Merge pull request #858 from schmittjoh/rsmBuilder
lifts an unnecessary restriction on ResultSetMappingBuilder
2014-02-08 16:23:18 +01:00
Benjamin Eberlei
058e024f0e Merge pull request #902 from gwagner/master
Fix Lifecycle Callbacks
2014-02-08 16:01:13 +01:00
Benjamin Eberlei
31a2870c3f Merge pull request #912 from BenMorel/collection-count
Avoid PersistentCollection::isEmpty() to fully load the collection.
2014-02-08 16:00:10 +01:00
Benjamin Eberlei
960fbfc110 Merge pull request #908 from FabioBatSilva/DDC-2862
[DDC-2862][SLC] Fix lazy association load
2014-02-08 15:55:20 +01:00
Benjamin Eberlei
b76e95cbb9 Merge pull request #917 from doctrine/hotfix/DDC-2931
DDC-2931 - one-to-one self-referencing association broken by DCOM-96
2014-02-08 15:46:07 +01:00
Benjamin Eberlei
5fc7e653fe Update UPGRADE.md notes with BC mention. 2014-02-08 15:42:24 +01:00
Benjamin Eberlei
105d9e998b Merge pull request #927 from timdev/timdev-fixes
s/EntityManager/EntityManagerInterface/ in a few places
2014-02-08 15:30:15 +01:00
Benjamin Eberlei
f07c576e5f Merge pull request #932 from deeky666/DDC-2919
[DDC-2919] Make lock mode usage consistent
2014-02-08 15:27:35 +01:00
Benjamin Morel
496f9a0176 Avoid PersistentCollection::isEmpty() to fully load the collection on extra lazy fetch. 2014-02-08 13:49:48 +00:00
Benjamin Eberlei
0c2c5006f8 Merge pull request #934 from shustrik/master
faild test with multiple HINT_CUSTOM_TREE_WALKERS
2014-02-08 14:34:35 +01:00
Asmir Mustafic
5475d616e3 more tests 2014-02-07 14:30:17 +01:00
shustrik
b167a64544 remove doc 2014-02-06 20:08:07 +03:00
Strate
ffe5bf1fe3 Merge pull request #2 from shustrik/multiplie_tree_walker
Multiplie tree walker bugfix
2014-02-06 20:04:24 +03:00
shustrik
12985b7811 add iterator to tree walker chain 2014-02-06 19:39:40 +03:00
Marco Pivetta
7ceb9b0b50 Merge pull request #938 from HermanPeeren/master
Missing join-tables added in example
2014-02-06 16:31:17 +01:00
HermanPeeren
128e83909b Update working-with-associations.rst
removed some spaces that had come into it while editing last commit
2014-02-06 16:09:27 +01:00
HermanPeeren
9c19d1e5c4 Update working-with-associations.rst
There are 2 many-to-many associations between the users and comments. Both use another join-table. The join-tables user_favorite_comments and user_read_comments must be specified. Otherwise the default "user_comment" is taken twice. See https://groups.google.com/forum/#!topic/doctrine-user/Kti36_n6490 and https://groups.google.com/forum/#!topic/doctrine-user/TYwafhgYiSU
2014-02-06 15:59:56 +01:00
Asmir Mustafic
1d40c85c3c Right owning side column selection 2014-02-06 14:26:06 +01:00
shustrik
6fe40b055f fix return walker 2014-02-06 16:18:35 +03:00
shustrik
a6b43b93ac fix TreeWalkerChain.
Create walker object in foreach.
2014-02-06 16:06:00 +03:00
Asmir Mustafic
2eb428df79 code style 2014-02-06 12:55:33 +01:00
Asmir Mustafic
724e69146c typos and removed confusing ternary 2014-02-06 12:44:13 +01:00
Asmir Mustafic
557686aa0a Entra-lazy for containsKey on collections 2014-02-06 12:27:12 +01:00
Ilya Pleshakov
1f3290faae Remove incorrect (outdated) validation for public fields in SchemaValidator 2014-02-06 13:02:41 +04:00
shustrik
543ab500da rename test 2014-02-06 10:53:34 +03:00
shustrik
7107a85041 faild test with multiple HINT_CUSTOM_TREE_WALKERS
failed test when we have more than 1 walker HINT_CUSTOM_TREE_WALKERS ,
because walkSelectStatement in TreeWalkerChain saves the last hint _queryComponents result.
2014-02-06 01:27:17 +03:00
Steve Müller
a6c8ab8a5f make lock mode usage consistent 2014-02-05 15:13:53 +01:00
Strate
5c44dd3823 Allow to use object as a hint value. 2014-02-04 15:51:53 +01:00
Strate
352f38a77e Fix comment 2014-02-04 15:51:53 +01:00
Strate
e8d47fa9a3 Added a new configuration option: defaultQueryHints, which allows to populate all queries by default set of hints. 2014-02-04 15:51:53 +01:00
Benjamin Eberlei
626efdafd4 Delete old phing build leftover. 2014-02-04 08:49:08 +01:00
Benjamin Eberlei
9653213914 Add warning about non scalar use in Criteria. 2014-02-04 00:02:09 +01:00
Tim Lieberman
25d71462e3 Make SchemaTool and SchemaValidator use EntityManagerInterface instead of EntityManager 2014-02-01 05:11:20 +00:00
Marco Pivetta
e322ab4deb DDC-2931 - Removing previous broken fix for DDC-2931 - hardened 2014-02-01 02:00:10 +01:00
Marco Pivetta
7a32eca039 DDC-2931 - Safe comparison between proxies and entities when refreshing objects 2014-02-01 01:57:51 +01:00
Tim Lieberman
bf9fbd896b Substitute EntityManagerInterface for EntityManager in Console EntityManagerHelper 2014-02-01 00:23:23 +00:00
Marco Pivetta
8c92e0f19f DDC-2931 - adding test that verifies that fetch-joined entities get refreshed with hints 2014-02-01 01:05:34 +01:00
Tim Lieberman
43d94e7b5e Console EntityManagerHelper now accepts EntityManagerInterface as constructor argument, instead of insisting on an EntityManager 2014-01-31 15:32:31 -08:00
Benjamin Eberlei
310afdf5d7 Merge pull request #910 from deeky666/DDC-2310
[DDC-2310] [DDC-2675] Fix SQL generation on table lock hint capable platforms
2014-01-31 11:33:30 -08:00
Fabio B. Silva
7e5a1c6b0d Fix lazy association load 2014-01-28 12:26:10 -05:00
Fabio B. Silva
9b7e949025 Merge pull request #915 from mnapoli/patch-1
Improved DQL's "new" operator documentation
2014-01-25 08:36:54 -08:00
Marco Pivetta
b815a4b2d3 DDC-2931 - removing old comments 2014-01-24 02:52:30 +01:00
Marco Pivetta
596d2070ed DDC-2931 - Removing refresh hints when fetching association data in hydrators 2014-01-24 02:45:28 +01:00
Marco Pivetta
9eafb11a02 DDC-2931 - Detailed explanation 2014-01-24 02:43:14 +01:00
Marco Pivetta
22bcfef523 DDC-2931 - cleaning up code formatting/simplifying test case 2014-01-23 20:19:36 +01:00
root
fabef48ca2 [DDC-2931] testcase to reproduce Jira 2931 2014-01-23 17:31:08 +00:00
Matthieu Napoli
30c3eb0465 Improved DQL's "new" operator documentation 2014-01-21 17:34:54 +01:00
Matthieu Napoli
330c66559c Improved DQL's "new" operator documentation
I had to dig through the pull requests and issues to figure that out, so I believe it's best documented explicitly.
2014-01-21 10:54:13 +01:00
Strate
04e6061584 Added an exception when invalid case.
Fixes after code review.
2014-01-20 20:06:53 +04:00
Benjamin Eberlei
bba5ec27fb Remove badges 2014-01-20 09:36:15 +01:00
Marco Pivetta
a83f5df47c Merge pull request #913 from WouterJ/patch-1
Added exception class names
2014-01-19 22:02:34 -08:00
Marco Pivetta
0e5146b06b Merge pull request #914 from liuggio/patch-2
added license badge
2014-01-19 21:36:50 -08:00
Strate
41ec5fd56d Fix applying ON/WITH conditions to first join in Class Table Inheritance
Now we build nested joins for CTI when using ON/WITH clause.
2014-01-19 20:56:24 +04:00
Strate
b69481b639 Merge branch 'master' into bugfix/join-with-condition-placement-fix 2014-01-19 15:06:01 +04:00
Giulio De Donato
65f002d62c added license badge 2014-01-18 23:44:44 +01:00
Wouter J
996499e6fc Added exception class names 2014-01-18 11:09:22 +01:00
Steve Müller
b9ff877f14 fix SQL generation on table lock hint capable platforms 2014-01-15 22:46:09 +01:00
Steve Müller
cf43edd6a1 Merge pull request #911 from goatherd/fix-foreach-as-style
fix foreach coding style
2014-01-14 14:50:33 -08:00
goatherd
a485e791bb fix foreach coding style 2014-01-14 23:44:38 +01:00
Benjamin Eberlei
b0736b5b6c Merge pull request #909 from deeky666/fix-sqlserver-database-driver-test
Fix DatabaseDriverTest on SQL Server
2014-01-13 09:52:17 -08:00
Steve Müller
3eced21a01 add missing use statement for SQL Server testsuite to work 2014-01-13 15:57:18 +01:00
Geoffrey Wagner
b863b9b957 Fix some code standard things 2014-01-12 17:14:32 -06:00
Marco Pivetta
771da768ac Merge pull request #906 from KevinBrogan/master
removed erroneous tip
2014-01-12 08:10:20 -08:00
Benjamin Eberlei
12556e2dfe Add MyISAM limitation 2014-01-12 11:33:37 +01:00
Kevin Brogan
5989c0cb54 removed erroneous tip
I'm working through the tutorial myself and got to this point.

Don’t forget to add a require_once call for this class to the bootstrap.php

This advice is wrong. The class is located in the src directory and so is autoloaded when required. No require statement is necessary.
2014-01-10 20:28:41 -08:00
Geoffrey Wagner
e9739f8591 Fix some code standard things 2014-01-09 10:48:38 -06:00
Geoffrey Wagner
4772cbfae6 Add a test
addLifecycleCallback now only allows a callback once so we do not hook them twice
2014-01-08 20:58:50 -06:00
Geoffrey Wagner
db31c58102 Fix Lifecycle Callbacks
Remove a bit of code that breaks lifecycle callbacks of parent MappedSuperclasses
2014-01-08 17:17:47 -06:00
Benjamin Eberlei
93c1106735 Merge pull request #901 from deeky666/disable-travis-hhvm-unsupported-drivers
Exclude HHVM + PostgreSQL and HHVM + Mysqli from travis build matrix
2014-01-08 11:22:29 -08:00
Steve Müller
f4c30dcd1c exclude unsupported HHVM + PostgreSQL and HHVM + Mysqli from travis build matrix for now 2014-01-08 20:19:10 +01:00
Guilherme Blanco
4e824ac6e1 Merge pull request #900 from deeky666/fix-connection-mock
Fix connection mock fetchColumn signature
2014-01-06 12:27:50 -08:00
Steve Müller
5f93c83059 fix connection mock fetchColumn signature 2014-01-06 21:24:01 +01:00
USvER
b23d0bec33 Added note to STI
http://www.doctrine-project.org/jira/browse/DDC-2886
2014-01-06 00:44:51 +02:00
Guilherme Blanco
b65d9e6c83 Merge pull request #896 from holtkamp/patch-2
Ensure <cascade/> elements preceed <join-columns/>
2014-01-05 11:32:31 -08:00
Guilherme Blanco
7f30c31e98 Merge pull request #897 from holtkamp/patch-3
Respected 'inheritanceType' at Entity level
2014-01-05 11:31:25 -08:00
Menno Holtkamp
fc2b9980ae Exclude exporting inheritanceType for INHERITANCE_TYPE_NONE 2014-01-05 18:53:31 +01:00
Menno Holtkamp
797fb9c34a Respected 'inheritanceType' at Entity level
It was (incorrectly) fetched from Table-level.
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/annotations-reference.html#annref-inheritancetype
2014-01-05 18:41:55 +01:00
Menno Holtkamp
85a16f9f28 Ensure <cascade/> elements preceed <join-columns/>
When converting annotations based metadata to XML, the position of the <cascade/> elements resulted in XSD validation errors caused by the definitions of the association ComplexTypes:
- https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd#L463
- https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd#L482
- https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd#L495
- https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd#L517

Since changing the XSD might result in validation problems in existing mappings, changing the XmlExporter seems a better approach.

Note that the '<cache/>' element is not yet generated by the XmlExporter, but according to the XML Schema, it should precede the '<cascade/>' element.
2014-01-05 15:34:59 +01:00
Johannes Schmitt
7020f4135f skips DQL UPDATE/DELETE tests with SLC enabled 2014-01-04 18:32:06 +01:00
Johannes Schmitt
87b4155665 adds test for ResultSetMappingBuilder restriction 2014-01-04 18:06:16 +01:00
Johannes Schmitt
e879626d73 Merge branch 'master' of github.com:doctrine/doctrine2 into rsmBuilder 2014-01-04 17:57:39 +01:00
Johannes Schmitt
946419459c fixes bad merge 2014-01-04 17:54:46 +01:00
Johannes Schmitt
4f585a3d63 Merge branch 'master' of github.com:doctrine/doctrine2 into ValueObjects
Conflicts:
	UPGRADE.md
	lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
2014-01-04 17:52:32 +01:00
Benjamin Eberlei
69cad4079d Merge pull request #820 from apancutt/master
Added support for field options to FieldBuilder
2014-01-03 14:03:25 -08:00
Benjamin Eberlei
8de37de4f7 Merge branch 'DDC-2792' 2014-01-03 23:01:12 +01:00
Benjamin Eberlei
2a9351b8dc [DDC-2792] Fix fatals 2014-01-03 23:01:05 +01:00
Vyacheslav Ganzin
1edf6b65b1 joinColumn is not required in manyToMany
annotation behavior copied
2014-01-03 22:27:27 +01:00
Benjamin Eberlei
c8c7cf0528 Fix tests after merge of QueryBuilder#addCriteria changes. 2014-01-03 21:28:06 +01:00
Steve Müller
5828e4c67c Merge pull request #894 from piotrantosik/patch-2
Fix typos - QueryBuilder
2014-01-03 09:23:48 -08:00
Piotr Antosik
eb45690e10 Fix typos - QueryBuilder 2014-01-03 17:28:42 +01:00
Adam Pancutt
352f5394e5 Removed FieldBuilder::unsigned() method as it is only supported by MySQL 2014-01-03 09:48:38 +00:00
Benjamin Eberlei
9a3cf77919 [DDC-2128] Fix PR according to comments. 2014-01-03 00:15:14 +01:00
catalin
93c018668d checking preg result. Should I raise an error
throw new ORMException("Error regular expression: " . $filter);
2014-01-03 00:15:14 +01:00
catalin
0d8f572661 added space after type cast (I could not find any rule in psr1/2 standard, but I modified in PhpStorm) 2014-01-03 00:15:14 +01:00
catalin
2326033e79 added preg_quote to $filter input 2014-01-03 00:15:13 +01:00
catalin
57e7559c1b - Applied Phpstorm PSR format
- Changed RegExp format
2014-01-03 00:15:13 +01:00
Catalinux
6963bf6028 Now MetaDataFilter takess also regexp. For example whern you want to
extract metadata if you would filter like this: --filter="Article"
would extract also for "ArticleItems" (article_items table). Now you
can use --filter="Article$" if you want only that table (articl)
2014-01-03 00:15:13 +01:00
Benjamin Eberlei
8118dddc6a Merge pull request #674 from TorbenBr/master
Shortcut for force
2014-01-02 15:02:46 -08:00
Benjamin Eberlei
0a2b5b8efd Merge pull request #734 from caponica/patch-1
Cleaned up documentation
2014-01-02 15:00:11 -08:00
Benjamin Eberlei
22d4d2e812 Merge branch 'DDC-2700' 2014-01-02 23:50:21 +01:00
Benjamin Eberlei
53ed898684 [DDC-2700] Add test and fix CS. 2014-01-02 23:50:15 +01:00
Benjamin Eberlei
2feffe164a Merge branch 'DDC-2732' 2014-01-02 23:33:56 +01:00
Benjamin Eberlei
b1e031a1b4 [DDC-2732] Add tests for XML id options fix. 2014-01-02 23:33:49 +01:00
Benjamin Eberlei
96ec3c1613 Merge pull request #830 from sandermarechal/sort-alias
[DDC-2764] Prefix criteria orderBy with rootAlias
2014-01-02 14:15:01 -08:00
Benjamin Eberlei
41581847b2 Merge pull request #833 from ronanguilloux/patch-console-entity-generator
Generate-Entities-Console-Command: Adding an 'avoid backup' flag
2014-01-02 14:13:27 -08:00
Benjamin Eberlei
e91ed74b25 [DDC-2775] cleanup test. 2014-01-02 23:11:35 +01:00
Benjamin Eberlei
17809abd29 Merge pull request #837 from mnapoli/DDC2775
DDC-2775 Tests and fix
2014-01-02 14:07:14 -08:00
Benjamin Eberlei
05576d3e1c Merge pull request #844 from terite/orm-validate-skip
Teach orm:validate-schema to --skip-mapping and --skip-sync
2014-01-02 14:00:22 -08:00
Benjamin Eberlei
ea84cfbdd1 Merge pull request #845 from flack/avoid-update-on-delete
Don't compute changeset for entities that are going to be deleted
2014-01-02 13:59:25 -08:00
Benjamin Eberlei
10576286b8 [DDC-2803] Fix error in documentation. 2014-01-02 22:54:46 +01:00
Benjamin Eberlei
7a4a46a95c [GH-855] fix CS 2014-01-02 22:50:36 +01:00
ptarjan
27c9074b71 don't rely on gc_collect_cycles for HHVM 2014-01-02 22:50:36 +01:00
Benjamin Eberlei
3a8aaea14a Merge pull request #794 from stefankleff/patch-1
Multiple invokation of listeners on PreFlush event
2014-01-02 13:16:21 -08:00
Benjamin Eberlei
a2cdc7a1c7 Merge pull request #893 from yktd26/master
autoGenerate arg from bool to int
2014-01-02 13:03:33 -08:00
yktd26
c9e06a6854 Format code 2013-12-31 12:25:14 +01:00
yktd26
bee74f898d autoGenerate arg from bool to int
For using all four modes of proxies generation, change the 4th arg of
ProxyFactory's constructor to integer
2013-12-31 11:58:36 +01:00
Guilherme Blanco
a7b9140d2f Merge pull request #890 from deeky666/DBAL-563
[DBAL-563] Add general IDENTITY generator type support for sequence emulating platforms
2013-12-30 21:34:20 -08:00
Benjamin Eberlei
58c57c50bf Merge pull request #891 from spolischook/patch-2
Allow to not generate extra use
2013-12-30 00:33:03 -08:00
Sergey Polischook
07f67c5d1a Allow to not generate extra use
For case when we not generate annotation (by default at doctrine orm:generate-entities) allow to not generate extra use for it - 
```php
use Doctrine\ORM\Mapping as ORM;
```
For example if generate entities for my project that use only dbal in pord but use orm for generate entities in dev mode.
2013-12-30 04:43:35 +02:00
Steve Müller
337857dc8a add general IDENTITY generator type support for sequence emulating platforms 2013-12-29 05:55:16 +01:00
Marco Pivetta
7360231b4b Merge pull request #888 from entering/docs-yaml-mapping-improve-example
Add an example to doc of YAML mapping
2013-12-25 14:12:38 -08:00
entering
2f0b4a5d81 Add an example to doc of YAML mapping 2013-12-25 22:11:15 +00:00
Matthieu Napoli
c9791fe97f Inlined the model for the DCC2775 test case inside the test class 2013-12-23 09:55:10 +01:00
Strate
c6810861ca Fix applying ON/WITH conditions to first join in Class Table Inheritance 2013-12-22 21:02:14 +04:00
Guilherme Blanco
5439a613d6 Merge pull request #884 from FabioBatSilva/slc-patch1
[SLC] Fix cache misses using one-to-one inverse side
2013-12-20 15:23:21 -08:00
fabios
cf4c805427 Fix cache misses using one-to-one inverse side 2013-12-20 15:37:07 -05:00
Guilherme Blanco
8554b04053 Merge pull request #883 from FabioBatSilva/hotfix-slc
[DDC-2862] Fix non initialized association proxy
2013-12-20 10:43:56 -08:00
fabios
22e3a76327 Fix non initialized association proxy 2013-12-20 10:39:03 -05:00
Benjamin Eberlei
f0546455d5 Remove left over ElementCollection code. 2013-12-20 15:01:10 +01:00
Guilherme Blanco
423ea00539 Merge pull request #590 from michaelperrin/feature/process-collection-value
DQL Query: process ArrayCollection values to ease development
2013-12-17 10:39:36 -08:00
Michaël Perrin
1032a16db2 Simpler way to handle Collection parameters in DQL queries (refs #DDC-2319) 2013-12-17 11:37:17 +01:00
Benjamin Eberlei
ad9366a1fc Merge pull request #871 from elmariachi111/patch-1
XCache cannot be flushed on the CLI -> for pretty much the same reason as APC
2013-12-16 15:47:09 -08:00
Benjamin Eberlei
48ea45fad0 Add note about experimental nature of SLC feature 2013-12-17 00:05:43 +01:00
Guilherme Blanco
b081e5681d Merge pull request #808 from FabioBatSilva/slc
Second level cache
2013-12-16 14:59:56 -08:00
fabios
4e0e1b8061 CS/Typo Fixes 2013-12-16 15:55:54 -05:00
fabios
0a66a2bc09 CS/Doc Fixes 2013-12-16 11:05:05 -05:00
fabios
71903c28a8 Region cache clear commands 2013-12-16 11:05:05 -05:00
fabios
fb98277783 Fix docs 2013-12-16 11:05:05 -05:00
fabios
d135e402bb handle update/delete queries 2013-12-16 11:05:05 -05:00
Fabio B. Silva
61bff7d5f6 Fix CS and update docs 2013-12-16 11:05:04 -05:00
Fabio B. Silva
1438a59c00 Fix persister query cache invalidation 2013-12-16 11:05:04 -05:00
fabios
1bfa8f0fc3 Extract cache config 2013-12-16 11:05:04 -05:00
Fabio B. Silva
3140593e9b Second level cache 2013-12-16 11:05:04 -05:00
Benjamin Eberlei
86ae6f18ab Merge branch 'DDC-2645' 2013-12-15 23:31:49 +01:00
Pouyan Savoli
a5b7069fd7 [DDC-2645] Apply patch to fix issue 2013-12-15 23:31:35 +01:00
Matthieu Napoli
602c3be3fc Cleaned up tests for DDC-2775 2013-12-14 19:57:53 +01:00
Aaron Muylaert
aa5df1dbac Create failing test for DDC-2645.
Merge not dealing correctly with composite primary keys.
2013-12-14 15:59:10 +01:00
Marco Pivetta
6f1642b35d Merge pull request #877 from aaronmu/DDC-1787
Hotfix for DDC-1787
2013-12-14 06:22:20 -08:00
Marco Pivetta
5fa1b10506 Merge pull request #832 from mnapoli/patch-4
Added "readOnly: true" to YAML reference
2013-12-14 05:41:27 -08:00
Marco Pivetta
bd4d27eabf Merge pull request #842 from TheFrozenFire/tests/query-tests
Added EntityManager query creation tests
2013-12-14 05:26:46 -08:00
Marco Pivetta
ce914bef3f Merge pull request #875 from doctrine/DDC-2844
Adding tests that confirm that DDC-2844 is fixed
2013-12-14 05:13:24 -08:00
Aaron Muylaert
3cc630798b Fix DDC-1787.
Credit goes to Jack van Galen for fixing this issue.
Fix for JoinedSubclassPersister, multiple inserts with versioning throws
an optimistic locking exception.
2013-12-14 13:50:46 +01:00
Marco Pivetta
d20b136270 Adding tests to verify that dql aliases in criteria are correctly converted 2013-12-14 13:42:18 +01:00
Marco Pivetta
72e6de9417 Adding tests that confirm that DDC-2844 is fixed 2013-12-14 13:42:18 +01:00
Aaron Muylaert
600af3e617 Add failing test for DDC-1787.
Using joined table inheritance, when persisting multiple new entities
that are subclasses of a baseclass that has the @Version attribute set,
only the last persisted entity will have it's version set.
2013-12-14 13:24:47 +01:00
Marco Pivetta
8a38534be4 Merge pull request #876 from doctrine/hotfix/hhvm-allow-failures
Fixing wrong key for allowing HHVM failures
2013-12-14 04:22:59 -08:00
Marco Pivetta
940c1f3b1c Fixing wrong key for allowing HHVM failures 2013-12-14 12:40:59 +01:00
Benjamin Eberlei
4ed96e2ab6 Update CONTRIBUTING.md 2013-12-14 11:29:07 +01:00
Benjamin Eberlei
d820c25eda Merge branch 'GH-873' 2013-12-13 22:13:37 +01:00
Benjamin Eberlei
40f9facfd1 Add allowed failures for HHVM. 2013-12-13 22:13:28 +01:00
Paul Tarjan
b6a0c8b1ad Try running unit tests on HHVM 2013-12-13 11:43:53 -08:00
Benjamin Eberlei
94a3e6c42b Add missing LICENSE of documentation 2013-12-12 00:30:15 +01:00
Marco Pivetta
b461c9cf23 Merge pull request #872 from matheo/patch-1
Doctrine 2.4 now supports SQLite ALTER TABLE
2013-12-10 21:08:22 -08:00
Mateo Tibaquirá Palacios
3669321161 Doctrine 2.4 now supports SQLite ALTER TABLE 2013-12-11 00:07:07 -05:00
Stefan A
eded05d415 XCache cannot be cleared on CLI (like APC) 2013-12-10 19:51:41 +01:00
Stefan A
88a56ee8f8 XCache cannot be cleared on CLI (like APC) 2013-12-10 19:51:02 +01:00
Stefan A
53fbb0b2d1 XCache cannot be cleared on CLI (like APC) 2013-12-10 19:48:30 +01:00
Marco Pivetta
2cccb3cc62 Merge pull request #870 from lcobucci/master
Documenting interface methods (based on entity manager)
2013-12-10 06:36:44 -08:00
Luís Otávio Cobucci Oblonczyk
6d58824ac5 Use docblox from EntityManagerInterface 2013-12-10 12:09:36 -02:00
Luís Otávio Cobucci Oblonczyk
67135e5d6f Fixing FQCN on docblox 2013-12-10 12:08:53 -02:00
Luís Otávio Cobucci Oblonczyk
877ba9bf17 Documenting interface methods (based on entity manager) 2013-12-10 11:18:27 -02:00
Johannes
f7f7c460f2 Merge pull request #1 from jankramer/ValueObjects
Update xml mapping driver and schema to work with embeddables
2013-12-07 08:44:09 -08:00
Jan Kramer
fbb7b5ad8e Fix XmlDriver to accept embeddables 2013-12-07 16:40:54 +01:00
Jan Kramer
928c32d616 Update XML schema to reflect addition of embeddables 2013-12-07 16:38:32 +01:00
Guilherme Blanco
90a0d29b2b Merge pull request #868 from mnapoli/patch-1
Added documentation section for Memcached
2013-12-02 07:00:40 -08:00
Matthieu Napoli
38c59ce5a4 Added documentation section for Memcached 2013-12-02 14:59:04 +01:00
Marco Pivetta
3caf1fdfa6 Merge pull request #866 from bountin/doc_refresh
Mentioning the 'refresh' cascading property in the documentation list
2013-12-01 14:07:21 -08:00
Martin Prebio
2828d7b5cd Mentioning the 'refresh' cascading property in the documentation list 2013-12-01 22:43:06 +01:00
Johannes M. Schmitt
e5cab1db2d adds embedded classes to cache 2013-11-28 17:32:47 +01:00
Marco Pivetta
606ae2e03d Merge pull request #862 from stof/patch-2
Added a note about changing the fetch mode for to-many relations
2013-11-26 05:22:39 -08:00
Christophe Coevoet
dfbf996a50 Added a note about changing the fetch mode for to-many relations 2013-11-26 14:20:51 +01:00
Guilherme Blanco
0e3c57dbd3 Merge pull request #849 from bsahlhof/master
Error with Same Field, Multiple Values, Criteria and QueryBuilder
2013-11-25 21:20:14 -08:00
Guilherme Blanco
d63820755d Merge pull request #860 from deeky666/add-sql-anywhere-documentation
Mention SQL Anywhere in basic mapping documentation
2013-11-25 09:44:04 -08:00
Steve Müller
45118a2811 mention SQL Anywhere in basic mapping docs 2013-11-25 18:24:54 +01:00
Guilherme Blanco
c460344994 Merge pull request #850 from FabioBatSilva/attach-entity-listeners
Event listener to programmatically attach entity listeners.
2013-11-25 08:21:36 -08:00
Johannes M. Schmitt
8ae48ad9db lifts an unnecessary restriction on ResultSetMappingBuilder 2013-11-23 19:47:56 +01:00
Steve Müller
75d7ac2783 Merge pull request #854 from ptarjan/master
fix relative path to doctrine/common
2013-11-23 05:14:44 -08:00
Marco Pivetta
642d6e3033 Merge pull request #856 from ptarjan/reference_proxy_test
Fix dependency for tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php
2013-11-22 05:34:41 -08:00
ptarjan
1fe8ff756e Fix dependency for tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php 2013-11-22 01:15:13 -08:00
ptarjan
a8ad9069c9 fix relative path to doctrine/common 2013-11-21 20:38:39 -08:00
fabios
9e3ad91225 Version 2.5.0-DEV 2013-11-19 11:50:43 -05:00
Guilherme Blanco
0fe6d75211 Merge pull request #851 from naitsirch/doc/instance_of
Documentation about how to use INSTANCE OF in inheritance
2013-11-19 08:12:29 -08:00
Brad Sahlhoff
96fb0d7e14 Changed logic to allow joining games, and becoming friends
Added Spacing
2013-11-19 11:09:23 -05:00
Christian Stoller
393b3d37f5 Documentation about how to use INSANCE OF in inheritance 2013-11-19 09:18:33 +01:00
fabios
e69cd37226 Event listener to programmatically attach entity listeners. 2013-11-18 15:03:00 -05:00
Brad Sahlhoff
c2997b3961 Add ability to test same parameter name for multiple values. 2013-11-18 10:36:46 -05:00
flack
3d12920cd4 Add note about changed behaviour 2013-11-17 12:06:47 +01:00
flack
88ae5883f3 Add testcase 2013-11-17 11:51:09 +01:00
flack
ffd858b238 Merge remote-tracking branch 'upstream/master' into avoid-update-on-delete 2013-11-17 11:36:06 +01:00
flack
9807718100 Also skip entities scheduled for deletion when committing multiple entities 2013-11-17 11:31:21 +01:00
Fabio B. Silva
3529cd4282 Merge pull request #797 from peterkokot/patch-1
CS fixes
2013-11-16 10:52:09 -08:00
Benjamin Eberlei
2925fea7bd Make tests forward compatible with DBAL 2.5 2013-11-14 12:36:52 +01:00
Johannes M. Schmitt
0ee7b688c3 small fix 2013-11-13 00:07:20 +01:00
Johannes M. Schmitt
2a73a6f1f7 some cs fixes 2013-11-13 00:05:55 +01:00
Johannes M. Schmitt
fb3a06b9e7 adds support for XML/Yaml drivers 2013-11-13 00:03:21 +01:00
Johannes M. Schmitt
9ad376c006 adds docs 2013-11-12 23:49:25 +01:00
Benjamin Eberlei
6cdd65762f Add 2.4 branch [ci skip] 2013-11-12 13:37:20 +01:00
David Stensland
e6be52af3a Teach orm:validate-schema to --skip-mapping and --skip-sync
Use --skip-mapping to not check if the current mapping informaiton
is valid or not.

Use --skip-sync to not check if the database schema is in line with
the current schema mapping.
2013-11-11 18:12:28 -05:00
flack
9016a5a854 don't compute changeset for entities that are going to be deleted 2013-11-12 00:11:50 +01:00
Benjamin Eberlei
0edf2bc585 Add missing link to batch processing chapter 2013-11-07 16:43:36 +01:00
Justin Martin
8b4b8e7268 Test EntityManager::createNamedQuery.
Test EntityManager::createNamedNativeQuery.
2013-11-06 20:07:48 -08:00
Marco Pivetta
141213915e Merge pull request #838 from flack/patch-2
Spelling fix
2013-11-04 10:21:49 -08:00
Marco Pivetta
271f952c4a Merge pull request #839 from flack/patch-3
Spelling fix
2013-11-04 10:20:12 -08:00
flack
8ad6853e84 Spelling fix 2013-11-04 19:17:04 +01:00
flack
dc476b62d1 Spelling fix 2013-11-04 19:16:04 +01:00
Guilherme Blanco
c7d4077219 Merge pull request #834 from carlosbuenosvinos/patch-1
Add example use of repositoryClass in YAML
2013-11-04 07:46:42 -08:00
Guilherme Blanco
f3b8fe5255 Merge pull request #836 from Dragonrun1/master
Update annotations-reference.rst
2013-11-04 07:05:16 -08:00
Matthieu Napoli
1899bcf000 Fixed tests failing in pgsql because of used of a reserved keyword 2013-11-04 16:01:05 +01:00
Matthieu Napoli
791ec3bc6e Fixed tests for pgsql: was using reserved keyword as table name 2013-11-04 12:53:18 +01:00
Matthieu Napoli
e018bb83f0 [DDC-2775] Bugfix 2013-11-04 12:42:23 +01:00
Matthieu Napoli
8bd54be4ec [DDC-2775] Tests reproducing DDC-2775 2013-11-04 12:40:51 +01:00
Michael Cummings
01dc0e8273 Update annotations-reference.rst
@JoinTable because of mapping defaults does NOT have required attributes. Updated annotations reference to show them as optional.
2013-11-03 09:20:15 -08:00
Johannes M. Schmitt
17e0a7b2f8 makes column prefix configurable 2013-11-02 14:07:14 +01:00
Johannes M. Schmitt
2b2f4894cb fixes declaring class 2013-11-02 13:55:19 +01:00
Johannes M. Schmitt
0cd6061fc2 fixes a bad merge 2013-11-02 13:35:41 +01:00
Johannes M. Schmitt
5586ddd6b7 removes restrictions on constructors of embedded objects 2013-11-02 13:31:44 +01:00
Johannes M. Schmitt
ece62d6ad7 adds support & tests for embeddables in inheritance schemes 2013-11-02 13:23:56 +01:00
Johannes M. Schmitt
d4e6618b28 Merge remote-tracking branch 'schmittjoh/ValueObjects' 2013-11-02 11:20:44 +01:00
Johannes M. Schmitt
97836ef8c6 some consistency fixes 2013-11-01 22:37:59 +01:00
Johannes M. Schmitt
f86abd81dd fixes annotation context 2013-11-01 22:33:59 +01:00
Johannes M. Schmitt
4f6c15099a fixes coding style 2013-11-01 21:47:56 +01:00
Johannes M. Schmitt
20fb8270dc make use of NamingStrategy for columns of embedded fields 2013-11-01 21:44:57 +01:00
Johannes M. Schmitt
fd8b5bd045 removes outdated todos 2013-11-01 21:16:02 +01:00
Johannes M. Schmitt
41c937b983 adds test for non-existent field 2013-11-01 20:54:45 +01:00
Johannes M. Schmitt
30897c3115 adds tests for update/delete DQL queries 2013-11-01 20:46:08 +01:00
Johannes M. Schmitt
c67ac8a11b adds support for selecting based on embedded fields 2013-11-01 20:38:19 +01:00
Johannes M. Schmitt
38b041d909 Merge remote-tracking branch 'origin/ValueObjects'
Conflicts:
	lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
2013-11-01 20:17:43 +01:00
Sander Marechal
35a62e9a05 Add rootAlias to Criteria where clauses 2013-11-01 13:43:03 +01:00
Sander Marechal
202039e853 Set rootAlias outside loop 2013-11-01 13:19:33 +01:00
Carlos Buenosvinos
6eac308ca3 Add example use of repositoryClass in YAML 2013-11-01 12:11:01 +01:00
Ronan Guilloux
48d078a856 no-backup instead of nobackup 2013-10-31 12:25:43 +01:00
Ronan Guilloux
5c01e8e99e Generate-Entities-Console-Command: Adding an 'avoid creating backup files' flag 2013-10-31 12:00:32 +01:00
Matthieu Napoli
f3f9fe9daa Added "readOnly: true" to YAML reference
The readOnly configuration is documented nowhere except in the annotations reference.

I added it to the example, for a lack of a better place. But at least it will be documented somewhere.

Can you also confirm that this is correct? I'm starting to use it, and I can't find a way to have doctrine validate it is really working. Even with the metadata validation tool, it won't raise an error if I put an invalid entry (`readOnlyFOOBAR: true`) or an invalid value (`readOnly: FOOBAR`), so I'm kind of blind here.
2013-10-31 10:50:44 +01:00
Sander Marechal
b6f8d53ff1 [DDC-2764] Prefix criteria orderBy with rootAlias 2013-10-29 11:11:46 +01:00
Benjamin Eberlei
514dd4e852 [DDC-2757] Update documentation with regard to manually closing the EntityManager when an Exception occurs. 2013-10-26 12:32:53 +02:00
Benjamin Eberlei
cedcac225f Merge branch 'DDC-2759' 2013-10-26 11:16:21 +02:00
Benjamin Eberlei
9a3298347c [DDC-2759] Fix regression in ArrayHydrator introduced in DDC-1884 at SHA c7b4c9bf0f 2013-10-26 11:16:07 +02:00
Chris Collins
7249804e3f Added a failing test case for DDC-2759. 2013-10-24 13:02:42 +01:00
Marco Pivetta
b7cb1e98ee Merge pull request #825 from flack/patch-1
Spelling fix
2013-10-23 02:32:45 -07:00
flack
195b1169ae Spelling fix 2013-10-23 11:32:04 +02:00
Marco Pivetta
0a31ecb283 Merge pull request #824 from brikou/patch-3
s/PostgreSQLPlatform/PostgreSqlPlatform/
2013-10-21 00:45:51 -07:00
Brikou CARRE
84b980227f s/PostgreSQLPlatform/PostgreSqlPlatform/ 2013-10-21 09:44:48 +02:00
Marco Pivetta
a96fe8770c Merge pull request #815 from nicolas-bastien/patch-2
Remove unused use statement
2013-10-18 03:46:09 -07:00
Marco Pivetta
d2e731174c Merge pull request #821 from mnapoli/patch-4
Fixed documentation rendering
2013-10-17 07:18:12 -07:00
Matthieu Napoli
a90311cb44 Fixed documentation rendering
The 2 lists I've fixed render as citation in the docs: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/index.html

If I didn't make any mistake, now they should render as simple lists.
2013-10-17 15:53:45 +02:00
Marco Pivetta
1e10fca66a Merge pull request #818 from mfdj/master
Clarified tutorial context in section introducing `orm:scehma-tool:*` commands
2013-10-16 17:23:09 -07:00
Adam Pancutt
553086ae3d Removed check for instantiated options array 2013-10-15 13:17:07 +01:00
Adam Pancutt
db5274113a Code style fix 2013-10-15 12:49:34 +01:00
Adam Pancutt
25342b706d Added support for field options to FieldBuilder 2013-10-15 12:37:06 +01:00
Guilherme Blanco
95ad926c95 Merge pull request #819 from vbourdeix/master
Fixes a Fatal Error when using a subexpression in parenthesis
2013-10-14 11:01:51 -07:00
Vincent BOURDEIX
5506d7adce Fixes a Fatal Error when using a subexpression in parenthesis
When some dql contains a subselect with expression in parenthesis, the
expression of the $simpleSelectExpression parameter given to
walkSimpleSelectExpression is an instance of AST\ParenthesisExpression.
Before this commit, this case defaulted to
$this->walkEntityIdentificationVariable($expr) where $expr is supposed
to be a string. A fatal error was then yielded.
2013-10-14 15:04:52 +02:00
Guilherme Blanco
0d58e82b76 Merge pull request #817 from mfdj/patch-1
Removed "minimum-stability" : "dev" from composer.json
2013-10-11 19:34:57 -07:00
Mark Fox
2f8b0801cc further tweaking of last commit pt.2 2013-10-11 15:22:39 -07:00
Mark Fox
126cd0bac2 further tweaking of last commit 2013-10-11 15:20:53 -07:00
Mark Fox
c5adfca0ed Clarified tutorial context around introduction of orm:schema-tool:* commands
See: http://stackoverflow.com/questions/17473225/doctrine2-no-metadata-classes-to-process for evidence of this confusion
2013-10-11 15:16:46 -07:00
Mark Fox
006dac13a9 Removed "minimum-stability" : "dev" from composer.json 2013-10-11 14:34:49 -07:00
Guilherme Blanco
bb63058410 Merge pull request #780 from terite/DDC-2655
[DDC-2655] Don't let getOneOrNullResult throw NoResultException
2013-10-11 13:43:27 -07:00
Guilherme Blanco
be81b46d8e Merge pull request #791 from myclabs/CriteriaContains
Implemented "contains" operator for Criteria expressions
2013-10-11 06:33:40 -07:00
Eduardo
333177da00 Options not respected for ID Fields in XML Mapping Driver (XSD update)
XSD update.

The same bug of the yaml driver: see http://www.doctrine-project.org/jira/browse/DDC-2661
2013-10-09 23:49:39 +02:00
Eduardo
aabb34f853 Options not respected for ID Fields in XML Mapping Driver
Same bug of the YAML driver, see: http://www.doctrine-project.org/jira/browse/DDC-2661
2013-10-09 22:40:29 +02:00
David Stensland
089006927e [DDC-2655] Don't let getOneOrNullResult throw NoResultException 2013-10-09 11:38:33 -04:00
Guilherme Blanco
ded3d20630 Merge pull request #787 from flip111/patch-1
Update DDC719Test.php to be compatible with MsSQL
2013-10-07 11:22:14 -07:00
Nicolas Bastien
33ddb9c0ca Remove unused use statement 2013-10-07 15:58:41 +02:00
Guilherme Blanco
3f883d57a6 Merge pull request #811 from flip111/patch-6
Update SingleScalarHydrator error message
2013-10-02 06:07:59 -07:00
flip111
62ae8dc81e Update SingleScalarHydrator error message
bummed into this one. Now more developer friendly :)
2013-10-02 14:12:35 +02:00
Benjamin Eberlei
fc53bc8909 Fix some LGPL occurances to MIT 2013-10-02 12:07:37 +02:00
Guilherme Blanco
2021d12df8 Merge pull request #809 from FabioBatSilva/DDC-1514
Fix DDC-1514 test
2013-10-01 22:02:22 -07:00
fabios
dd4bdd776a Fix DDC-1514 test 2013-10-01 12:00:52 -04:00
flip111
4282fa4787 Used ternary operator to reduce LOC 2013-10-01 17:25:49 +02:00
Guilherme Blanco
2c4c26c5d6 Merge pull request #801 from flip111/patch-4
Update SqlWalker.php fixed wrong GROUP BY clause on SQL Server platform
2013-10-01 08:21:20 -07:00
flip111
228a501014 Made the code prettier :) 2013-10-01 16:53:53 +02:00
Guilherme Blanco
4051d0da86 Merge pull request #807 from janbster/fix-optimisticlock
Fix for OptimisticLockingException
2013-10-01 07:41:57 -07:00
jan brunnert
f64d6695ce Removed unnecessary is_object() check 2013-10-01 13:00:37 +02:00
Guilherme Blanco
0e8e5c9ba5 Merge pull request #788 from flip111/patch-3
Update DatabaseDriverTest.php
2013-09-30 11:08:41 -07:00
Guilherme Blanco
d8335eee7b Merge pull request #793 from flip111/patch-2
Improved error messages in Paginator: LimitSubqueryOutputWalker
2013-09-30 11:07:49 -07:00
Guilherme Blanco
f02d18f465 Merge pull request #804 from diego-mazzaro/master
[bugfix] if BIGINT or SMALLINT version field was not incremented.
2013-09-30 07:46:35 -07:00
jan brunnert
a4e3921090 When the OptimisticLockingException is generated with the static function lockFailedVersionMismatch and the passed parameters are DateTime instances, the exception could not be thrown because the DateTime object is not implicitly converted to a string. 2013-09-30 11:32:46 +02:00
flip111
72ae7f5497 Changed GroupBy alias to real column name for all platforms and adjusted failing test accordingly. Has fallback in cases where real column name is not possible (example: Doctrine\Tests\ORM\Query\SelectSqlGenerationTest::testGroupBySupportsIdentificationVariable) 2013-09-30 11:08:42 +02:00
Diego Mazzaro
bd0e0c3fcf [bugfix] if BIGINT or SMALLINT version field was not incremented.
Made version field accepted type coherent between ClassMetadataInfo and BasicEntityPersister
2013-09-29 16:17:10 +02:00
Marco Pivetta
1414cc315e Merge pull request #803 from cleentfaar/patch-1
Appended newline to (newly) generated files for PSR2 compatibility
2013-09-28 10:46:09 -07:00
Cas
1fda797c8f Appended newline to (newly) generated files for PSR2 compatibility
Appended newline to (newly) generated files for PSR2 compatibility
Additionally, slightly improved styling of concatenating return value
2013-09-28 17:47:35 +02:00
Benjamin Eberlei
008187982d Merge pull request #792 from FabioBatSilva/DDC-2668
[DDC-2668] Fix trim leading zero string
2013-09-26 14:23:07 -07:00
Benjamin Eberlei
b7cffbde37 Merge pull request #802 from fasmide/patch-1
Respect unsigned fields when tables get converted to entities.
2013-09-26 14:12:24 -07:00
Kristian Mide
0326731348 Respect unsigned fields when tables get converted to entities.
This is working on our mysql setup, however i have no idea of the consequences of this change when using other RDBMSes.
2013-09-26 14:41:06 +02:00
flip111
76fda9562c Update SqlWalker.php fixed wrong GROUP BY clause on SQL Server platform
Without this patch a query would like like:
```
SELECT c0_.Country AS sclr0
FROM Continent c0_ WITH (NOLOCK)
WHERE c0_.Country = 38
GROUP BY sclr0
```
Using the column alias in the GROUP BY clause. However this is not allowed on SQL Server. References:
1. http://stackoverflow.com/a/3841804
2. http://technet.microsoft.com/en-us/library/ms189499.aspx (Logical Processing Order of the SELECT statement)

The correct query should be:
```
SELECT c0_.Country AS sclr0
FROM Continent c0_ WITH (NOLOCK)
WHERE c0_.Country = 38
GROUP BY c0_.Country
```
2013-09-26 14:11:56 +02:00
Guilherme Blanco
bd7c7ebaf3 Merge pull request #799 from FabioBatSilva/leftover-test
remove unused test case
2013-09-23 18:10:22 -07:00
Fabio B. Silva
614eed7f86 remove unused test case 2013-09-23 19:29:50 -04:00
Alex Pogodin
a75d73b889 Identifier can be empty for MappedSuperclasses
When MappedSuperclass is inspected without identifier column been assigned, always return false. Solves "Undefined offset" notice.
2013-09-22 17:19:51 +03:00
Peter Kokot
dca09148ca CS fixes 2013-09-22 02:12:30 +02:00
Marco Pivetta
2089df36e3 Merge pull request #795 from sabzeta/patch-1
Update query-builder.rst
2013-09-20 11:05:38 -07:00
sabzeta
a419c7c93b Update query-builder.rst
expresion substr changed to substring as of
http://www.doctrine-project.org/jira/browse/DDC-382
2013-09-20 15:27:05 +03:00
Stefan Kleff
adf2b7cce7 Listener class prefix 2013-09-20 09:20:58 +02:00
Stefan Kleff
619c6a03ce removed unused use statements, fixed typo and group tag 2013-09-19 15:16:51 +02:00
Stefan Kleff
d4a08f7ab7 Added unit test 2013-09-19 14:16:33 +02:00
Stefan Kleff
1ec5632a18 Multiple invokation of listeners on PreFlush event
Only lifecycle callbacks and entity listeners should be triggered here. The preFlush listener event is already triggered at the beginning of commit()
2013-09-19 12:13:12 +02:00
flip111
a18aba1bb6 Improved error messages in Paginator: LimitSubqueryOutputWalker
The already existing follow-up check throwing "Not all identifier properties can be found in the ResultSetMapping: %s" is a much more technical description.

If $sqlIdentifier is empty (count 0) it can be concluded that there are no mapped results. An alternative error message could thus be "The Paginator does not support queries without mapped results." (line 153).

Possibly '!=' on line 154 could be replaced by '>' because i think this is the only situation that can occur. But since i don't know this for sure, i left it like i found it.

Didn't use elseif in this commit as per Stof his suggestion.
2013-09-17 21:01:09 +02:00
flip111
b803f06c8f Improved error messages in Paginator: LimitSubqueryOutputWalker
The already existing follow-up check throwing "Not all identifier properties can be found in the ResultSetMapping: %s" is a much more technical description.

If $sqlIdentifier is empty (count 0) it can be concluded that there are no mapped results. An alternative error message could thus be "The Paginator does not support queries without mapped results." (line 153).

Possibly '!=' on line 154 could be replaced by '>' because i think this is the only situation that can occur. But since i don't know this for sure, i left it like i found it.
2013-09-17 15:07:08 +02:00
Fabio B. Silva
689da2f36b [DDC-2668] Fix trim leading zero string 2013-09-16 21:36:19 -04:00
Matthieu Napoli
6f538c509c Implemented "contains" operator for Criteria expressions 2013-09-16 14:56:04 +02:00
Benjamin Eberlei
fe78977973 Merge pull request #790 from javer/hhvm-func_get_args
HHVM compatibility: func_get_args
2013-09-15 11:05:01 -07:00
javer
64a0161935 HHVM compatibility: func_get_args
All func_get_args() calls have been moved to the top of the methods
because HHVM doesn't keep a copy of the original args for performance
reasons.

See facebook/hiphop-php#1027 for details.
2013-09-15 20:57:30 +03:00
flip111
67dd32d9fb A nicer way of detecting the platform
Inspired by https://github.com/doctrine/doctrine2/blob/master/tests/Doctrine/Tests/ORM/Functional/DatabaseDriverTest.php#L188
2013-09-13 16:35:34 +02:00
flip111
e49a673a01 Update DatabaseDriverTest.php
SQL Server does not support unsigned integers
2013-09-13 16:29:31 +02:00
flip111
a190dad0b1 Update DDC719Test.php to be compatible with MsSQL
Apparently Doctrine adds "with (nolock)" now for the mssql platform, but the test has not been updated yet.
2013-09-13 15:11:35 +02:00
Marco Pivetta
c72698a997 Merge pull request #786 from weaverryan/patch-1
Minor updates while reading the basic-mapping page
2013-09-12 19:11:37 -07:00
Ryan Weaver
1fcef3321e Changes thanks to @Ocramius 2013-09-12 20:52:12 -05:00
Ryan Weaver
36d7d60c3b Minor updates while reading the basic-mapping page
The only arguable changes involve a few spots where I either removed something I thought was too technical and not valuable (e.g. talking about the metadata mapping pattern).
2013-09-12 17:08:48 -05:00
Benjamin Eberlei
067ed7b1c6 Fix master dependening on DBAL 2.5-dev 2013-09-12 08:00:08 +02:00
Benjamin Eberlei
b6e624b6bf Delete some very old, leftover code. 2013-09-11 22:43:38 +02:00
Marco Pivetta
237c1e24e6 Merge pull request #785 from Hawkeye0203/patch-1
Update dql-custom-walkers.rst
2013-09-11 07:32:58 -07:00
Daniel VanMullen
ef722066e3 Update dql-custom-walkers.rst
Fixed typo of "customer" to "custom"
2013-09-11 09:25:52 -04:00
Marco Pivetta
bb7f18ced7 Merge pull request #784 from eventhorizonpl/fix_docs
fix documentation warnings p1
2013-09-10 15:54:40 -07:00
Michal Piotrowski
bc37ceb58b fix warnings p1
fix warnings p2

fix warnings p3

fix warnings p4
2013-09-10 23:57:41 +02:00
Benjamin Eberlei
9983fcbac3 Fix some more details in basic-mapping.rst 2013-09-10 23:15:43 +02:00
Benjamin Eberlei
a948cb49b8 Small fixes in basic-mapping.rst 2013-09-10 22:36:03 +02:00
Benjamin Eberlei
546c817f64 Move Custom Mapping Types into cookbook, restructure the chapter more. 2013-09-10 22:09:22 +02:00
Benjamin Eberlei
caf6ba65e8 Refactor Basic Mapping chapter to focus on the actual topic more. Rearrange apperance of topics. Introduce a sane example entity as example. 2013-09-10 22:09:22 +02:00
Benjamin Eberlei
f7108b40c3 Move Annotations introduction to the reference. 2013-09-10 22:09:22 +02:00
Marco Pivetta
4d51a0290b Merge pull request #782 from mnapoli/patch-4
#DDC-2664 Document new Proxy factory flags usage as of DCOM-210
2013-09-09 03:35:17 -07:00
Marco Pivetta
0d246f7e9e Merge pull request #783 from mnapoli/DDC-2664
#DDC-2664 Improving and fixing documentation for new Proxy factory flags usage as of DCOM-210
2013-09-09 03:13:56 -07:00
Matthieu Napoli
8875462241 #DDC-2664 Improving and fixing documentation for new Proxy factory flags usage as of DCOM-210 2013-09-09 11:30:18 +02:00
Matthieu Napoli
26e1ac6afd #DDC-2664 Improving and fixing documentation for new Proxy factory flags usage as of DCOM-210 2013-09-09 11:20:12 +02:00
Matthieu Napoli
4a0a4094da #DDC-2664 Document new Proxy factory flags usage as of DCOM-210
[Document new Proxy factory flags usage as of DCOM-210](http://www.doctrine-project.org/jira/browse/DDC-2664)
2013-09-09 10:49:37 +02:00
Marco Pivetta
87d2ff8665 Merge pull request #781 from shieldo/patch-2
fixed English grammar
2013-09-08 13:47:39 -07:00
Douglas Greenshields
85f227372d fixed English grammar 2013-09-08 21:40:35 +01:00
Benjamin Eberlei
4a50493ab7 [DDC-2608][DDC-2662] Fix SequenceGenerator requiring "sequenceName" and now throw exception. Fix a bug in quoting the sequenceName. 2013-09-08 15:59:58 +02:00
Benjamin Eberlei
c6760e0375 Merge pull request #762 from naitsirch/yaml_reference_ext
YAML mapping documentation of uniqueConstraint
2013-09-08 06:22:42 -07:00
Benjamin Eberlei
3770019e0b Merge branch 'DDC-2660' 2013-09-08 14:39:10 +02:00
Benjamin Eberlei
5c2157219d [DDC-2660] Fix error with NativeSQL, ResultSetMappingBuilder and Associations as Primary Key. 2013-09-08 14:38:59 +02:00
Benjamin Eberlei
f2fa47dedb Fix RST bug 2013-09-08 13:04:08 +02:00
Benjamin Eberlei
275724fb46 Add missing documentation for 2.4 features 2013-09-08 12:13:47 +02:00
Benjamin Eberlei
6fcc091f88 Merge branch 'DDC-2661' 2013-09-08 10:37:23 +02:00
Benjamin Eberlei
3719a6f2f2 [DDC-2661] Fix bug in YamlDriver not passing options from id to mapField() 2013-09-08 10:37:13 +02:00
Benjamin Eberlei
fab3f5e146 More excludes 2013-09-07 18:27:27 +02:00
Benjamin Eberlei
90c89b3881 Travis should prefer dist. 2013-09-07 13:21:02 +02:00
Benjamin Eberlei
6139a61ff0 New Build process
- Switch from Phing to Ant
- Remove PEAR packaging
- Add Composer archiving
2013-09-07 12:56:49 +02:00
Benjamin Eberlei
490b501679 Fix tests running against Oracle not comparing SQL case-insenstive 2013-09-07 08:52:50 +02:00
Guilherme Blanco
da7146c4d5 Merge pull request #779 from Blazinn/patch-4
Fixed grammar in custom data types
2013-09-05 07:31:19 -07:00
Guilherme Blanco
7ed22819b5 Merge pull request #778 from Blazinn/patch-3
Fixed typo in property mapping
2013-09-05 07:29:43 -07:00
Nick Hazen
e808865e6f Fixed grammar in custom data types
Changed 'are apply' to 'are applied'
2013-09-05 10:09:53 -04:00
Nick Hazen
1d247fbeaa Fixed typo in property mapping
Changed 'pecify' to 'specify' line # 246
2013-09-05 09:48:00 -04:00
Guilherme Blanco
0a07207f59 Merge pull request #777 from Blazinn/patch-2
Fixed typo in mapping documentation
2013-09-05 06:43:28 -07:00
Nick Hazen
982840ac3c Fixed typo in mapping documentation
"Classthat" to "Class that" line #69
2013-09-05 09:32:36 -04:00
Marco Pivetta
0a9ff77303 Merge pull request #775 from Blazinn/patch-1
Update create bug script
2013-09-04 15:18:36 -07:00
Nick Hazen
528fe40839 Update create bug script
This script is using the first argument twice and ignoring the second argument completely.
2013-09-04 16:55:06 -04:00
Benjamin Eberlei
340ae15ba7 Merge branch 'Docs' 2013-09-01 19:04:22 +02:00
Benjamin Eberlei
c603fe7ab9 Simplify Working with Associations a little 2013-08-31 16:38:00 +02:00
Benjamin Eberlei
aa369b4212 Cleanup Association Mapping chapter 2013-08-31 16:25:53 +02:00
Benjamin Eberlei
cf2580d284 Cleanup of Configuration and Mapping reference chapters. 2013-08-31 15:46:10 +02:00
Guilherme Blanco
6f025f78ec Merge pull request #772 from pine3ree/patch-1
DO NOT OVERRIDE CUSTOM TREE WALKERS IN getIterator()
2013-08-29 07:27:35 -07:00
Maks Feltrin
f98dfc4758 DO NOT OVERRIDE CUSTOM TREE WALKERS IN getIterator() 2013-08-29 08:36:39 +02:00
Guilherme Blanco
fc7719d5fa Merge pull request #771 from caponica/cqb-indexby
Added indexBy option to createQueryBuilder
2013-08-28 20:15:55 -07:00
Christian Morgan
b0513a7517 Added indexBy option to createQueryBuilder
Added way to access the underlying QueryBuilder#from() method's 'indexBy' parameter when using EntityRepository#createQueryBuilder()
2013-08-28 22:35:29 +01:00
Guilherme Blanco
78c3016f95 Merge pull request #770 from fulopattila122/master
Fix for entity generator discriminator column
2013-08-28 09:15:08 -07:00
Attila Fulop
5669aaf4a3 Fix for entity generator discriminator column 2013-08-28 18:26:16 +03:00
Marco Pivetta
f634ba343c Merge pull request #759 from mfdj/patch-1
Fixed out of sync code examples in getting-started.rst
2013-08-25 07:23:20 -07:00
Marco Pivetta
e2a67c2f1c Merge pull request #742 from caponica/patch-2
Cleaned up events.rst
2013-08-25 07:10:26 -07:00
Guilherme Blanco
c399c77dbe Merge pull request #767 from doctrine/DDC-2627
Fixing missing table aliases when using Many2Many persister.
2013-08-21 20:56:18 -07:00
Guilherme Blanco
09d51f9df5 Fixing missing table aliases when using Many2Many persister. 2013-08-21 23:39:40 -04:00
Guilherme Blanco
44f9952063 Merge pull request #763 from Padam87/entgenparenttrait
Entity generator - trait in parent class
2013-08-20 05:38:02 -07:00
Adam Prager
b041c22814 Entity generator - trait in parent class 2013-08-20 12:15:17 +02:00
Christian Stoller
a765f2e3b6 added yaml mapping documentation of uniqueConstraint 2013-08-20 11:17:04 +02:00
Guilherme Blanco
cc83ac6ce8 Centralize InputParameter SQL generation. 2013-08-19 00:33:45 -04:00
Guilherme Blanco
43fc8bafa7 DDC-1858 Added missing support to ResultVariable in LikeExpression. 2013-08-18 23:52:32 -04:00
Mark Fox
29366bb9c7 Updated require version and my earlier errors dissolved
As stated, the tutorial was written for 2.4.x, but the composer.json settings proffered would install 2.3.4, which has a different enough API that basic parts of the tutorial code would fail.
2013-08-17 21:15:03 -07:00
Mark Fox
c89258a0ea fixed spelling mistake "bootsrapped" 2013-08-17 14:25:37 -07:00
Mark Fox
3405659eba Update getting-started.rst
The inline cli-config.php, bootstrap.php examples were out of sync with Doctrine 2.4.x — I referenced https://github.com/doctrine/doctrine2-orm-tutorial/ for correct examples
2013-08-17 14:07:29 -07:00
Guilherme Blanco
605c32dbb3 Merge pull request #758 from doctrine/DDC-2235
Fixed DDC-2235.
2013-08-15 21:36:22 -07:00
Guilherme Blanco
f674445486 Fixed DDC-2235. 2013-08-16 00:07:06 -04:00
Marco Pivetta
b038e6b083 Merge pull request #757 from mnapoli/patch-3
Update resolve-target-entity-listener.rst
2013-08-14 04:22:50 -07:00
Matthieu Napoli
ad2ae4c4b4 Update resolve-target-entity-listener.rst
Another syntax highlighting fix
2013-08-14 12:14:02 +02:00
Guilherme Blanco
eaeeee7740 Merge pull request #756 from peterjmit/master
Make yaml/xml configuration for  "AttributeOverride" and "AssociationOverride" more discoverable
2013-08-13 14:43:22 -07:00
Guilherme Blanco
6e265686ec Merge pull request #755 from shieldo/patch-2
corrected English grammar in docblocks
2013-08-13 14:42:52 -07:00
Peter Mitchell
c933ac1a4a Update override field mapping tut
* Added reference to override section of inheritance-mapping.rst
* Added link to yaml/xml examples in override-field-association-mappings-in-subclasses.rst
2013-08-13 16:08:42 -04:00
Douglas Greenshields
494ab1fc2b corrected English grammar in docblocks 2013-08-13 20:45:04 +01:00
Marco Pivetta
6372e60086 Merge pull request #754 from mnapoli/patch-3
Fixed syntax highlighting in working-with-associations.rst
2013-08-13 05:40:48 -07:00
Matthieu Napoli
036547e956 Update working-with-associations.rst
Fixed syntax highlighting
2013-08-13 14:39:17 +02:00
Guilherme Blanco
7f1c1d2b4a Fixed DDC-2506 by manually updating code. Closes PR #708. 2013-08-13 01:07:34 -04:00
Guilherme Blanco
0ae8aa36d7 Merge pull request #753 from 51systems/master
JoinedSubclassPersister doesn't properly bind on some versions of php
2013-08-11 20:11:11 -07:00
Dustin Thomson
27bae51fa0 Modified executeInserts method in JoinedSubclassPersister to only check for the presence of columns in a composite primary key 2013-08-11 19:41:10 -06:00
Benjamin Eberlei
b6bf47a148 Merge pull request #716 from Lumbendil/append-paginator-tree-walker
Appending the Paginator tree walker hint
2013-08-10 13:02:16 -07:00
Benjamin Eberlei
acb7dfb320 Merge pull request #729 from dbu/not-lifecycle-callback-hint
add missing hint about lifecycle callback
2013-08-10 13:00:00 -07:00
Benjamin Eberlei
1c8fa12b64 Merge branch 'DDC-2542' 2013-08-10 17:01:13 +02:00
Roger Llopart Pla
5a7efa2895 Fixed name colision. 2013-08-10 16:58:07 +02:00
Roger Llopart Pla
e755fe7842 Added a test which verifies that the tree walkers are kept. 2013-08-10 16:58:07 +02:00
Roger Llopart Pla
1bc6140394 Added docblock. 2013-08-10 16:58:07 +02:00
Roger Llopart Pla
7f1becf283 Appending the Paginator tree walker hint, instead of removing all the other hints. 2013-08-10 16:58:07 +02:00
Benjamin Eberlei
95af021ed9 Merge pull request #737 from Koc/fix-schema-validator-master
Skip not mapped public properties in SchemaValidator
2013-08-10 07:27:45 -07:00
Benjamin Eberlei
610e18949b Merge pull request #744 from jbruni/patch-1
Corrected PHP type for "decimal" mapping type
2013-08-10 07:23:50 -07:00
Guilherme Blanco
5f5c0ffc32 Fixing pgsql test. 2013-08-08 23:57:41 -04:00
Guilherme Blanco
7853fb8529 Merge pull request #752 from doctrine/PgSqlSchemaFix
ORM side fixes.
2013-08-08 19:43:53 -07:00
Guilherme Blanco
b314476599 ORM side fixes. 2013-08-08 22:01:26 -04:00
Guilherme Blanco
0cb89435b5 Merge pull request #751 from doctrine/PostLoadCanQuery
Added coverage for querying support during postLoad.
2013-08-08 18:57:42 -07:00
Guilherme Blanco
3ec267e8a6 Added coverage for querying support during postLoad. 2013-08-08 20:53:11 -04:00
Fabio B. Silva
0a42401a43 [DDC-2572] Fix ResolveTargetEntityListener subscription example 2013-08-08 19:13:13 -04:00
Konstantin.Myakshin
3c1fd9a3a9 Skip not mapped public properties in SchemaValidator 2013-08-07 01:18:15 +03:00
Guilherme Blanco
34b855e253 Merge pull request #748 from makhov/master
Add hour to DATE_ADD and DATE_SUB
2013-08-06 14:50:14 -07:00
J. Bruni
14bc65bae7 Updated EntityGeneratorTest::testEntityTypeAlias 2013-08-06 11:23:15 -03:00
amakhov
d8fcdc0c54 Add hour to DATE_ADD and DATE_SUB. Excepcion message fix 2013-08-06 12:40:30 +04:00
amakhov
dd975fe53d Add hour to DATE_ADD and DATE_SUB 2013-08-06 12:20:22 +04:00
Marco Pivetta
97762d21a4 Merge pull request #747 from bronze1man/pr-file-mode
fix some file mode 755->644
2013-08-05 23:41:30 -07:00
bronze1man
97d9ba62bb fix some file mode 755->644 2013-08-06 14:12:05 +08:00
Guilherme Blanco
094236d4e0 Merge 2013-08-06 01:49:00 -04:00
Guilherme Blanco
7ec59878a1 Added postLoad behavioral event coverage as a set of functional test. 2013-08-06 01:47:42 -04:00
Guilherme Blanco
354d7050dc Merge pull request #720 from bakura10/fix-paginator
Allow to have non-distinct queries
2013-08-05 20:59:12 -07:00
Guilherme Blanco
ea44ee1d55 Merge pull request #745 from jbruni/patch-2
Update basic-mapping.rst
2013-08-05 20:57:26 -07:00
Guilherme Blanco
e0fd377828 Removed ticket that was breaking the build. DDC-2524 is a circular dependency that is impossible to be fixed with our current codebase. 2013-08-03 19:03:10 -04:00
Guilherme Blanco
36e7e3ccde Updated documentation. 2013-08-03 17:40:48 -04:00
Guilherme Blanco
d9c1782a4f Properly fixed DDC-1858. Added support for ResultVariable in NullComparisons while using HavingClause. 2013-08-03 17:38:55 -04:00
J Bruni
13c1efb240 Update basic-mapping.rst
The attribute name is "name", not "column", isn't it?
2013-08-03 11:26:37 -03:00
J. Bruni
15c2c4dd23 Updated EntityGeneratorTest::testEntityTypeAlias 2013-08-03 10:44:02 -03:00
J Bruni
3c613b9c02 Corrected PHP type for "decimal" mapping type
"Basic Mapping" documentation says:
"decimal: Type that maps a SQL DECIMAL to a PHP string."
2013-08-03 05:44:15 -03:00
Christian Morgan
c715d91dc7 Updates based on feedback from Ocramius
Addresses all comments made so far, except the one about persists/updates
2013-08-01 17:56:45 +01:00
Guilherme Blanco
a19106b03d Merge pull request #731 from austinsmorris/PersistentCollection-initialize-coll
[DDC-2564] - PersistentCollection - initialize coll
2013-07-30 22:36:15 -07:00
Guilherme Blanco
b070676797 Merge pull request #743 from doctrine/DDC-2524
Added coverage to DDC-2524. Updated DDC-1719 to fix related DBAL bug.
2013-07-30 22:29:44 -07:00
Guilherme Blanco
b3d0ad7a87 Added coverage to DDC-2524. Updated DDC-1719 to fix related DBAL bug. 2013-07-31 01:24:02 -04:00
Guilherme Blanco
08e38858ed Merge pull request #741 from doctrine/DDC-1884
Fixed DDC-1884.
2013-07-30 10:48:37 -07:00
Guilherme Blanco
157588f6dc CS fixes. 2013-07-30 12:11:08 -04:00
Christian Morgan
d5bc48623a Cleaned up events.rst
Was a mix-up between TestEventSubscriber and EventTest (e.g. the definition of TestEventSubscriber referenced TestEvent::preFoo, which did not exist). To clarify this I've renamed EventTest to TestEvent.

Tried to clarify the text in the Naming Convention section.

Added note that onClear is not a lifecycle callback.

Tried to clarify the definition of Lifecycle Callbacks.

Separated key/value descriptions into XML and YAML parts since the details are different

Added note in Implementing Event Listeners section that since 2.4 you do have access to EntityManager and UnitOfWork from lifecycle callbacks.

Added example about how to use the computed changeset to modify a primitive value in preUpdate section

Added naming convention example to Entity listeners class section

The other changes are typos and small fixes.
2013-07-30 14:00:17 +01:00
Guilherme Blanco
c7b4c9bf0f Fixed DDC-1884. 2013-07-30 01:29:34 -04:00
Guilherme Blanco
0e010994a7 Merge pull request #740 from doctrine/FilterCollectionEnhancement
Synchronized support of FilterCollection with ODM by adding missing method
2013-07-29 18:44:10 -07:00
Guilherme Blanco
d4814dec42 Synchronized support of FilterCollection with ODM by adding missing method. 2013-07-29 21:24:08 -04:00
Guilherme Blanco
7055ccbf9b Merge pull request #739 from FabioBatSilva/DDC-2579
Fix DDC-2579
2013-07-29 16:54:30 -07:00
Fabio B. Silva
1fbe1ffc5a fix DDC-2579 2013-07-29 19:31:44 -04:00
Guilherme Blanco
a53fe14fa2 Merge pull request #717 from hackedd/patch-1
Allow query parameters starting with an underscore
2013-07-29 13:37:51 -07:00
Guilherme Blanco
8d13601e39 Merge pull request #738 from doctrine/VolatileQueryHydrators
Modified Hydrators to be per-query instances instead of a singleton-like approach
2013-07-29 08:31:38 -07:00
Guilherme Blanco
2dd73d4def Kept BC. 2013-07-29 10:46:47 -04:00
Christian Morgan
7535e9664e Update getting-started.rst
Replaced ``class::$field`` with ``class#field`` to match Doctrine style

Cleaned up three paragraphs mentioned in https://github.com/doctrine/doctrine2/pull/734
2013-07-29 10:42:10 +01:00
Guilherme Blanco
c28b457221 Modified Hydrators to be per-query instances instead of a singleton-like approach. 2013-07-28 20:30:42 -04:00
Guilherme Blanco
eea8572238 Merge pull request #735 from FabioBatSilva/fix-proxy-performance-test
Fix proxy performance test
2013-07-27 07:53:18 -07:00
fabios
69d4fdda1b Fix proxy performance test 2013-07-26 17:59:50 -04:00
Christian Morgan
bc7d06fe59 Updated method documentation to use # for instance methods instead of :: 2013-07-26 22:21:27 +01:00
Christian Morgan
7bc18d7888 Cleaned up documentation
Cleaned up documentation, tweaked some of the grammar, changed class#method() references to class::method(), added warning about performance impact of lazy loading
2013-07-26 16:16:24 +01:00
Marco Pivetta
d7881a1ec2 Merge pull request #733 from Lumbendil/master
Update Parser.php
2013-07-24 04:13:12 -07:00
Roger Llopart Pla
9b574ad53b Update Parser.php
Fix the docummentation for Parser::Literal()
2013-07-24 13:07:06 +02:00
Austin Morris
5fc1184a49 convert PersistentCollection functional tests to unit tests 2013-07-23 09:40:46 -04:00
Austin Morris
0083cb8ca6 remove redundant require_once for TestInit.php 2013-07-23 09:01:01 -04:00
Guilherme Blanco
6f39a426a7 Merge pull request #732 from trsteel88/patch-1
Update working-with-associations.rst
2013-07-22 20:22:37 -07:00
trsteel88
23cc3ea4bc Update working-with-associations.rst
Always use the constant for sorting. If you use 'asc' it will not work.
2013-07-23 12:30:33 +10:00
Austin Morris
1c8ae50557 do not initialize coll on add() 2013-07-22 18:54:02 -04:00
Austin Morris
6bae2eac29 Initialize coll when using Collection methods inside PersistentCollection 2013-07-22 14:42:03 -04:00
Austin Morris
5fd844d73e PersistentCollection - initialize coll - create failing tests 2013-07-22 14:39:00 -04:00
Marco Pivetta
4bc8f7be16 Merge pull request #728 from armetiz/patch-1
Color message like the update tools
2013-07-22 08:19:50 -07:00
Thomas Tourlourat
4882ff1ef5 Add info tag around ATTENTION 2013-07-22 17:11:53 +02:00
Marco Pivetta
8d2826c633 Merge pull request #730 from NicolasN/patch-1
To avoid "SpacingAfterParams" error with PHPCS Symfony2 coding standard
2013-07-22 02:17:53 -07:00
Nicolas Nutten
eba933bb47 To avoid "SpacingAfterParams" error with PHPCS Symfony2 coding standard
Hello,
I added two blank lines in comments two avoid the following error with PHPCS Symfony2 coding standard :
Error Code: SpacingAfterParams
Error Description: Last parameter comment requires a blank new line after it.
2013-07-22 10:56:18 +02:00
David Buchmann
b4e9dafd10 add missing hint about lifecycle callback 2013-07-22 10:23:47 +02:00
Thomas Tourlourat
0c3581a1f8 Color message like the update tools 2013-07-19 11:33:35 +02:00
Guilherme Blanco
fbbb161987 Merge pull request #719 from tristanlins/fix/entity-generator-extensibility
Access properties via static:: instead of self::.
2013-07-17 17:18:01 -07:00
Guilherme Blanco
2a5652c807 Merge pull request #723 from morganprecision/patch-1
Remove extra semicolon before ->setParameter() calls
2013-07-15 16:38:05 -07:00
Eugene Morgan
0a151f2474 Remove extra semicolon before ->setParameter() calls 2013-07-15 15:01:33 -05:00
Marco Pivetta
0aed9595c3 Merge pull request #721 from alex88/patch-1
Updated batch-processing link extension
2013-07-11 04:56:13 -07:00
Alessandro Tagliapietra
d249a22f74 Updated batch-processing link extension
I've changed the batch processing link adding .html else the link is broken
2013-07-11 11:52:26 +02:00
Michaël Gallego
3f112db725 Allow to have non-distinct queries 2013-07-09 17:31:30 +02:00
Guilherme Blanco
78fc129614 Merge pull request #632 from Padam87/entgentrait
entity generator - ignore trait properties and methods
2013-07-07 12:37:55 -07:00
Tristan Lins
641774630b Access properties via static:: instead of self::.
The properties of EntityGenerator are now protected instead of private.
But this does not make sense until they are accessed with static::.
Otherwise the templates cannot be overwritten within a sub class.
2013-07-05 13:40:57 +02:00
Paul Hooijenga
b5394fc5a0 Add test for query paremeters starting with underscore 2013-07-05 09:21:50 +02:00
Roger Llopart Pla
9f2994f462 Fixed name colision. 2013-07-04 08:29:46 +00:00
Paul
6aa58d9939 Allow query parameters starting with an underscore 2013-07-04 10:12:36 +02:00
Roger Llopart Pla
91638aadcf Added a test which verifies that the tree walkers are kept. 2013-07-03 11:18:19 +00:00
Roger Llopart Pla
981fcb2c21 Added docblock. 2013-07-03 12:24:57 +02:00
Roger Llopart Pla
90a41fba8b Appending the Paginator tree walker hint, instead of removing all the other hints. 2013-07-03 12:14:16 +02:00
Marco Pivetta
dc2be816a8 Merge pull request #713 from dave1010/grammar-fix
Quick grammar fix
2013-07-02 10:20:28 -07:00
Dave Hulbert
5e700db6d3 Fix grammar in CreateCommand 2013-07-02 16:29:36 +01:00
Dave Hulbert
c57f2c39f6 Fix grammar in DropCommand 2013-07-02 16:28:58 +01:00
Benjamin Eberlei
29d6da0fa0 Merge pull request #703 from shulcsm/patch-1
Clear visitedCollections
2013-06-30 01:38:02 -07:00
Benjamin Eberlei
69fe5c48f4 Merge pull request #710 from sandermarechal/extra-lazy-get-fix
Fix extra lazy get
2013-06-30 01:37:26 -07:00
Benjamin Eberlei
8e1111c8d3 Merge pull request #711 from FabioBatSilva/coveralls
Coveralls code coverage
2013-06-27 23:52:15 -07:00
Fabio B. Silva
e4bccdc7b3 coveralls code coverage 2013-06-27 20:18:21 -04:00
Sander Marechal
06ed21e883 Remove extra-lazy-get for ManyToMany relation 2013-06-27 14:19:39 +02:00
Sander Marechal
5635fa60a4 Check owning entitiy on extra lazy get with OneToMany relation 2013-06-27 14:17:41 +02:00
Benjamin Eberlei
4d93a4950b Merge branch 'DDC-2530' 2013-06-25 19:34:22 +02:00
Benjamin Eberlei
a91050e7f4 [DDC-2350] Eager Collections are not marked as initialized, leading to multiple queries being executed. 2013-06-25 19:34:12 +02:00
Guilherme Blanco
20e5d98b7b Merge pull request #640 from denkiryokuhatsuden/patch-1
[Paginator]Add hidden field ordering for postgresql
2013-06-24 19:23:36 -07:00
Benjamin Eberlei
2f6e914d64 Dont allow failures in 5.5 anymore 2013-06-24 08:42:17 +02:00
Guilherme Blanco
457036aacb Merge pull request #702 from FabioBatSilva/DDC-2459
[DDC-2459]ANSI compliant quote strategy
2013-06-23 14:26:49 -07:00
Guilherme Blanco
2ce72f38a2 Merge pull request #705 from FabioBatSilva/DDC-2519
[DDC-2519] Partial association identifier
2013-06-23 14:25:58 -07:00
Fabio B. Silva
1cff8b4d98 Fix DDC-2519 2013-06-21 16:07:09 -04:00
Fabio B. Silva
a165f63c8c ANSI compliant quote strategy 2013-06-21 16:05:59 -04:00
Benjamin Eberlei
eaf8fd3c34 Merge pull request #706 from sandermarechal/extra-lazy-get
[DDC-1398] Extra-lazy get for indexed associations
2013-06-20 05:26:52 -07:00
Sander Marechal
70427871ce Extra test for indexBy identifier versus indexBy other fields 2013-06-20 14:20:00 +02:00
Sander Marechal
2879162015 No need to lookup metadata 2013-06-20 14:00:58 +02:00
Sander Marechal
3b92cfac5a Use find() if the indexBy field is the identifier 2013-06-20 13:45:38 +02:00
Sander Marechal
53c9ffda30 Get rid of variable 2013-06-20 10:20:16 +02:00
Sander Marechal
647c5e2cad Test actual data returned by get() 2013-06-20 10:18:08 +02:00
Sander Marechal
3555007f08 Return NULL for non-existent keys
The load() function already returns just one entity or NULL, so
the current() is not needed and the result can be returned directly.
2013-06-20 10:09:52 +02:00
Sander Marechal
523697d0b6 [DDC-1398] Extra-lazy get for indexed associations
If an association is EXTRA_LAZY and has an indexBy, then
you can call get() without loading the entire collection.
2013-06-20 09:29:56 +02:00
Benjamin Eberlei
1382d766b0 Merge pull request #704 from liuggio/patch-1
added badges stable release and total downloads
2013-06-19 09:02:33 -07:00
Giulio De Donato
c743bb938b added badges 2013-06-19 16:40:57 +02:00
shulcsm
3340234785 Clear visitedCollections
Visited collections are cleared only in commit(). Commit clears up only if it actually has something to do. Processing large amounts of records without changing them cause visitedCollections to grow without any way of clearing.
2013-06-19 16:34:44 +03:00
Marco Pivetta
a39ceb3159 Merge pull request #701 from rbroen/patch-2
list_bugs.php needs to call to getters for protected vars
2013-06-17 02:41:29 -07:00
Robert Broen
6ff5043ce8 list_bugs.php needs to call to getters for protected vars
list_bugs.php needs to call to getters for protected vars. This was changed in the "getting-started" code repository, but not in the "getting-started" tutorial.
2013-06-17 11:36:09 +02:00
Marco Pivetta
1a958f70fd Merge pull request #700 from rbroen/patch-2
Update getting-started.rst
2013-06-17 01:39:43 -07:00
Robert Broen
184e8eb26c Update getting-started.rst
The tutorial assumes Doctrine 2.4
2013-06-17 10:31:06 +02:00
Guilherme Blanco
7903a2b513 Merge pull request #695 from doctrine/RepositoryFactory
Implemented support for RepositoryFactory.
2013-06-14 09:19:43 -07:00
Guilherme Blanco
52b3fc1fc3 Updated since php doc tag. 2013-06-14 12:07:28 -04:00
Guilherme Blanco
09d67b10b0 Merge pull request #697 from michaelperrin/patch-1
Fix phpDoc syntax in ClassMetadataInfo.php
2013-06-14 06:57:14 -07:00
Adam Prager
73e2aa54ef moved php version check 2013-06-14 10:07:05 +02:00
Michaël Perrin
37d7df6ac4 Fix phpDoc syntax in ClassMetadataInfo.php 2013-06-14 11:00:17 +03:00
Guilherme Blanco
3488049c18 Reduced granularity of DefaultRepositoryFactory reference to ObjectRepository instances, in cases where consumers are completely rewrote EntityRepository. 2013-06-13 23:59:08 -04:00
Guilherme Blanco
a66fc03441 Reducing dependency on RepositoryFactory by providing EntityManager as a getRepository argument. 2013-06-13 23:53:53 -04:00
Guilherme Blanco
37e7e841c3 Fixed wrong interface. 2013-06-13 23:31:18 -04:00
Guilherme Blanco
f2f1d8986c Merge pull request #694 from FabioBatSilva/DDC-2478
[DDC-2478] Support null association comparison
2013-06-13 20:12:48 -07:00
Guilherme Blanco
7eb744126b Implemented support for RepositoryFactory. 2013-06-13 21:47:40 -04:00
Fabio B. Silva
f16c8e3efe Fix DDC-2478 2013-06-13 16:44:02 -04:00
Guilherme Blanco
6ef48561ba Merge pull request #688 from sellingsource/master
Implement QuoteStrategy on SqlWalker walkRangeVariableDeclaration
2013-06-12 12:03:24 -07:00
Guilherme Blanco
0a90279a99 Merge pull request #693 from doctrine/hotfix/DDC-2214
Adding failing test for DDC-2214
2013-06-12 12:00:31 -07:00
Marco Pivetta
a1355d0bb9 Adding failing test for DDC-2214
Parameters being bound to an SQL query should have the same type as
the identifier of the objects being bound to the placeholders of a
DQL query - this is currently broken with proxies, as this test
demonstrates.
2013-06-12 20:51:45 +02:00
Guilherme Blanco
6937061b23 Merge pull request #690 from FabioBatSilva/DDC-2494
[DDC-2494] Apply type conversion to meta columns
2013-06-12 11:47:26 -07:00
Fabio B. Silva
c1e688fc81 drop useless support for associations 2013-06-12 10:30:51 -04:00
Fabio B. Silva
d961028b14 small optimization 2013-06-12 10:30:51 -04:00
Fabio B. Silva
d685f592fe Fix DDC-2494 2013-06-12 10:30:51 -04:00
Guilherme Blanco
b15758bb42 DDC-2476 Commented check under PostgreSQL. 2013-06-12 02:29:08 -04:00
Guilherme Blanco
3d86c82a7f DDC-2476 Better approach for reverse engineer. Some refactoring done to driver. 2013-06-12 02:00:36 -04:00
Guilherme Blanco
0d834d0bd4 DDC-2489 Added missing semicolon when dump-sql on schema update. 2013-06-12 00:31:25 -04:00
Guilherme Blanco
0248f743ba Merge pull request #691 from 51systems/master
IDENTITY function fix for Joined Inheritance
2013-06-11 21:04:27 -07:00
Dustin Thomson
ed7a4bdcf3 Fix typo in test name 2013-06-11 18:38:05 -06:00
Dustin Thomson
529064aff2 Modified identity function to work with joined inheritance tables.
Added regression tests
2013-06-11 18:09:49 -06:00
Guilherme Blanco
4e99c5c127 DDC-1858 Added coverage to ticket. Functionality already implemented. 2013-06-11 01:21:47 -04:00
Guilherme Blanco
462173ad71 Merge pull request #689 from FabioBatSilva/DDC-1995
[WIP][DDC-1995 ] Support metadata class as parameter for instance of expression
2013-06-07 14:42:59 -07:00
Fabio B. Silva
710d0d1109 Fix DDC-1995 2013-06-07 17:24:05 -04:00
John Brown
4ef043fc3b updating sql walker to use quote strategy in joins 2013-06-07 08:56:58 -07:00
John Brown
afb9c829e2 updating sql walker to use quote strategy in joins 2013-06-07 08:49:49 -07:00
John Brown
9bea612d74 Adding simple test to ensure quoting of table names still functions. Note: the funtionality of this change won't be noticiable unless a custom quote strategy is implemented 2013-06-06 15:51:23 -07:00
John Brown
77b905eaa8 Implement QuoteStrategy on SqlWalker walkRangeVariableDeclaration
Based on:
http://www.doctrine-project.org/jira/browse/DDC-1845
cb72219b11
2013-06-06 15:08:22 -07:00
Marco Pivetta
5c7b98b2a9 Merge pull request #687 from mnapoli/patch-3
Fixed rendering
2013-06-06 01:51:49 -07:00
Matthieu Napoli
424793c263 Fixed rendering
Fixed some broken rendering on http://docs.doctrine-project.org/en/latest/reference/yaml-mapping.html
2013-06-06 11:36:02 +03:00
Guilherme Blanco
753d63c2d4 Merge pull request #686 from FabioBatSilva/DDC-2475
[DDC-2475] Replace OrderBy mapping when OrderByClause is given
2013-06-04 22:03:53 -07:00
Fabio B. Silva
27511374ec Fix DDC-2475 2013-06-04 23:50:43 -04:00
Marco Pivetta
3d6436c2f3 Merge pull request #683 from greg0ire/error_message_improvement
Explicitely state what the problem is
2013-06-03 03:37:38 -07:00
Grégoire Paris
a986fe013e Explicitely state what the problem is
People like me think the problem is that there is no association
mapping, when the problem in fact could be that there also is a field
mapping on the property.
This message makes it clearer why we are getting an error message.
2013-06-03 12:07:08 +02:00
Marco Pivetta
4e8b787d07 Merge pull request #679 from ajgarlag/getting-started
Fix getting started doc to work with current version
2013-05-28 00:36:17 -07:00
Antonio J. García Lagar
c64c149ebf Fix getting started doc to work with current version 2013-05-28 08:57:17 +02:00
Benjamin Eberlei
f269ecc3ac Bump dev version to 2.4.0 2013-05-27 21:47:16 +02:00
Benjamin Eberlei
6bc18402e2 Release 2.4.0-RC1 2013-05-27 21:47:16 +02:00
Marco Pivetta
3d0ac62059 Merge pull request #678 from jbafford/duplicate-words-fix
Fix an instance of doubled words in the docs
2013-05-27 08:51:38 -07:00
John Bafford
0e29fe871a Fix an instance of doubled words 2013-05-27 11:20:26 -04:00
Alexander
e5de0dad7e Merge remote-tracking branch 'asm89/ddc-2417'
* asm89/ddc-2417:
  [DDC-2471] Fix EQ/NEQ null handling of criteria
2013-05-26 09:10:18 +02:00
Alexander
66a842c143 [DDC-2471] Fix EQ/NEQ null handling of criteria 2013-05-26 09:04:19 +02:00
Benjamin Eberlei
6548947df5 Merge pull request #666 from FabioBatSilva/DDC-2429
[DDC-2429] Fix xsd definition
2013-05-25 23:01:13 -07:00
Benjamin Eberlei
20b5ab26e7 Merge pull request #669 from hason/many_to_many
Fixed generating column names for self referencing entity.
2013-05-25 22:16:48 -07:00
Benjamin Eberlei
a36f84eeb5 Merge pull request #672 from hell0w0rd/simplification_example
Simplification example
2013-05-25 22:00:59 -07:00
Benjamin Eberlei
e8b3598751 Merge pull request #673 from hell0w0rd/namespace_base_commands_names
Namespace based command names
2013-05-25 21:59:32 -07:00
Gusakov Nikita
1f4a65f3e0 add debug variable and check for loader 2013-05-20 17:08:20 +04:00
Torben
997f22fbb9 add shortcut for force 2013-05-20 10:06:11 +02:00
Gusakov Nikita
384dfa87ab add docs 2013-05-18 04:00:28 +04:00
Gusakov Nikita
6bb3184dbf fix bc 2013-05-18 02:40:18 +04:00
Gusakov Nikita
4c1869dca0 ready 2013-05-18 02:09:07 +04:00
Gusakov Nikita
ec57306efe remove comment about cli-config 2013-05-18 01:44:47 +04:00
Gusakov Nikita
dca0881d94 forget add changes 2013-05-18 01:42:55 +04:00
Gusakov Nikita
7430320bac ready 2013-05-18 01:40:05 +04:00
Benjamin Eberlei
c9d9b68fa9 Merge pull request #671 from FabioBatSilva/DDC-2435
[DDC-2435] Fix column name with numbers and non alphanumeric characters.
2013-05-17 09:34:00 -07:00
Fabio B. Silva
f92214997f [DDC-2435] Fix column name with numbers and non alphanumeric characters. 2013-05-17 13:02:46 -03:00
Benjamin Eberlei
65886fdfea Merge pull request #670 from FabioBatSilva/DDC-2451
[DDC-2451] Fix entity listeners serialization
2013-05-17 08:09:28 -07:00
Fabio B. Silva
1e95110b08 Add missing mapping files 2013-05-17 11:59:28 -03:00
Fabio B. Silva
1d7c72cc06 [DDC-2451] Fix test assert 2013-05-17 11:55:36 -03:00
Fabio B. Silva
4d6cef1ff6 [DDC-2451] Fix entity listeners serialization 2013-05-17 11:42:11 -03:00
Martin Hasoň
bef5b585cb Fixed generating join column names for self referencing entity. 2013-05-17 16:28:45 +02:00
Fabio B. Silva
b147c472be [DDC-2429] Fix xsd definition 2013-05-13 11:04:36 -03:00
Benjamin Eberlei
eb1a162cbc Fix regression in DDC-2430. 2013-05-10 23:31:27 +02:00
Benjamin Eberlei
bf9673203c Merge pull request #639 from goetas/indexby-metadata
Added abillity to use metacolumn as indexBy
2013-05-09 23:53:26 -07:00
Benjamin Eberlei
fa75856d5f Merge pull request #663 from doctrine/hotfix/DDC-2432
Hotfix for DDC-2432
2013-05-09 14:37:55 -07:00
Marco Pivetta
22c9f6ebec applying required fixes for DDC-2432 2013-05-09 21:14:58 +02:00
Marco Pivetta
07c207081e Adding failing test to demonstrate DDC-2432
Loading proxies with invalid identifiers will currently mark them as initialized regardless of the failure
2013-05-09 21:11:10 +02:00
Benjamin Eberlei
762f43c3dc Merge branch 'DDC-2280' 2013-05-09 18:15:48 +02:00
Benjamin Eberlei
b53f4fd4cc [DDC-2280] length attribute in <id> was not converted. 2013-05-09 18:15:41 +02:00
Benjamin Eberlei
665efad039 Merge branch 'master' of github.com:doctrine/doctrine2 2013-05-09 16:55:38 +02:00
Benjamin Eberlei
540af2fd2a Merge pull request #662 from jakzal/code-block-fix
Fixed a code block.
2013-05-09 07:27:35 -07:00
Benjamin Eberlei
1a0adecf29 [DDC-2335] Add note about filtering schema by regexp expression to relevant commands help output. 2013-05-09 16:24:19 +02:00
Jakub Zalas
97622b57bd Fixed a code block.
Sphinx does not like the way code was indented. Building the documentation raises the following error:
en/cookbook/resolve-target-entity-listener.rst:121: ERROR: Unexpected indentation.
2013-05-09 15:19:58 +01:00
Benjamin Eberlei
b9a0a19607 Merge pull request #661 from HarmenM/patch-1
Update annotations-reference.rst
2013-05-09 05:10:26 -07:00
HarmenM
f8efd85ae6 Update annotations-reference.rst
Added missing @JoinColumns in the index
2013-05-09 14:49:38 +03:00
Benjamin Eberlei
dc674f809f Mention BC BREAK in PersistentCollection#matching() more prominently. 2013-05-09 13:40:14 +02:00
Benjamin Eberlei
30f90a6f49 Merge branch 'DDC-2430' 2013-05-09 13:24:45 +02:00
Benjamin Eberlei
6d5afb18bc [DDC-2430] Prevent Criteria queries using the ID of an assocation on PersistentCollections, as the in-memory ArrayCollection does not work with this kind of query. Attention this is a BC-BREAK, that is necessary to fix potentially very hard to debug bugs. Therefore it is not merged back into 2.3 2013-05-09 13:24:36 +02:00
Benjamin Eberlei
d3cd10d926 Merge branch 'DDC-2387' 2013-05-09 12:10:45 +02:00
Benjamin Eberlei
7220c3c125 [DDC-2387] Fix DatabaseDriver not working with combinations of composite/association keys. 2013-05-09 12:10:37 +02:00
Benjamin Eberlei
86277def7e Merge branch 'DDC-2437' 2013-05-09 11:03:21 +02:00
Benjamin Eberlei
abe8ef6778 Merge branch 'DDC-2423' 2013-05-09 10:55:20 +02:00
Benjamin Eberlei
e3b8ce7737 [DDC-2423] Fixed bug with EntityGenerator not generating fetch="" attribute in association annotations. 2013-05-09 10:55:12 +02:00
Benjamin Eberlei
acbafd081b Add documentation to EntityManager about instantiation, decoration over inheritance, and some generic introduction. 2013-05-09 10:23:12 +02:00
Vladislav Vlastovskiy
3997d0df87 Added test complex inner join with indexBy 2013-05-09 03:32:28 +04:00
Vladislav Vlastovskiy
33888f1b08 Swapped places indexBy and condition in accordance with EBNF 2013-05-09 03:30:48 +04:00
Benjamin Eberlei
c8bcdb4b61 Merge pull request #524 from lstrojny/feature/entity-manager-decorator
EntityManagerDecorator base class as an extension point for EntityManager
2013-05-04 06:02:39 -07:00
Benjamin Eberlei
8e8560b276 Merge pull request #537 from Powerhamster/joined-composite-keys
fixed problems with joined inheritance and composite keys
2013-05-04 05:59:02 -07:00
Benjamin Eberlei
937473329f Merge branch 'DDC-2267' 2013-05-04 13:38:42 +02:00
Benjamin Eberlei
5e19e1bed3 [DDC-2267] Allow EntityManager#flush($entity) to be called on entities scheduled for removal. 2013-05-04 13:38:30 +02:00
Benjamin Eberlei
3c74491720 Merge branch 'DDC-2426' 2013-05-04 12:58:25 +02:00
Benjamin Eberlei
9adc45767d [DDC-2426] Missing length attribute in doctrine-mapping.xsd for <id> tag. 2013-05-04 12:58:06 +02:00
Benjamin Eberlei
59fff4ddef Fix Docs build 2013-05-03 13:32:42 +02:00
Benjamin Eberlei
6d02c7e1a5 [DDC-2136] Fix exporting to YAML and XML with assocation keys. 2013-05-01 23:10:13 +02:00
Benjamin Eberlei
d33e0a3488 Merge branch 'DDC-1998' 2013-05-01 20:33:49 +02:00
Benjamin Eberlei
0864ab8ada [DDC-1998] Pass types to Connection#delete() to allow custom conversions to happen. 2013-05-01 20:30:45 +02:00
Benjamin Eberlei
7d53cb2aeb Merge branch 'DDC-1984' 2013-05-01 19:39:30 +02:00
Benjamin Eberlei
131164b7f6 [DDC-1984] Throw exception if passing null into UnitOfWork#lock() - which can happen when EntityManager#find() tries to lock entity that was just deleted by another process. 2013-05-01 19:39:21 +02:00
Benjamin Eberlei
6c889eee64 Merge branch 'DDC-2106' 2013-05-01 18:46:54 +02:00
Benjamin Eberlei
640a8e58c7 [DDC-2106] Fix entity as parameter value when its managed but not yet with identifier. 2013-05-01 18:46:41 +02:00
Benjamin Eberlei
6505c96ec4 Simplify condition of previous commit (5cdc73e) 2013-05-01 10:58:44 +02:00
Benjamin Eberlei
760aaa67c4 Merge pull request #655 from FabioBatSilva/DDC-2409
[DDC-2409] Fix merge association STATE_NEW
2013-05-01 01:49:25 -07:00
Benjamin Eberlei
325387a6f2 Merge branch 'DBAL-483' 2013-05-01 10:42:35 +02:00
Benjamin Eberlei
1f08acb576 [DBAL-483] Pass default values to DBAL mapping layer correctly to fix default comparision bug. 2013-05-01 10:42:28 +02:00
Asmir Mustafic
7abf46af70 cascade remove persist on links 2013-04-29 11:03:55 +02:00
Asmir Mustafic
2ca24375e4 no lang 2013-04-29 10:32:40 +02:00
Asmir Mustafic
34adb16ee8 indexby ddc117 tests 2013-04-29 10:29:58 +02:00
Fabio B. Silva
5cdc73e13b Fix DDC-2409 2013-04-28 16:54:44 -03:00
Benjamin Eberlei
d513e0f084 Merge pull request #653 from FabioBatSilva/DDC-2415
[DDC-2415] Fix CustomIdGenerator inheritance
2013-04-27 00:40:57 -07:00
Fabio B. Silva
7c2da2d5b8 Fix DDC-2415 2013-04-26 16:11:04 -03:00
Marco Pivetta
cc24ac496d Merge pull request #652 from dannykopping/patch-1
Fixed entities path
2013-04-26 02:11:52 -07:00
Danny Kopping
408eef1356 Fixed entities path
In the tutorial, the user is told to create a new file in the '/src' folder, and the 'entities' folder is never referenced. Updating the SQLite schema according to the tutorial fails with the 'No Metadata Classes to process.' message. Changing the folder to '/src' fixes this, ostensibly.
2013-04-26 12:05:50 +03:00
Marco Pivetta
9791b2eb00 Merge pull request #651 from EuKov/patch-1
Fixed typo in SQLFilter (use statement ClassMetadata)
2013-04-23 10:50:01 -07:00
EuKov
99ec4dc72c Fixed typo in SQLFilter (use statement ClassMetadata) 2013-04-23 20:46:19 +03:00
Marco Pivetta
3aae50cb59 Merge pull request #649 from calumbrodie/patch-1
Update coding standards in change tracking cookbook entry
2013-04-21 12:07:31 -07:00
Calum Brodie
a0a133b02c Removed unneeded escape character
Removed backslash
2013-04-21 20:55:54 +02:00
Calum Brodie
c2967b35ff Update coding standards
Removing underscores from property/method names and change use statements to PSR-2
2013-04-21 20:43:48 +02:00
Benjamin Eberlei
92b41e017a [DDC-2407] Fix missing support for UUID and CUSTOM id generators in Exporter 2013-04-20 10:25:36 +02:00
Adam Prager
bf92a40171 skip test if php 5.3 2013-04-19 14:49:32 +02:00
Benjamin Eberlei
52b2e066c5 Merge pull request #611 from stefankleff/fix-eagerloading
Fixed typo in hints. Caused slow loading of eager entities.
2013-04-14 00:43:42 -07:00
Guilherme Blanco
e835175865 Merge pull request #646 from raykolbe/master
Oracle Pagination bug when ordering is present
2013-04-10 10:49:26 -07:00
Raymond Kolbe
27e23faa5a Accompanying tests for PR #646 2013-04-10 13:07:09 -03:00
Raymond Kolbe
4bafcc5b31 Fix Oracle subquery ordering
See http://www.doctrine-project.org/jira/browse/DDC-1800 and http://www.doctrine-project.org/jira/browse/DDC-1958#comment-19969
2013-04-09 17:30:54 -03:00
Raymond Kolbe
b8b7afe576 Fix Oracle subquery ordering lost bug
See http://www.doctrine-project.org/jira/browse/DDC-1800 for a full description.
2013-04-09 17:00:06 -03:00
Benjamin Eberlei
142c20aad1 Work on the Tutorial 2013-04-09 00:00:16 +02:00
Stefan Kleff
e561f47cb2 Added constant 2013-04-08 11:27:22 +02:00
Adam Prager
b7b107b08a moved test entities from sandbox 2013-04-07 16:26:05 +02:00
Benjamin Eberlei
d1f8e18d02 Enhance documentation on NEW() keyword. (ref DDC-1574) 2013-04-07 14:05:42 +02:00
Benjamin Eberlei
34374db56e Enhance documentation on IDENTITY() for composite keys (ref DDC-2202) 2013-04-07 14:02:47 +02:00
Benjamin Eberlei
b2e29eaf97 Rework NativeSQL doc chapter and document SELECT clause generation (ref DDC-2055). 2013-04-07 14:01:27 +02:00
Fabio B. Silva
2ad6565632 Fix parenthesis example 2013-04-06 14:53:36 -03:00
Benjamin Eberlei
cef20890dc Merge pull request #616 from FabioBatSilva/DDC-2252
[DDC-2252] Fix delete many-to-many composite key
2013-04-06 10:37:16 -07:00
Fabio B. Silva
8109db02b5 Document Parenthesis BC break. 2013-04-06 13:02:43 -03:00
Benjamin Eberlei
3fef8d7285 Merge pull request #621 from dbu/event-subscribers
[doc] adding some more doc and examples for lifecycle event listeners and subscribers
2013-04-06 08:04:24 -07:00
Benjamin Eberlei
fe238d03c8 Merge pull request #618 from FabioBatSilva/DDC-2188
[DDC-2188] Fix arithmetic priority
2013-04-06 07:56:36 -07:00
Benjamin Eberlei
3c4a9c8efa Merge pull request #644 from pborreli/typos
Fixed typos
2013-04-06 07:49:04 -07:00
Pascal Borreli
30b050b44c Fixed typos 2013-04-06 14:31:27 +00:00
Benjamin Eberlei
64b2ecfefc [DDC-2224] Rewrite instanceof feature with parameter needle ClassMetadata breaks caching of queries. 2013-04-04 20:22:48 +02:00
Adam Prager
3b7b457d35 minor fixes 2013-04-04 20:07:21 +02:00
Marco Pivetta
edca8c88ea Merge pull request #641 from bksunday/patch-1
Added yml example in ordered-associations.rst
2013-04-03 09:36:19 -07:00
Anthony
1278b79c79 Added yml example in ordered-associations.rst
And modified it to be in a configuration-block instead of separate code-block
2013-04-03 13:31:07 -03:00
denkiryokuhatsuden
7af84e79e5 Fixed postgresql hidden scalar sort 2013-04-03 17:22:31 +09:00
denkiryokuhatsuden
e54c11e3bb Add test for postgresql hidden scalar sorting 2013-04-03 17:21:51 +09:00
denkiryokuhatsuden
786d904328 Revert "Add hidden field ordering for postgresql"
This reverts commit 3e8796f781.
2013-04-03 17:14:31 +09:00
denkiryokuhatsuden
3e8796f781 Add hidden field ordering for postgresql
In postgresql environment, when some hidden fields are used in orderBy clause,
they're not property added because $rsm->scalarMappings don't have information about them.
2013-04-02 18:54:55 +09:00
Asmir Mustafic
3196b0c05a missing new line 2013-04-02 10:14:24 +02:00
Asmir Mustafic
6fc18e330d indexby metadata column 2013-04-02 10:04:15 +02:00
Adam Prager
b3414e3c1a added unit test 2013-03-31 00:47:45 +01:00
Adam Prager
937ba6385e fixed code duplication issue 2013-03-31 00:47:24 +01:00
Guilherme Blanco
9b0f252aff Merge pull request #637 from choomz/patch-1
Update association-mapping.rst
2013-03-30 06:48:06 -07:00
Valentin Ferriere
2e8272e18f Update association-mapping.rst 2013-03-29 16:39:55 +01:00
Guilherme Blanco
484d03a5bc Merge pull request #636 from dustinmoorman/rst-file-documentation-fixes
Fixed typos in documentation.
2013-03-27 21:26:24 -07:00
Dustin Moorman
51bcda51c5 Fixed typos in documentation. 2013-03-27 22:43:58 -05:00
Benjamin Eberlei
9613f1d8cb [DDC-93] Rename ReflectionProxy to ReflectionEmbeddedProperty, Add DQL test with Object and Array Hydration. 2013-03-27 21:45:16 +01:00
Benjamin Eberlei
879ab6e52b [DDC-93] Show CRUD with value objects with current change tracking assumptions. 2013-03-27 07:44:47 +01:00
Adam Prager
9797177193 check if ReflectionClass::getTraits() method exists 2013-03-27 02:48:35 +01:00
Benjamin Eberlei
011776f02f [DDC-93] Add some TODOs in code. 2013-03-27 00:18:21 +01:00
Benjamin Eberlei
0204a8b69a [DDC-93] Implement first working version of value objects using a ReflectionProxy object, bypassing changes to UnitOfWork, Persisters and Hydrators. 2013-03-27 00:10:30 +01:00
Benjamin Eberlei
32988b3cdf [DDC-93] Parse @Embedded and @Embeddable during SchemaTool processing to make parsing work. 2013-03-26 21:45:15 +01:00
Adam Prager
8898c91dfc only check for traits when class exists 2013-03-26 21:28:09 +01:00
Adam Prager
8e3e2e770a Revert "only use already existing reflections"
This reverts commit bb5bdcf0f4.
2013-03-26 21:17:59 +01:00
Adam Prager
bb5bdcf0f4 only use already existing reflections 2013-03-26 21:14:52 +01:00
Benjamin Eberlei
02d34bbba6 [DDC-93] Started ValueObjectsTest 2013-03-26 20:55:55 +01:00
Adam Prager
521276f1ed entity generator - ignore trait properties and methods 2013-03-26 20:52:57 +01:00
Guilherme Blanco
a4db7c8b42 Merge pull request #631 from aaronmu/master
Fix typo in one of the orderBy examples.
2013-03-26 09:18:01 -07:00
Aaron Muylaert
3e8dd1e45c Update query-builder.rst
Fix typo in one of the orderBy examples.
2013-03-26 16:47:41 +01:00
Benjamin Eberlei
5ea9cf418a Merge pull request #627 from chuanma/master
update document on Doctrine cache provider
2013-03-24 13:22:20 -07:00
Benjamin Eberlei
b7e09ecf98 Merge pull request #630 from Ocramius/hotfix/DDC-2359
Hotfix for DDC-2359
2013-03-24 12:23:34 -07:00
Benjamin Eberlei
7f26e9ac27 Bump dev version to 2.4.0 2013-03-24 19:58:19 +01:00
Benjamin Eberlei
827f1f84cb Release 2.4.0-BETA1 2013-03-24 19:58:19 +01:00
Marco Pivetta
7afe5af73a Fix for DDC-2359 2013-03-24 19:42:50 +01:00
Marco Pivetta
57020322cb Adding failing test for DDC-2359
Doctrine\ORM\Mapping\ClassMetadataFactory#wakeupReflection is called twice
2013-03-24 19:40:53 +01:00
Guilherme Blanco
1f89d8ce2f Merge pull request #629 from dustinmoorman/typo-fixes-in-basic-mapping-rst
Fixed typos in Doctrine Mapping Types section.
2013-03-24 09:28:16 -07:00
Guilherme Blanco
99a15377be Merge pull request #628 from franmomu/patch-2
[Docs] Fix field name in inversedby parameter
2013-03-24 09:27:48 -07:00
Dustin Moorman
d4061ff41b Fixed typos in Doctrine Mapping Types section. 2013-03-24 03:16:00 -05:00
Fran Moreno
10c48bad7b [Docs] Fix field name in inversedby parameter 2013-03-24 02:07:05 +01:00
Chuan Ma
94ceb0e410 Document: delete the doc for a number of cache provider methods that don't exist 2013-03-22 17:53:47 -04:00
Guilherme Blanco
24c1b00963 Merge pull request #622 from hrubi/master
Import EntityManager from proper namespace
2013-03-21 09:31:17 -07:00
Jan Hruban
3866472459 Import EntityManager in ConsoleRunner 2013-03-21 15:49:00 +01:00
David Buchmann
204c1afe9a cleanup event subscriber note 2013-03-21 10:43:01 +01:00
David Buchmann
220f367658 adding some more doc and examples for lifecycle event listeners and subscribers 2013-03-20 00:46:11 +01:00
Benjamin Eberlei
60b8bc63a1 Merge pull request #619 from FabioBatSilva/DDC-2090
[DDC-2090] Fix MultiTableUpdateExecutor with query cache
2013-03-17 13:35:34 -07:00
Fabio B. Silva
39ea24675d Fix DDC-2090 2013-03-17 16:59:33 -03:00
Benjamin Eberlei
acae1aeaaa Fix link in docs 2013-03-17 19:43:09 +01:00
Benjamin Eberlei
c399dcfe58 Add simpler section for 2.4 CLI integration 2013-03-17 19:18:49 +01:00
Benjamin Eberlei
ea19a0063f Huge refactoring of the Getting Started Tutorial to allow for an earlier success with the simple Product entity. 2013-03-17 13:43:16 +01:00
Benjamin Eberlei
4ef8e8c7aa Move all classes to src/ in tutorial rather than in entities/ 2013-03-17 12:45:49 +01:00
Benjamin Eberlei
bd964411e8 Remove models/database first tutorials for now 2013-03-17 12:39:04 +01:00
Benjamin Eberlei
5941d0267d Worked on the Getting Started Guide 2013-03-17 12:26:34 +01:00
Benjamin Eberlei
a7d764f6c0 Moved tools to Advanced topic, included simple setting up tools in Installation. Reworked CLI tool to print a template when no cli-config.php is defined. 2013-03-17 12:16:42 +01:00
Benjamin Eberlei
bdfe6098a4 Reworked parts of the tutorial 2013-03-16 23:36:36 +01:00
Benjamin Eberlei
e0d706219b Start reorganizing documentation with focus on simplicity. 2013-03-16 20:36:09 +01:00
Fabio B. Silva
685c96a1b9 Fix arithmetic priority 2013-03-16 14:33:19 -03:00
Fabio B. Silva
1effd38043 Fix DDC-2252 2013-03-16 01:15:54 -03:00
Benjamin Eberlei
6ee9e2284a Merge branch 'DDC-1666' 2013-03-14 23:41:40 +01:00
Benjamin Eberlei
559303430a [DDC-1666] Fix bug where orphan removal on one-to-one associations lead to unique constraint errors when replacing an entity with a new one. 2013-03-14 23:41:31 +01:00
Benjamin Eberlei
d0419782bd [DDC-2300] Fix version xml mapping and serialization of ClassMetadata. 2013-03-14 23:20:23 +01:00
Benjamin Eberlei
4982e2b6b0 Merge pull request #593 from norzechowicz/hydrator-fix
Fix SimpleObjectHydrator behavior when column not exists in fieldMappings, relationMappings and metaMappings
2013-03-14 14:58:52 -07:00
Benjamin Eberlei
b53fffe252 Fix YAML EntityListener definition in tests 2013-03-14 21:18:54 +01:00
Benjamin Eberlei
622ddd8d05 Refix test 2013-03-14 20:12:20 +01:00
Benjamin Eberlei
e128728105 Fix bugs in tests 2013-03-14 20:09:41 +01:00
Benjamin Eberlei
cf2cd549c8 Fix change in signature for hydrator statement mock. 2013-03-14 19:33:21 +01:00
Stefan Kleff
057e86eb27 Added test based on e468ced00b 2013-03-13 12:29:17 +01:00
Benjamin Eberlei
eca468b9d1 [DDC-2340] Fix bug with dirty collection matching + ordering. 2013-03-12 22:49:30 +01:00
Benjamin Eberlei
dba63c5a61 Merge pull request #579 from BenMorel/cleanup
Unit tests: cleanup of outdated / unused / commented out code
2013-03-12 12:00:47 -07:00
Rajesh Sharma
4841a068be [DDC-2304] accept more than 2 parameters in CONCAT function
- Tested and parser validates at least 2 parameters given
- test added for CONCAT function and indentation fixed
- calling getConcatExpression using call_user_func_array as number of arguments is not known removing dependency to patch DBAL
- maintaining backward compatibility
2013-03-12 19:59:45 +01:00
Benjamin Eberlei
fc86a31c10 Merge pull request #591 from Aitboudad/master
Remove dead code
2013-03-12 11:52:23 -07:00
Benjamin Eberlei
ba4705176e Merge pull request #601 from jankramer/add-contains-comparison
Add 'contains' comparison
2013-03-12 11:38:18 -07:00
Benjamin Eberlei
610e1a96f0 Merge pull request #595 from mnapoli/patch-1
Fixed broken code block in documentation
2013-03-12 11:31:52 -07:00
Benjamin Eberlei
0c4f48766a Merge pull request #602 from alex88/patch-1
Added $isIdentifierColumn documentation
2013-03-12 11:30:36 -07:00
Jean-Guilhem Rouel
8b8d1a5aaa Don't add empty expression to another one 2013-03-12 19:17:11 +01:00
Benjamin Eberlei
ce0dd1c4f4 Merge pull request #610 from afoeder/patch-1
[BUGFIX] Correct link to Functions, Operators, Aggregates
2013-03-12 11:13:11 -07:00
Benjamin Eberlei
3ba0562006 Merge branch 'GH-572' 2013-03-12 19:04:27 +01:00
Norbert Orzechowicz
6a69b4700c [DDC-2282] Fix pagination problem with SQL Server.
ORDER BY removed from all count queries when on SQL Server
Fixed SQLServer ORDER BY problem in paginator CountOutputWalker
Added test to check query with ORDER BY and SQLServerPlatform
2013-03-12 19:03:27 +01:00
Benjamin Eberlei
b6c3fc5b1a Mention flush cannot be called inside postFlush 2013-03-12 18:50:45 +01:00
Stefan Kleff
d937d1fc82 Fixed typo in hints. Caused slow loading of eager entities. 2013-03-12 16:17:14 +01:00
Adrian Föder
ca268c9da6 [BUGFIX] Correct link to Functions, Operators, Aggregates
This fixes the in-page link to the Functions, Operators, Aggregates
section.
2013-03-12 15:56:54 +01:00
Guilherme Blanco
905c0b9d91 Merge pull request #609 from haroldb/patch-1
Fixed typo.
2013-03-11 15:42:09 -07:00
Harold Barker
363df46006 Fixed typo. 2013-03-11 22:11:50 +00:00
Guilherme Blanco
d808c5d895 Merge pull request #608 from pborreli/patch-1
Fixed typo
2013-03-10 17:55:41 -07:00
Pascal Borreli
87e06993d6 Fixed typo 2013-03-11 00:31:50 +00:00
Guilherme Blanco
6d85779f4d Merge pull request #607 from pborreli/typos
Fixed typos
2013-03-10 17:25:31 -07:00
Pascal Borreli
a2cd0f5804 Fixed typos 2013-03-11 00:08:58 +00:00
Jan Kramer
9d5e7eb6e9 Added composer.lock to .gitignore 2013-03-07 14:12:10 +01:00
Jan Kramer
760623346c Added 'contains' comparison 2013-03-07 13:32:56 +01:00
Lars Strojny
acc8b61cd1 Adding EntityManagerDecorator base class as an extension point for EntityManager 2013-03-06 23:30:47 +01:00
Alessandro Tagliapietra
9ce4f9806e Added $isIdentifierColumn documentation
I've added the documentation of the argument $isIdentifierColumn since in case of foreign composite keys it doesn't
2013-03-06 10:48:47 +01:00
Benjamin Eberlei
399584db4c Merge pull request #599 from alexcarol/fix/docs
Removed unnecessary "<?php" from the docs
2013-03-04 14:39:01 -08:00
Benjamin Eberlei
a07c9dfbbd Merge pull request #596 from mnapoli/patch-2
Missing link to a cookbook in the docs
2013-03-04 14:18:33 -08:00
Alex Carol
e809f9c266 Removed unnecessary <?php from the docs 2013-03-03 23:14:58 +01:00
Guilherme Blanco
b30d6dfd8e Merge pull request #597 from MDrollette/fix-proxy-interface
use the extended proxy interface in the same namespace
2013-03-03 09:14:30 -08:00
Johannes M. Schmitt
b4b9709090 adds a new output format 2013-03-03 11:01:43 +01:00
Matthieu Napoli
2eff096ddd Typo 2013-03-02 18:42:38 +01:00
Matthieu Napoli
159daa9985 Reverted incorrect typo fix -_- 2013-03-02 18:40:58 +01:00
MDrollette
1846f5845c alias the proxy class on import to avoid "already exists" error 2013-03-01 11:58:51 -06:00
Matthieu Napoli
32dd7f1a0e Missing link to a cookbook in the docs
The cookbook existed in the docs but there was no link to it in the docs.
2013-03-01 15:16:59 +01:00
Matthieu Napoli
20b46fe17f Fixed broken code block in documentation 2013-03-01 15:11:21 +01:00
Guilherme Blanco
2372a85d9f Merge pull request #594 from v3labs/master
Use inflector in EntityGenerator
2013-02-28 16:02:20 -08:00
Vladislav Veselinov
30fd22a260 Use inflector for add/remove methods 2013-02-28 21:05:41 +02:00
Norbert Orzechowicz
f9519479fc Fix SimpleObjectHydrator behavior when column not exists in fieldMappings, relationMappings and metaMappings 2013-02-28 10:10:28 +01:00
Benjamin Eberlei
e5779a0756 Fix versionadded for IDENTITY() 2013-02-27 12:47:02 +01:00
Benjamin Eberlei
61e4413541 Update theme 2013-02-27 12:40:39 +01:00
Benjamin Eberlei
4f46a08d65 Dont mention 2.2 version in headers anymore. 2013-02-27 12:37:26 +01:00
Benjamin Eberlei
f001c31342 Add versionadded tags to many ffeatures in the docs. 2013-02-27 12:34:10 +01:00
Benjamin Eberlei
6b85d5b5ac Clarified versionadded on EntityListeners feature. 2013-02-27 12:19:08 +01:00
Guilherme Blanco
d5dd7d6f8a Merge pull request #589 from Ocramius/hotfix/DDC-2230
Hotfix for DDC-2230
2013-02-25 21:59:04 -08:00
Guilherme Blanco
32c220497c Merge pull request #585 from Ocramius/hotfix/DDC-2306
Hotfix/DDC-2306
2013-02-25 21:55:44 -08:00
Abdellatif Ait boudad
5206566707 Remove dead code 2013-02-26 00:02:34 +00:00
Marco Pivetta
350fa4f15b Applying fix for failing test for DDC-2230 2013-02-23 01:45:40 +01:00
Marco Pivetta
be24439e2f Adding failing test for DDC-2230
Proxies that implement the Doctrine\Common\PropertyChangedListener are getting eagerly
initialized because the UnitOfWork injects itself into them after they are created.
The test currently fails for what described above, and also verifies if the UoW
is correctly injected in the proxy during lazy loading.
2013-02-23 01:44:58 +01:00
Guilherme Blanco
97ff197198 Merge pull request #587 from stof/patch-1
Fixed the license and the added version for NewObjectExpression
2013-02-22 09:10:36 -08:00
Christophe Coevoet
16b407f535 Fixed the license and the added version 2013-02-22 17:57:50 +01:00
Benjamin Eberlei
8cfbe0c032 Merge pull request #586 from jsjohns/patch-1
Fix EntityManager doc
2013-02-21 14:56:59 -08:00
Joshua Johnson
b55d78e119 Fix EntityManager doc 2013-02-21 17:27:55 -05:00
Benjamin Eberlei
04b216426a Merge branch 'DDC-2310' 2013-02-21 19:02:37 +01:00
Benjamin Eberlei
8fce78fbfb [DDC-2310] Fix regression introduced in SQL Server lock handling. 2013-02-21 19:02:21 +01:00
Marco Pivetta
a5ece5063a Fixing DDC-2306 2013-02-21 02:24:48 +01:00
Marco Pivetta
d8dd5129e7 Failing test for DDC-2306
As of DDC-1734, proxies should have null identifier when the UnitOFWork
refreshes entities and replaces them (marking them as un-managed).
The problem here is that refreshes on entities with same identifier
but different type are still considered same, and the UnitOfWork discards
the proxy instance instead of ignoring it.
2013-02-21 02:21:06 +01:00
Benjamin Eberlei
2980d76adb Merge pull request #581 from Ocramius/hotfix/submodules-removal
Removing submodules
2013-02-15 09:41:38 -08:00
Marco Pivetta
3f16ec0d22 Removing submodules as of doctrine/doctrine2#570 2013-02-15 18:33:29 +01:00
Benjamin Eberlei
805bb5ff9f Remove mentions of PEAR installation method, remove code. 2013-02-15 01:04:29 +01:00
Benjamin Eberlei
6b928600ba Add vendor to .gitignore, add composer.lock and some weird submodule change 2013-02-15 00:49:48 +01:00
Benjamin Eberlei
19da1933a6 Fix dropping the theme folder. 2013-02-15 00:34:48 +01:00
Benjamin Eberlei
afee16e56b Merge pull request #406 from Ocramius/DCOM-96
[DCOM-96] Moving proxy generation and autoloading to common
2013-02-14 02:04:32 -08:00
Marco Pivetta
a58d4ae462 Cleaning up logic of the proxy factory by moving closure generation to own private methods 2013-02-14 10:52:13 +01:00
Marco Pivetta
271f5cf033 Adding fix and tests for DDC-1734 2013-02-14 09:57:12 +01:00
Marco Pivetta
8272ffd23f Proxy generation as of doctrine/common#168 - DCOM-96 2013-02-14 09:57:12 +01:00
Benjamin Eberlei
35fda90473 Merge pull request #570 from Ocramius/cleanup/submodules-removal
Deprecation of PEAR/GIT/TAR autoloading
2013-02-14 00:55:08 -08:00
Benjamin Eberlei
ce594fb152 [DDC-2256] Cleanup patch, move dependency on EntityManager out of ResultSetMapping and let AbstractQuery perform the translation. 2013-02-13 09:05:35 +01:00
Benjamin Eberlei
3d9cb9460a Fix test failing when memcache extension is installed, but memcache server isnt. 2013-02-13 08:46:37 +01:00
Fabio B. Silva
719031f2ef Merge pull request #569 from Ocramius/hotfix/pre-flush-event-args-params
Hotfix/pre flush event args params
2013-02-12 15:39:40 -08:00
Guilherme Blanco
39374b7235 Merge pull request #578 from BenMorel/docfix
Fix for wrong return types in documentation.
2013-02-12 09:05:13 -08:00
Benjamin Morel
35562d3a4d Unit tests: cleaned up outdated / unused / commented out code. 2013-02-12 15:51:24 +00:00
Benjamin Morel
cba1c8295c Fixed wrong return types in documentation. 2013-02-12 11:49:44 +00:00
Benjamin Eberlei
d08c010ae1 Merge pull request #576 from acasademont/patch-1
Update docs/en/reference/batch-processing.rst
2013-02-11 07:50:57 -08:00
Benjamin Eberlei
e86419cfa5 Merge pull request #575 from naitsirch/master
Added YAML configuration example for "Simple Derived Identity" in Docs
2013-02-11 07:50:08 -08:00
Alexander
14bc7f75be Add php 5.5 to the build matrix (travis) 2013-02-09 22:44:14 +01:00
Alexander
1a163cd48d [DDC-2019] Add support for expression in QueryBuilder#addOrderBy() 2013-02-09 22:40:34 +01:00
Alexander
9bf501dd25 Revert "allowed to pass filter objects to the configurator"
This reverts commit a9b4debe37. See the
discussion on the original PR:

https://github.com/doctrine/doctrine2/pull/434

Conflicts:
	lib/Doctrine/ORM/Configuration.php
2013-02-09 20:28:52 +01:00
Albert Casademont
4c90d0cedc Update docs/en/reference/batch-processing.rst
If you have only $batchSize - 1 rows (amongst other cases), the entities are never flushed, you need a final flush outside the loop.

In the bulk insert you should also need a final flush if the number of entities inserted is not a multiple of the $batchSize.
2013-02-08 16:32:03 +01:00
Christian Stoller
07616094d2 Added YAML configuration example for "Simple Derived Identity" in "Composite and Foreign Keys as Primary Key" Tutorial 2013-02-08 11:21:21 +01:00
Guilherme Blanco
3b0a242ab3 Merge pull request #573 from EvanK/patch-1
[Documentation] Noted prePersist event only triggers on first persist
2013-02-07 18:27:05 -08:00
Evan Kaufman
e2ac064914 Noted prePersist event only triggers on first persist
While probably obvious to a core doctrine developer, a user of doctrine would not necessarily know this without doing some digging
2013-02-07 12:59:14 -06:00
Marco Pivetta
673323fc67 Adding warnings about deprecation of GIT, TAR and PEAR autoloading 2013-02-04 23:30:02 +01:00
Marco Pivetta
a928ce48da Using composer autoloader for the test suite 2013-02-04 21:30:02 +01:00
Marco Pivetta
f281dbbf54 Fixing incorrect constructor params for PreFlushEventArgs 2013-02-04 20:46:51 +01:00
Marco Pivetta
3ebed101fd Strong typehinting to avoid incorrect constructor params 2013-02-04 20:45:58 +01:00
Guilherme Blanco
f0674ea034 Merge pull request #564 from BenMorel/f834c37f8a465ca3e23ee9ae62ef0bc4a525454c
Fix a wrong return type
2013-02-02 20:06:44 -08:00
Guilherme Blanco
114827a4b3 Merge pull request #565 from BenMorel/unusedvar
Removed an unused local variable.
2013-02-02 20:05:42 -08:00
Guilherme Blanco
d3cbdfcafa Merge pull request #566 from BenMorel/toolreturntype
Added missing return statement to AbstractCommand.
2013-02-02 20:04:30 -08:00
Guilherme Blanco
ef1ed588b5 Merge pull request #567 from BenMorel/uselessmethods
Removed outdated methods in DatabasePlatformMock
2013-02-02 20:03:26 -08:00
Benjamin Morel
ec1b47a3e8 Removed outdated methods in DatabasePlatformMock. 2013-02-03 01:51:05 +00:00
Benjamin Morel
2bfbe03e37 Fixed return statements in SchemaTool. 2013-02-03 01:42:27 +00:00
Benjamin Morel
4b58c6fc41 Removed an unused local variable. 2013-02-03 01:05:43 +00:00
Benjamin Morel
f834c37f8a Fixed a wrong return type. 2013-02-03 00:48:05 +00:00
Benjamin Eberlei
71a68a5c6f Merge pull request #423 from FabioBatSilva/DDC-1955
DDC-1955 - @EntityListeners
2013-02-02 11:47:46 -08:00
Guilherme Blanco
dea37ed9e8 Merge pull request #554 from beregond/hydrator-fix
Fixed ObjectHydrator when namespace alias is given.
2013-02-02 11:18:00 -08:00
Guilherme Blanco
abc3ba0c7e Merge pull request #561 from ftdebugger/master
fix typo in the documentation
2013-02-02 11:15:47 -08:00
Guilherme Blanco
4651d92d63 Merge pull request #562 from vrana/master
Fix error in QueryBuilder example
2013-02-02 11:15:30 -08:00
Guilherme Blanco
1627fc9596 Merge pull request #563 from FabioBatSilva/DDC-2268
DDC-2268 - Regression test
2013-02-02 11:15:14 -08:00
Fabio B. Silva
452e6912b1 DDC-2268 - regression test 2013-02-02 16:57:17 -02:00
Fabio B. Silva
c5aecd43c8 Fix yaml example 2013-02-02 16:19:35 -02:00
Fabio B. Silva
7764ed9a8b Docs for Entity Listener and Entity Listener Resolver 2013-02-02 15:48:40 -02:00
Jakub Vrana
819e5896bf Fix error in QueryBuilder example 2013-01-30 11:11:09 -08:00
Evgeny Shpilevsky
d65ba04c5c Fix typo in docs 2013-01-30 17:59:38 +03:00
Fabio B. Silva
76c4be1b74 Update docs/en/reference/events.rst
Docs for lifecycle-callback event arg
2013-01-29 12:19:47 -02:00
Fabio B. Silva
7177306536 remove extra comma 2013-01-29 12:14:53 -02:00
Fabio B. Silva
ec2d5af2c7 added missing file 2013-01-29 12:14:53 -02:00
Fabio B. Silva
e6d9d1de47 support naming convention for listeners without mapping. 2013-01-29 12:14:53 -02:00
Fabio B. Silva
46fea51622 use '!==' instead of '!=' 2013-01-29 12:14:53 -02:00
Fabio B. Silva
e9c89cafb9 Fix DocBlock 2013-01-29 12:14:53 -02:00
Fabio B. Silva
3f9a4c82b0 Fix typo 2013-01-29 12:14:53 -02:00
Fabio B. Silva
6d7b3863b5 Use bitmask of subscribed event systems. 2013-01-29 12:14:53 -02:00
Fabio B. Silva
7b0f59ed7c split override test 2013-01-29 12:14:53 -02:00
Fabio B. Silva
0d0fc320b4 Fix DocBlock 2013-01-29 12:14:53 -02:00
Fabio B. Silva
0d0f91a807 move listeners invocation from ClassMetadataInfo to ListenerInvoker 2013-01-29 12:14:53 -02:00
Fabio B. Silva
c60e3e4ba4 remove @LifecycleCallback 2013-01-29 12:14:52 -02:00
Fabio B. Silva
ffc8d032c7 Fix typo 2013-01-29 12:14:52 -02:00
Fabio B. Silva
195b639344 change xml driver to use <lifecycle-callback\> 2013-01-29 12:14:52 -02:00
Fabio B. Silva
6b7e588da5 fix CS 2013-01-29 12:14:52 -02:00
Fabio B. Silva
4be25cb330 small refactoring 2013-01-29 12:14:52 -02:00
Fabio B. Silva
8495eca1a4 rename test 2013-01-29 12:14:52 -02:00
Fabio B. Silva
a01d6583d3 implements a entity listener resolver 2013-01-29 12:14:52 -02:00
Fabio B. Silva
27745bb87b Fix some CS 2013-01-29 12:14:52 -02:00
Fabio B. Silva
a265511368 rename subscribers to listeners 2013-01-29 12:14:52 -02:00
Fabio B. Silva
46474bf457 added doctrine-mapping.xsd 2013-01-29 12:14:52 -02:00
Fabio B. Silva
69bfc71b6a test event listeners lifecycle callback 2013-01-29 12:14:52 -02:00
Fabio B. Silva
256cecbefa evaluate as lifecycle callback if the listener class is not given. 2013-01-29 12:14:52 -02:00
Fabio B. Silva
fd6f592430 support @LifecycleCallback in @EntityListeners 2013-01-29 12:14:52 -02:00
Fabio B. Silva
7021f002f2 php driver 2013-01-29 12:14:52 -02:00
Fabio B. Silva
415c2a95f2 php static driver 2013-01-29 12:14:52 -02:00
Fabio B. Silva
f0b04375de yaml driver 2013-01-29 12:14:52 -02:00
Fabio B. Silva
917aa70c97 test invalid class/method 2013-01-29 12:14:52 -02:00
Fabio B. Silva
7e54ae3702 xml driver 2013-01-29 12:14:52 -02:00
Fabio B. Silva
6be7a03b72 fix previous test 2013-01-29 12:14:52 -02:00
Fabio B. Silva
4cfe2294e3 test lifecycle callbacks event args 2013-01-29 12:14:52 -02:00
Fabio B. Silva
c6adcda567 give event to lifecycle callbacks 2013-01-29 12:14:52 -02:00
Fabio B. Silva
dbd0697c2c test @PostLoad 2013-01-29 12:14:51 -02:00
Fabio B. Silva
315f7ba43b call listeners in UoW 2013-01-29 12:14:51 -02:00
Fabio B. Silva
ccc0a2a94f test entity listener calls 2013-01-29 12:14:51 -02:00
Fabio B. Silva
c5d59ab4c7 test entity listener metadata 2013-01-29 12:14:51 -02:00
Fabio B. Silva
3c223a59c4 move call listeners tests to AbstractMappingDriverTest 2013-01-29 12:14:51 -02:00
Fabio B. Silva
0f081d7c45 support short class name 2013-01-29 12:14:51 -02:00
Fabio B. Silva
368cf73f89 entity listeners mapping 2013-01-29 12:14:51 -02:00
Guilherme Blanco
3d1956d260 Merge pull request #559 from Stroitel/fix-paginator
[Paginator] Added support for order by scalar
2013-01-27 08:58:14 -08:00
aleks
206c251090 Add test with mixed sort 2013-01-27 11:40:40 +02:00
aleks
dc190a297d Fix typo 2013-01-27 11:09:26 +02:00
Guilherme Blanco
8eee325db4 Merge pull request #558 from pkruithof/master
Added missing mapping types
2013-01-26 15:32:22 -08:00
aleks
6662096ed3 Fix typo 2013-01-26 23:27:38 +02:00
aleks
5e6bc0847f Added support for order by scalar 2013-01-26 21:31:45 +02:00
aleks
61634950f3 Add test for order by scalar 2013-01-26 21:21:09 +02:00
Peter Kruithof
46f4b00f8d Added missing mapping types 2013-01-26 16:18:45 +01:00
Szczepan Cieślik
92ada246b5 [DDC-2256] Code improvements. 2013-01-26 09:09:21 +01:00
Szczepan Cieślik
935594578a [DDC-2256] Code refactorization. 2013-01-25 13:15:14 +01:00
Szczepan Cieślik
d7f82221d1 [DDC-2256] Moved aliases translation to ResultSetMapping, fixed tests. 2013-01-25 12:06:13 +01:00
Szczepan Cieślik
1949ff8602 [DDC-2256] Added test for hydrator. 2013-01-24 23:10:50 +01:00
Szczepan Cieślik
23e0bb7345 Fixed ObjectHydrator when namespace alias is given. 2013-01-24 15:50:05 +01:00
Benjamin Eberlei
f5f583d1cc Fix .gitmodules 2013-01-24 00:17:32 +01:00
Benjamin Eberlei
cbcc693e36 Add 'docs/' from commit '8fcf2d45019bf38a1df728353a1e417343c69cfb'
git-subtree-dir: docs
git-subtree-mainline: 271bd37ad3
git-subtree-split: 8fcf2d4501
2013-01-24 00:02:03 +01:00
Benjamin Eberlei
8fcf2d4501 Merge pull request #143 from relo-san/patch-1
Update en/reference/query-builder.rst
2013-01-23 14:51:49 -08:00
Benjamin Eberlei
94526ab602 Merge pull request #145 from HoffmannP/master
key for yaml-files was changed, know Idea what it might affect as well
2013-01-23 14:51:12 -08:00
Benjamin Eberlei
a512c7f89a Merge pull request #152 from pkruithof/patch-1
Documented `guid` mapping type
2013-01-23 14:49:27 -08:00
Peter Kruithof
f5ba83cae5 Documented guid mapping type
refs #456a756febb258b52092fa2640c77bb8400114fa
2013-01-21 15:03:46 +01:00
Benjamin Eberlei
271bd37ad3 Merge branch 'DDC-2243' 2013-01-20 20:32:54 +01:00
Benjamin Eberlei
eedf85cbdb [DDC-2243] Fix bug where a bigint identifier would be casted to an integer, causing inconsistency with the string handling. 2013-01-20 20:31:22 +01:00
Benjamin Eberlei
3c157eafd5 Merge branch 'DDC-2246' 2013-01-20 20:11:20 +01:00
Benjamin Eberlei
5298c03fce [DDC-2246] Fix bug with UnitOfWork#getEntityState() and entities with foreign identifier. 2013-01-20 20:11:08 +01:00
Benjamin Eberlei
916424af49 Merge pull request #551 from FabioBatSilva/DDC-2234
[DDC-2234] FUNCTION() IS NULL comparison
2013-01-20 03:30:01 -08:00
Benjamin Eberlei
d0810c7c19 Remove README.markdown from .gitattributes 2013-01-19 20:04:43 +01:00
Benjamin Eberlei
3a4331db89 Merge pull request #543 from carlosbuenosvinos/master
Make doctrine a Light-weight distribution package in Composer
2013-01-19 11:04:16 -08:00
Fabio B. Silva
93fba518a6 keep braces 2013-01-19 13:38:44 -02:00
Fabio B. Silva
1d42a5385b test NOT EXISTS expression 2013-01-18 23:47:31 -02:00
Fabio B. Silva
4dcd5a1286 Fix DDC-2234 2013-01-18 23:18:50 -02:00
Jonathan H. Wage
c4b0bc5adc Merge pull request #150 from shiroyuki/patch-1
Correct the usage for "nullable"
2013-01-16 13:00:42 -08:00
Juti Noppornpitak
ec23961c7d Update en/cookbook/decorator-pattern.rst 2013-01-16 15:48:15 -05:00
Jonathan H. Wage
27ac88fe28 Update theme again. 2013-01-14 20:12:20 -06:00
Jonathan H. Wage
b369158dc6 Upgrade theme. 2013-01-14 20:08:25 -06:00
Jonathan H. Wage
16533299b0 Update en/reference/installation.rst
Remove reference to download page as it does not exist anymore. We are no longer maintaining packages for download in any proprietary Doctrine repository.
2013-01-14 18:47:18 -06:00
Guilherme Blanco
b30b06852b Merge pull request #549 from FabioBatSilva/DDC-1376
[DDC-1376] Support for order by association when using findBy
2013-01-13 17:16:50 -08:00
Fabio B. Silva
6074755b91 Fix DDC-1376 2013-01-13 22:39:59 -02:00
Jonathan H. Wage
8230b270e3 Merge pull request #148 from FabioBatSilva/composite-identity
Docs for IDENTITY() composite primary key
2013-01-13 10:14:43 -08:00
Jonathan H. Wage
66774f8fe0 Merge pull request #149 from FabioBatSilva/new-operator
Docs for “NEW” Operator Syntax
2013-01-13 10:14:32 -08:00
Fabio B. Silva
6a23e6be96 Docs for “NEW” Operator Syntax 2013-01-13 15:56:11 -02:00
Fabio B. Silva
939ca1b85f Docs for IDENTITY() composite primary key 2013-01-13 15:08:25 -02:00
Benjamin Eberlei
47043a54a5 Update en/reference/filters.rst 2013-01-13 09:37:45 +01:00
Benjamin Eberlei
6f572a61c7 Merge branch 'DDC-2231' 2013-01-12 10:29:20 +01:00
Benjamin Eberlei
3ccbbcb0b5 DDC-2231 - Simplify test 2013-01-12 10:29:11 +01:00
Guilherme Blanco
71efe2109a Merge pull request #548 from nemekzg/DDC-2203
Fix for DDC-2203
2013-01-10 11:13:18 -08:00
nemekzg
cfd1b07ffe Fix for DDC-2203 2013-01-10 16:52:19 +01:00
Stefan Kleff
6032e3efd8 Added test 2013-01-10 16:10:29 +01:00
Stefan Kleff
dc925cc9c5 fixed indentation
Restored old way of injection to just inject it during a refresh
Added injection for initialized proxies
2013-01-10 15:19:44 +01:00
Stefan Kleff
151192ae37 The EntityManager was not injected in uninitialized proxys which are ObjectManagerAware.
I ran into that problem while I had two objects in the identitymap while hydrating a collection: one was new a "real" entity and the other one was an uninitialized proxy. For "real" entities the em is injected in line 2427, for new entities it is injected in 2436->2364, but for proxies this is missing. According to the comment "inject ObjectManager into just loaded proxies." the code in line 2427 should do this, but in fact it is just used if it is a "real" entity or an already initialized proxy. Moving the injection to outside of the condition in line 2411 (if the entity is an unitialized proxy) solves this.
2013-01-10 14:54:52 +01:00
Benjamin Eberlei
0b2d3d4f5d DDC-2173 - Correct issue is about "postFlush" not "preFlush" and add test 2013-01-06 19:16:12 +01:00
Benjamin Eberlei
c20cfed6ae Merge branch 'DDC-2173' 2013-01-06 19:12:02 +01:00
Benjamin Eberlei
512a001e8c DDC-2173 - Add Test for new OnFlush or PreFlush behavior and update UPGRADE.md 2013-01-06 19:11:52 +01:00
Francesc Rosàs
1e669132c2 No huge if clause 2013-01-06 19:05:46 +01:00
Francesc Rosàs
9322ca7052 Ensure onFlush and postFlush events are always raised 2013-01-06 19:05:46 +01:00
Benjamin Eberlei
ce290bc99b DDC-1698 - Allow autoload registration from a Configuration instance 2013-01-06 11:07:19 +01:00
Benjamin Eberlei
7dfe0cae08 DDC-1698 - Prepend autoloader to stack and fix CS 2013-01-06 11:03:58 +01:00
Benjamin Eberlei
4210969087 DDC-2192 - Prevent using append flag in case of where and having to avoid user confusion, because this is not allowed. 2013-01-06 10:33:57 +01:00
Benjamin Eberlei
32f4be83b1 Fix composer to only allow DBAL 2.4 DEV and larger 2013-01-06 10:06:03 +01:00
Guilherme Blanco
fbd1e7bc45 Merge pull request #147 from aaronmu/master
Fix syntax error in one of the orderBy examples.
2013-01-04 06:22:22 -08:00
Aaron Muylaert
b0a24c8baa Update en/reference/query-builder.rst
Fix syntax error in one of the orderBy examples.
2013-01-04 11:29:34 +01:00
Carlos Buenosvinos
1b5d4316fe Update .gitattributes
Fix TYPO
2012-12-29 21:08:21 +01:00
Carlos Buenosvinos
2eb4849a69 XSD, license and upgrade should be distributed 2012-12-28 16:55:49 +01:00
Carlos Buenosvinos
9354e70fd3 Make doctrine a light-weight package based in http://getcomposer.org/doc/02-libraries.md#light-weight-distribution-packages 2012-12-28 16:46:41 +01:00
Carlos Buenosvinos
0577f73ef5 Make doctrine light-weight for composer 2012-12-28 16:41:38 +01:00
Benjamin Eberlei
90b6d5e293 Merge branch 'master' of github.com:doctrine/doctrine2 2012-12-24 10:40:52 +01:00
Benjamin Eberlei
59ffbd5f8d Merge branch 'DDC-2175' 2012-12-24 10:40:10 +01:00
Benjamin Eberlei
e2c1ff1a48 [DDC-2175] Fix bug in JoinedSubclassPersister 2012-12-24 10:39:23 +01:00
Benjamin Eberlei
904effcf4e Merge pull request #538 from FabioBatSilva/identity-composite-key
IDENTITY() Support composite primary key
2012-12-24 01:19:05 -08:00
Benjamin Eberlei
7cf26950cc Merge branch 'DDC-2187' 2012-12-24 10:15:47 +01:00
Klein Florian
8443eee628 use base events 2012-12-24 10:15:25 +01:00
Benjamin Eberlei
e319e34783 Merge pull request #528 from BenMorel/master
Documentation fixes
2012-12-23 12:22:09 -08:00
Benjamin Eberlei
d8b94b0527 Some text refactorings in tutorial 2012-12-23 13:05:54 +01:00
Fabio B. Silva
3d99711ac8 fix PHPDoc 2012-12-22 10:36:23 -02:00
Fabio B. Silva
99ab58febd Fix CS 2012-12-22 10:36:23 -02:00
Fabio B. Silva
2e90cd9924 Identity function support composite primary key 2012-12-22 10:36:23 -02:00
Benjamin Eberlei
6f5948746e Merge pull request #540 from FabioBatSilva/DDC-2208
[DDC-2208] Fix DDC-2208
2012-12-22 03:53:14 -08:00
Benjamin Eberlei
015771f10b Merge pull request #541 from PSchwisow/master
Fix DDC-1690
2012-12-22 03:38:03 -08:00
Patrick Schwisow
0b21046fce [DDC-1690] Added an empty line as requested. 2012-12-21 15:35:32 -06:00
Patrick Schwisow
bc6921504a [DDC-1690] Created unit test 2012-12-21 14:32:10 -06:00
Fabio B. Silva
b6b493f450 test parentheses 2012-12-21 10:00:40 -02:00
Fabio B. Silva
eda43c77bb Fix DDC-2208 2012-12-21 10:00:40 -02:00
Guilherme Blanco
a8340cc980 Merge pull request #146 from noginn/patch-1
Added missing "new" keyword for event listener
2012-12-21 03:46:51 -08:00
Guilherme Blanco
8b5e4a9a52 Merge pull request #542 from FabioBatSilva/DDC-2205
[DDC-2205] Fix DDC-2205
2012-12-21 03:45:07 -08:00
Fabio B. Silva
2104ae9935 fix DDC-2205 2012-12-20 23:06:30 -02:00
Patrick Schwisow
5627993827 Fix DDC-1690
Added the lines suggested by the original reporter.
2012-12-20 15:31:46 -06:00
Tom Graham
e17fc6c474 Added missing "new" keyword for event listener 2012-12-20 20:00:50 +00:00
Thomas Rothe
86c33d78d0 inheritance with composite keys
added tests for single table inheritance
2012-12-17 11:01:20 +01:00
Thomas Rothe
fb055ca75d fixed problems with joined inheritance and composite keys
SchemaTool now creates all Id columns not just only the first one.
Insert statement for child entity now contains parameter for additional key columns only once.
2012-12-16 18:20:10 +01:00
Benjamin Eberlei
4bbfe0ce8a Merge pull request #536 from KonstantinKuklin/master
add missed branch
2012-12-16 04:05:57 -08:00
Benjamin Eberlei
b6fd203355 Merge branch 'DDC-2199' 2012-12-16 12:58:01 +01:00
Benjamin Eberlei
7c337748b6 DDC-2199 / DDC-2192 - Versioned fields didnt work in XML/YAML mapping 2012-12-16 12:57:53 +01:00
Benjamin Morel
774bb3fec4 Fixed missed documentation issues in Doctrine\ORM 2012-12-14 20:12:56 +00:00
Benjamin Morel
aadce3c747 Fixed documentation for Doctrine\Tests 2012-12-14 18:55:49 +00:00
Benjamin Morel
c405f6d3f6 Fixed documentation for Doctrine\Tests\Mocks 2012-12-14 18:55:28 +00:00
Benjamin Morel
76f2ba50eb Fixed documentation for Doctrine\Tests\DbalTypes 2012-12-14 18:55:16 +00:00
Konstantin Kuklin
8e2c060fc7 add missed branch 2012-12-14 18:04:19 +04:00
Benjamin Morel
ad967e8e22 Fixed documentation for Doctrine\ORM\Tools\Pagination 2012-12-14 13:13:22 +00:00
Benjamin Morel
2524c878b6 Fixed documentation for Doctrine\ORM\Tools\Export 2012-12-14 13:02:12 +00:00
Benjamin Morel
0122d8d36c Fixed documentation for Doctrine\ORM\Tools\Event 2012-12-14 12:49:59 +00:00
Benjamin Morel
71e78014e5 Fixed documentation for Doctrine\ORM\Tools\Console 2012-12-14 12:49:05 +00:00
Benjamin Morel
e72445b836 Fixed documentation for Doctrine\ORM\Tools 2012-12-13 18:55:44 +00:00
Benjamin Morel
7869ec714d Fixed unused 'use' statements.
Fixed missed documentation issues in Doctrine\ORM
2012-12-13 18:19:21 +00:00
Peter Hoffmann
4c1759eecb Keyname was obviously changed in (latest) 2.3.1, cost me some hours to figure out, NOT cool! 2012-12-13 17:53:44 +01:00
Benjamin Morel
ba16789843 Fixed documentation for Doctrine\ORM\Query 2012-12-13 16:36:14 +00:00
Benjamin Morel
28966e2087 Fixed documentation for Doctrine\ORM\Query\Expr and Doctrine\ORM\Query\Filter 2012-12-13 12:05:34 +00:00
Benjamin Morel
d4357801a2 Fixed documentation for Doctrine\ORM\Query\Exec 2012-12-13 11:57:46 +00:00
Benjamin Morel
98ac6b5fec Fixed documentation for Doctrine\ORM\Query\AST 2012-12-13 11:52:19 +00:00
Benjamin Morel
f743da0e02 Fixed documentation for Doctrine\ORM\Query\AST\Functions 2012-12-13 10:42:25 +00:00
Benjamin Morel
42e83a2716 Fixed documentation for ORM\Proxy 2012-12-13 10:28:55 +00:00
Mykola Zyk
ca1c6498ec Update en/reference/query-builder.rst
Adding note for $append parameter of QueryBuilder::add() method.
2012-12-07 19:44:47 +02:00
Benjamin Eberlei
df1336dd26 Merge pull request #529 from francisbesset/options_join_columns
[DDC-2182] Options join columns
2012-12-04 04:29:01 -08:00
Francis Besset
657a54da84 Passed column options to the join column 2012-12-04 12:26:40 +01:00
Francis Besset
df2bfbb636 Fixed trailing spaces on SchemaTool 2012-12-04 12:23:55 +01:00
Benjamin Morel
43b301f22b Fixed English mistakes 2012-12-03 11:02:29 +00:00
Benjamin Morel
159ece8943 Fixed documentation for ORM\Persisters 2012-12-03 10:15:43 +00:00
Benjamin Morel
46e6ada4f9 Fixed documentation for ORM\Mapping 2012-12-03 09:36:08 +00:00
Guilherme Blanco
4b4126dfa6 Merge pull request #142 from pborreli/typos
Fixed typos
2012-12-02 12:41:07 -08:00
Benjamin Morel
4714a53c32 Fixed documentation for ORM\Internal 2012-12-02 19:46:34 +00:00
Pascal Borreli
8717088ed1 Fixed typos 2012-12-02 17:58:15 +00:00
Benjamin Morel
fad22d1e60 Fixed documentation for ORM\Event and ORM\Id 2012-12-02 12:37:56 +00:00
Francis Besset
56b230a1f0 Fixed typo 2012-12-01 19:41:51 +01:00
Benjamin Morel
dacdd6cd89 Documentation (docblock) fixes. 2012-12-01 16:28:06 +00:00
Guilherme Blanco
4bb6ff637c Merge pull request #527 from BenMorel/master
Fix documentation for Doctrine\ORM\Query\AST\Node::dispatch()
2012-11-30 12:43:49 -08:00
Benjamin Morel
26d6f5ce4e Fixed coding standard issue, as per @stof's request. 2012-11-30 19:10:53 +00:00
Benjamin Morel
5edc287848 Fixed documentation for Doctrine\ORM\Query\AST\Node::dispatch(). 2012-11-30 11:41:03 +00:00
Benjamin Eberlei
95334e9764 Clarify BC break in DDC-2156 2012-11-27 22:25:58 +01:00
Guilherme Blanco
29f0b678cf Merge pull request #526 from FabioBatSilva/DDC-2172
[DDC-2172] Fix EntityGenerator get literal type
2012-11-27 12:14:12 -08:00
Guilherme Blanco
f4c0fd1744 Added support to subselects in update item. 2012-11-27 14:36:56 -05:00
Fabio B. Silva
bac92f4d3e Fix CS 2012-11-27 16:58:48 -02:00
Fabio B. Silva
d1dc72b65a refactoring tests 2012-11-27 14:38:18 -02:00
Fabio B. Silva
41b907606f Fix DDC-2172 2012-11-27 14:29:02 -02:00
Benjamin Eberlei
46e6753649 Merge pull request #523 from jankramer/DDC-2074
[DDC-2074] Bugfix regarding clearing cloned PersistentCollections
2012-11-25 11:13:28 -08:00
Jan Kramer
5b3f54429a [DDC-2074] Fixed bug regarding clearing PC's without owner
When calling clear on a PC that has no owner (e.g. because it was
cloned), it can't be deleted as there is no metadata available.
In these cases, it shouldn't be scheduled for deletion.
2012-11-25 19:27:39 +01:00
Jan Kramer
9b78100378 [DDC-2074] Added test for PersistentCollection#clear. 2012-11-25 19:27:24 +01:00
Benjamin Eberlei
05e5ae8bfa Merge pull request #413 from FabioBatSilva/refactory-persisters
code refactorings on persister
2012-11-25 03:50:52 -08:00
Benjamin Eberlei
173333c861 Merge pull request #517 from nemekzg/DDC-1765
Fix for DDC-1765
2012-11-25 03:38:39 -08:00
Benjamin Eberlei
072d8a8a13 Merge pull request #515 from tranver/master
Fixes sandbox cli: The helper "em" is not defined.
2012-11-25 03:38:03 -08:00
Benjamin Eberlei
8457a9e77e Merge pull request #518 from Fran6co/fix-double-on
regression fix for left joins (double ON)
2012-11-25 03:27:17 -08:00
Benjamin Eberlei
390fbd8493 Merge pull request #87 from FabioBatSilva/patch-6
docs for association/attribute override
2012-11-24 02:34:56 -08:00
Benjamin Eberlei
1f2050f20d Merge pull request #101 from merk/rtel
Initial ResolveTargetEntityListener cookbook entry
2012-11-24 02:34:36 -08:00
Benjamin Eberlei
7f0ff6a079 Merge pull request #104 from shieldo/missing_joincolumn_in_yaml
added missing JoinColumn node for xml and yaml for many-to-one unidirect...
2012-11-24 02:34:17 -08:00
Benjamin Eberlei
bc9c7d1c07 Merge pull request #117 from cordoval/feature/addTutorialOverrideMappingAnnotations
[DDC-1872] add tutorial for override annotations mappings
2012-11-24 02:33:58 -08:00
Benjamin Eberlei
9f86cda681 Merge pull request #119 from Spabby/master
Cleaner to remove the note, and modify the code to put the doctrine_bootstrap.php include first?
2012-11-24 02:25:17 -08:00
Benjamin Eberlei
52bc9a82ef Merge pull request #121 from frosas/document-pre-and-post-flush-events
Remove "before the lists of scheduled changes are cleared"
2012-11-24 02:24:57 -08:00
Benjamin Eberlei
d84462923c Merge pull request #122 from kdambekalns/patch-1
Update en/reference/working-with-associations.rst
2012-11-24 02:24:10 -08:00
Benjamin Eberlei
106620e6dd Merge pull request #123 from bamarni/patch-4
simplified interface check
2012-11-24 02:23:55 -08:00
Benjamin Eberlei
0cfc7dd402 Merge pull request #124 from bamarni/patch-5
fixed typo
2012-11-24 02:23:41 -08:00
Benjamin Eberlei
ced44e1916 Merge pull request #125 from Ocramius/patch-4
Update en/reference/tools.rst
2012-11-24 02:22:30 -08:00
Benjamin Eberlei
9873c9fc04 Merge pull request #127 from lennerd/fix-typo-1
Fixed typo for array mapping type
2012-11-24 02:22:12 -08:00
Benjamin Eberlei
07e6a3ec68 Merge pull request #129 from md2perpe/patch-1
Update en/tutorials/getting-started.rst
2012-11-24 02:22:01 -08:00
Benjamin Eberlei
24228711fd Merge pull request #133 from Ocramius/patch-5
Removing removed API description from docs
2012-11-24 02:21:53 -08:00
Benjamin Eberlei
4a01d2904c Merge pull request #138 from fulopattila122/master
The yaml mapping part probably shows the path/Namespace key-value pair in the wrong order
2012-11-24 02:21:43 -08:00
Guilherme Blanco
697e7b1ca5 Merge pull request #471 from chives/DDC-2052
Extended TreeWalker interface with getQueryComponents() and setQueryComponent() which are used by the Parser class
2012-11-22 07:39:59 -08:00
Francisco Facioni
c84099508f added outer left join 2012-11-22 09:59:44 -03:00
Francisco Facioni
9c59ed5891 regression fix for left joins (double ON) 2012-11-20 12:30:52 -03:00
Guilherme Blanco
f7e9a91b5c Merge pull request #141 from hifi7/patch-1
Fix wrong date format in example PrePersist method
2012-11-20 07:01:03 -08:00
Lukasz Cybula
afdb92ff9b Added note about new methods in UPGRADE.md 2012-11-20 12:42:05 +01:00
Lukasz Cybula
08a3423ce2 CS fixes 2012-11-20 12:42:05 +01:00
Lukasz Cybula
7b1d84cbdb Moved CustomTreeWalkersJoinTest to proper namespace and fixed licence 2012-11-20 12:42:05 +01:00
Lukasz Cybula
2c99ecf586 Extended TreeWalker interface with getQueryComponenets() and setQueryComponent() which are used by the Parser class 2012-11-20 12:42:05 +01:00
hifi7
f221faff28 Fix wrong date format in example PrePersist method 2012-11-20 05:37:43 +01:00
Benjamin Eberlei
f25b098029 [DDC-2055] Add Test for EntityRepository#createResultSetMappingBuilder 2012-11-19 17:45:14 +01:00
Benjamin Eberlei
941670aa9d [DDC-2055] Add EntityRepository#createResultSetMappingBuilder() 2012-11-19 17:09:18 +01:00
Benjamin Eberlei
17bb564534 [DDC-2055] Some adjustments to ResultSetMappingBuildder patch 2012-11-19 16:54:56 +01:00
nemekzg
727647902c Fix for DDC-1765 2012-11-17 16:18:18 +01:00
Benjamin Eberlei
9ea40edb48 Discuss branching strategy 2012-11-17 10:48:46 +01:00
Benjamin Eberlei
3666d1485a Merge pull request #516 from lstrojny/bug/phpunit-composer
Allow running tests with composer
2012-11-17 01:25:16 -08:00
Benjamin Eberlei
2a69d2d1f9 Update Common dependency 2012-11-17 09:52:11 +01:00
Lars Strojny
bb3eeffe78 Allow running tests with composer 2012-11-17 03:41:32 +01:00
Chris Schuhmann
1d04902326 Fix sandbox cli
In afd8ea9 $helpers became an instance of HelperSet and caused an "The helper "em" is not defined." exception.
2012-11-17 00:12:29 +01:00
Guilherme Blanco
30bddbd254 Merge pull request #139 from jorns/master
Update the i in index to uppercase
2012-11-16 11:26:02 -08:00
jorns
072a65bd26 Updated @Index lower i to Upper i
This fixes the error:
[Semantical Error] The annotation "@Doctrine\ORM\Mapping\index"
2012-11-16 11:21:06 +01:00
Benjamin Eberlei
0782b8a682 Expanded first paragraphs 2012-11-16 00:08:25 +01:00
Benjamin Eberlei
da6236f830 More on testing 2012-11-16 00:01:37 +01:00
Benjamin Eberlei
6821e633fd Add CONTRIBUTING.md 2012-11-15 23:57:34 +01:00
Benjamin Eberlei
d0428df9bd Merge pull request #513 from FabioBatSilva/annot-enum
Enumeration support
2012-11-15 10:52:14 -08:00
Fabio B. Silva
77827303d2 Fix CS 2012-11-13 14:54:37 -02:00
Fabio B. Silva
c1de4c5fda update doctrine-common 2012-11-13 14:13:49 -02:00
Fabio B. Silva
a07c63dde6 added support for @Enum 2012-11-13 14:13:48 -02:00
Benjamin Eberlei
0d58e6627a Merge branch 'DDC-2109' 2012-11-12 15:48:19 +01:00
Benjamin Eberlei
f453d6c85b [DDC-2109] Fix bug with ResolveTargetEntityListener and ManyToMany associations. 2012-11-12 15:48:10 +01:00
Benjamin Eberlei
918ea1cdd8 Merge pull request #449 from mvrhov/DDC-1958
Pager fix for DDC-1958
2012-11-12 06:02:32 -08:00
Benjamin Eberlei
935842845b Merge branch 'DDC-2138' 2012-11-12 15:01:30 +01:00
Benjamin Eberlei
624ef309f0 Remove unnecssary code 2012-11-12 15:01:20 +01:00
Benjamin Eberlei
5e2a433828 Inlined Test and Entities into DDC2138Test 2012-11-12 14:59:48 +01:00
Stefano Rodriguez
482da95352 The schema tool now doesn't add a foreign constraint when subclassess of a STI use the same field to map relations with entities of different classes 2012-11-12 14:59:48 +01:00
Stefano Rodriguez
b1c69ebab9 adedd failing test for PR #440 2012-11-12 14:19:31 +01:00
Miha Vrhovnik
8fe9fa0dc7 extracted pgsql sql generation into a helper method 2012-11-12 13:48:55 +01:00
Miha Vrhovnik
c7a75f477f The distinct query should replicate the fields in order by clause and the order by clause itself from inner query
This fixes DDC-1958
2012-11-12 13:18:46 +01:00
Benjamin Eberlei
4e04daaed4 Merge pull request #466 from ethanresnick/patch-1
Use `protected` so EntityGenerator can be extended
2012-11-12 04:05:23 -08:00
HarmenM
b6b75d3a27 Modified the WhereInWalkerTest to be compatible with a single InputParameter. 2012-11-12 12:30:03 +01:00
HarmenM
8a29d91d15 Update lib/Doctrine/ORM/Tools/Pagination/Paginator.php
Replaced the foreach loop adding all IDs as single parameters with a single parameter which injects the IDs as an array.
2012-11-12 12:30:03 +01:00
HarmenM
88d0933a6e Update lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php
replaced the for-loop which adds the InputParameters for a single InputParameter for use with an array instead of a set of scalars.
2012-11-12 12:30:03 +01:00
Benjamin Eberlei
a0e8ca128c Merge pull request #482 from Halleck45/cli-customizable
user can set its own commands in the cli-config.php file
2012-11-12 03:13:34 -08:00
Benjamin Eberlei
79315cb7de Merge pull request #510 from ruian/patch-2
CS on QueryBuilder
2012-11-12 02:52:54 -08:00
Benjamin Eberlei
ccfd2adf5b Merge pull request #511 from Ocramius/hotfix/console-runner-version
Fixing reference to Doctrine\ORM\Version
2012-11-12 02:42:30 -08:00
Marco Pivetta
7520a745c2 Fixing reference to Doctrine\ORM\Version 2012-11-12 11:31:19 +01:00
Julien 'ruian' Galenski
055d7f261c CS on queryBuilder 2012-11-12 10:23:50 +01:00
Attila Fulop
3cee83be2b Swapped order of path/Entities at Simplified YAML Driver
According to my experience, the path has to be the key, and Namespace prefix the value in the array.
2012-11-11 21:19:18 +02:00
Benjamin Eberlei
fa3f1e088d Add test for boolean parameter type infering 2012-11-09 22:03:40 +01:00
Guilherme Blanco
2edccbfbc8 Merge pull request #137 from Squazic/patch-1
Grammar fix
2012-11-09 09:48:59 -08:00
Squazic
56eec8979b Grammar fix 2012-11-09 11:55:34 -05:00
Guilherme Blanco
182ed07a41 Merge pull request #509 from smottt/master
SchemaTool ignoring 'fixed' option
2012-11-07 13:58:56 -08:00
Guilherme Blanco
af39687f45 Merge pull request #135 from nanocom/patch-1
Fixed typo
2012-11-07 13:58:05 -08:00
Arnaud Kleinpeter
9f898b0b90 Update en/tutorials/getting-started.rst 2012-11-07 22:31:40 +01:00
Metod
cfee331006 SchemaTool ignoring 'fixed' option fixed 2012-11-07 16:31:31 +01:00
Guilherme Blanco
09d53f0e58 Merge pull request #508 from mnapoli/DDC-2073
Fix and test for DDC-2073
2012-11-06 14:52:34 -08:00
Matthieu Napoli
c2d9197900 Fix and test for DDC-2073 2012-11-06 15:12:19 +01:00
Matthieu Napoli
e15cf324c3 Fix and test for DDC-2073 2012-11-06 15:05:53 +01:00
Fabio B. Silva
122569eee0 Fix CS 2012-11-05 22:52:43 -02:00
Fabio B. Silva
0fa89647d2 Fix DocBlock 2012-11-05 22:52:42 -02:00
Fabio B. Silva
ecaa3fd03e Third round of refactorings on BasicEntityPersister 2012-11-05 22:52:42 -02:00
Fabio B. Silva
c8899c2b3b second round of CS fixes 2012-11-05 22:52:42 -02:00
Fabio B. Silva
a295525501 Fix some CS 2012-11-05 22:52:41 -02:00
Fabio B. Silva
827153624c Second round of refactorings on BasicEntityPersister 2012-11-05 22:52:41 -02:00
Fabio B. Silva
04e1838c92 change 'use' statements 2012-11-05 22:52:41 -02:00
Fabio B. Silva
14a2b61671 code refactoring on SingleTablePersister 2012-11-05 22:52:40 -02:00
Fabio B. Silva
9a041c8fdb code refactoring on OneToManyPersister 2012-11-05 22:52:40 -02:00
Fabio B. Silva
2b1aaebe18 code refactoring on ManyToManyPersister 2012-11-05 22:52:40 -02:00
Fabio B. Silva
07492bda9d fix JoinedSubclassPersister#delete when supports foreign key 2012-11-05 22:52:39 -02:00
Fabio B. Silva
3156c1549d code refactoring on JoinedSubclassPersister 2012-11-05 22:52:39 -02:00
Fabio B. Silva
308b54a8f3 code refactoring on BasicEntityPersister 2012-11-05 22:52:39 -02:00
Fabio B. Silva
7e348b7815 small refacory on AbstractEntityInheritancePersister 2012-11-05 22:50:24 -02:00
Fabio B. Silva
e6f08f0b92 remove '_' prefix at AbstractCollectionPersister 2012-11-05 22:50:23 -02:00
Fabio B. Silva
b998a522b0 remove '_' prefix at BasicEntityPersister 2012-11-05 22:50:23 -02:00
Guilherme Blanco
d6d5c341e2 Merge pull request #486 from FabioBatSilva/DDC-2084
Fix DDC-2084
2012-11-05 16:38:35 -08:00
Guilherme Blanco
262c3eea6b Merge pull request #506 from FabioBatSilva/DDC-2121
Fix DDC-2121
2012-11-05 16:27:34 -08:00
Fabio B. Silva
62f43e6ea2 remove require_once 2012-11-05 22:23:44 -02:00
Fabio B. Silva
c4e6a04676 remove duplicate return statement 2012-11-05 22:23:44 -02:00
Fabio B. Silva
a09a5b9b7b Fix DDC-2084 2012-11-05 22:23:44 -02:00
Guilherme Blanco
57e5fa9873 Merge pull request #496 from arse/master
Testing for key existance in basicEntityPersister / getIndividualValue
2012-11-05 16:20:26 -08:00
Guilherme Blanco
a44579303c Merge pull request #493 from nmpolo/codegenerationfixes
Do not add trailing whitespace to blank lines
2012-11-05 16:19:39 -08:00
Guilherme Blanco
863d14a61a Merge pull request #503 from sebastianbauer/master
added unsigned mapping to SchemaTool options
2012-11-05 16:16:25 -08:00
Guilherme Blanco
7a895209e3 Merge pull request #502 from gwis/master
Fix for invalid 'double-ON' SQL generation with entity inheritance type JOINED.
2012-11-05 16:15:45 -08:00
Guilherme Blanco
283ed55824 Merge pull request #504 from nemekzg/DDC-1241
Proposed fix for DDC-1241
2012-11-05 16:14:48 -08:00
Guilherme Blanco
6949a95782 Merge pull request #505 from BenMorel/fix-errors
Fix errors in JoinClassPathExpression and SqlWalker
2012-11-05 16:12:31 -08:00
Fabio B. Silva
2f7e970c5f Fix DDC-2121 2012-11-05 21:53:07 -02:00
Benjamin Morel
88b29a4e59 Fixed errors:
- Typo in variable name in JoinClassPathExpression;
 - Undefined class AST\ArithmeticPrimary (x2);
 - QueryException::invalidPathExpression() expects a PathExpression, not a string.
2012-11-05 14:45:57 -08:00
nemekzg
9705ee89d9 Proposed fix for DDC-1241 2012-11-05 19:55:54 +01:00
Sebastian Bauer
a27be2fab6 added unsigned mapping to SchemaTool options 2012-11-05 19:49:16 +01:00
Gordon Stratton
9e916a2893 Fix for invalid 'double-ON' SQL generation with entity inheritance type JOINED.
In SqlWalker::walkJoin(), SqlWalker::walkRangeVariableDeclaration() can be
called which may produce an 'ON' clause if the entity inheritance type is
JOINED. As walkJoin() may then produce another ON clause, this results in
invalid SQL (e.g. '... ON foo = bar ON (baz = quux) ...' when the inheritance
type is JOINED.

This adds a test and a fix for the problem, by checking for an inheritance type
of JOINED in walkJoin() and using AND instead of ON in the appropriate place.

It seems like this part of the code is begging to be refactored. This is my
first foray into Doctrine internals and can't see a way to do this without
stomping all over the rest of the code, but this section seems ripe for cleanup
by somebody who is familiar.
2012-11-05 01:19:25 -08:00
Guilherme Blanco
ff80e99cc9 Merge pull request #501 from jeremymarc/patch-1
Allow 0 id for Entity
2012-11-04 19:22:57 -08:00
Jeremy Marc
26dd533662 Compare to null instead of using isset 2012-11-04 19:04:13 -08:00
Jeremy Marc
84477440b6 Allow 0 id for Entity
When using a 0 id, it's throwing InvalidArgumentException (Binding entities to query parameters only allowed for entities that have an identifier.)
2012-11-04 17:41:08 -08:00
Nick Masters
e402a0c078 Spaces around ! sign 2012-11-04 15:22:32 +00:00
Nick Masters
3a8ea7260c Merge remote-tracking branch 'origin/master' into codegenerationfixes 2012-11-04 15:14:54 +00:00
Guilherme Blanco
fc40c437cb Merge pull request #489 from stof/cs_fixes
Fixed coding standards in the Tools namespace
2012-11-03 10:04:10 -07:00
Christophe Coevoet
1b01a074dc Fixed the testsuite 2012-11-03 17:07:56 +01:00
Christophe Coevoet
1d3fe87215 Removed an unused private method in the SchemaValidator 2012-11-03 16:37:34 +01:00
Christophe Coevoet
5a6c398ea0 Fixed coding standards in the Tools namespace 2012-11-03 16:37:31 +01:00
TR
73e6164096 Update lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
coding standards change
2012-11-03 09:47:08 +00:00
Guilherme Blanco
7d7287a1ba Merge pull request #434 from bamarni/filter-objects
allowed to pass filter objects to the configurator
2012-11-02 17:52:23 -07:00
Guilherme Blanco
ec1950d3ca Merge pull request #448 from stefanklug/master-parserFix
Fixed Parser problem for SELECT (((3))) as ....
2012-11-02 17:46:43 -07:00
Guilherme Blanco
515847bece Merge pull request #498 from lanthaler/improve-generated-entity-doc
Improve DocBlock annotations of generated entities
2012-11-02 17:27:11 -07:00
Guilherme Blanco
409516e86c Merge pull request #499 from md2perpe/master
Speling: "invidiual" -> "individual"
2012-11-02 11:13:19 -07:00
Per Persson
b5ac85d19a Update lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
Speling
2012-11-02 18:37:46 +01:00
Markus Lanthaler
1b7ca67fdb Improve DocBlock annotations of generated entities
Currently, the DocBlock annotations for member variables contain the variable name as description which is redundant and should be removed. Furthermore the class is annotated with the FQN instead of just the name. This makes automatically generated documentation quite ugly.
2012-11-02 17:15:44 +01:00
Guilherme Blanco
129d6efd85 Merge pull request #497 from vclayton/DDC-2113
[DDC-2113] Surround WHERE clause with parens if using SQLFilter
2012-11-02 07:27:28 -07:00
Vaughn Clayton
ae30ce4596 [DDC-2113] Surround WHERE clause with parens if using SQLFilter 2012-11-02 08:48:57 -04:00
TR
185a0fb19c refactoring getIndividualValue for valid key value
refactoring getIndividualValue
2012-11-02 00:33:55 +00:00
TR
a65996f74c notice is thrown up if no identifier values found
wrapping the setting of value with an array_key_exists to prevent a notice from being thrown
2012-11-01 23:59:57 +00:00
Nick Masters
0a2ba38e58 Add new line to end of file 2012-10-30 22:42:01 +00:00
Nick Masters
0f92944edd Do not add trailing whitespace to blank lines 2012-10-30 22:22:04 +00:00
Guilherme Blanco
98c5b34f2b Merge pull request #492 from hason/notlike
Added NOT LIKE expression
2012-10-27 11:01:17 -07:00
Martin Hasoň
7f33143502 Added NOT LIKE expression 2012-10-25 12:58:19 +02:00
Guilherme Blanco
f5c1b38e2d Merge pull request #491 from eventhorizonpl/optimise_use
remove unused use statements
2012-10-23 17:13:44 -07:00
Michal Piotrowski
a55b46b4bf remove unused classes 2012-10-23 18:19:28 +02:00
Marco Pivetta
95b8e27bc5 Removing removed API description from docs 2012-10-23 15:21:55 +03:00
Guilherme Blanco
e9c7deae4f Merge pull request #490 from eventhorizonpl/fix_test
fix StatementMock bindParam parameters
2012-10-22 18:56:35 -07:00
Michal Piotrowski
f6cf8f2f0c fix StatementMock bindParam parameters 2012-10-23 00:09:38 +02:00
Guilherme Blanco
9d0b254407 Merge pull request #481 from beejeebus/master
check for false as a return value from get_parent_class(), not null
2012-10-21 20:54:22 -07:00
Guilherme Blanco
38d8c7f0d9 Merge pull request #467 from docteurklein/fix-bool-type-binding
add bool detection when inferring type
2012-10-21 18:39:29 -07:00
Guilherme Blanco
a16a935bff Merge pull request #472 from twinh/master
Fixed empty namespace in generated code when repository class do not have namespace
2012-10-21 18:38:53 -07:00
Guilherme Blanco
cd7ef6e7a7 Merge pull request #484 from jappie/master
Prevented "Undefined index" notice when updating
2012-10-21 18:35:38 -07:00
Guilherme Blanco
814f2f9e03 Merge pull request #487 from FabioBatSilva/DDC-2069
Fix DDC-2069
2012-10-20 20:00:54 -07:00
Guilherme Blanco
2c0feb2a46 Merge pull request #488 from FabioBatSilva/DDC-2079
Fix DDC-2079
2012-10-20 19:59:58 -07:00
Fabio B. Silva
b03388293f Fix typo 2012-10-20 15:44:09 -03:00
Fabio B. Silva
fb467a1196 Fix DDC-2079 2012-10-20 15:37:13 -03:00
Fabio B. Silva
86fddfed9a Fix DDC-2069 2012-10-20 00:28:38 -03:00
Jasper N. Brouwer
1a17b1670b Added testcase for DDC-2086 2012-10-19 09:15:07 +02:00
Johannes
f4cdded06c Merge pull request #131 from adrienbrault/patch-2
Add UUID,CUSTOM generatedValue values to annot ref
2012-10-18 09:24:14 -07:00
Adrien Brault
e3bbd058f2 Add UUID,CUSTOM generatedValue values to annot ref 2012-10-18 18:34:22 +03:00
Jasper N. Brouwer
0cfc37d757 Prevented "Undefined index" notice when updating
While executing updates on an entity scheduled for update without
a change-set, an "Undefined index" notice is raised.
2012-10-17 21:50:09 +02:00
Johannes
54941d1f09 Merge pull request #130 from drak/patch-1
Add example for index definition
2012-10-17 12:06:44 -07:00
Drak
05b170fe99 Add example for index definition 2012-10-17 20:41:15 +02:00
Halleck45
d3c58d83a5 user can set its own commands in the cli-config.php file 2012-10-16 17:03:18 +02:00
justin.randell
ca82a4720b check for false as a return value from get_parent_class(), not null 2012-10-16 15:04:25 +11:00
Per Persson
5657e199bd Update en/tutorials/getting-started.rst
Spelling: UDPATE -> UPDATE
2012-10-15 17:28:12 +03:00
Benjamin Eberlei
56e96793c0 Merge branch 'DDC-2067' 2012-10-12 21:47:39 +02:00
Benjamin Eberlei
deb6327b56 [DDC-2067] Refactor and fix bug in boolean evaluation inside XML Driver. 2012-10-12 21:47:09 +02:00
Benjamin Eberlei
b7b49203aa Merge pull request #477 from jakoch/master
fixed typo/bug and CS on use statements
2012-10-12 11:29:00 -07:00
jakoch
d4a6c488ca fixed use statements 2012-10-12 13:53:20 +02:00
jakoch
ec5ad7136f fix typo 2012-10-12 13:37:17 +02:00
Guilherme Blanco
a4b85c49c9 Merge pull request #474 from okovalov/master
Fixed bug with comment option not being added to column.
2012-10-11 22:22:59 -07:00
Oleksandr Kovalov
90bbb35655 Fixed bug with comment option not being added to column. 2012-10-11 15:57:51 +00:00
twinh
8cc24f4cf2 removed blanks 2012-10-11 06:04:03 -07:00
twinh
66efd65e64 fixed empty namespace in generated code when repository class do not have namespace 2012-10-11 06:01:55 -07:00
Klein Florian
7f8af83b5b add bool detection when inferring type 2012-10-10 11:20:41 +02:00
Ethan
c604adc804 Use protected so generator can be extended
This is definitely something I'd like to be able to extend, and I imagine others might too.
2012-10-09 08:00:51 -03:00
Guilherme Blanco
65fabc20c9 Merge pull request #465 from yohang/master
Fixed a typo in ConcatFunction
2012-10-08 06:43:53 -07:00
Stefan Klug
bf54c22cd9 removed unneded variable 2012-10-08 14:01:04 +02:00
Stefan Klug
1e1f34f9cb cleanup ScalarExpression
_isFunction doesn't exclude subselects anymore
2012-10-08 13:59:54 +02:00
Stefan Klug
6ccf7a7ac7 fixed Parser which incorrectly treated ((( as function 2012-10-08 13:57:34 +02:00
Stefan Klug
d344407636 added test case 2012-10-08 13:49:31 +02:00
yohang
adc3d21385 Fixed typo on ConcatFunction 2012-10-08 12:44:36 +02:00
Benjamin Eberlei
235ad8e553 [DDC-2052] Add SqlWalker::setQueryComponent() to allow modification of the query component in a custom output walker 2012-10-06 11:16:16 +02:00
Benjamin Eberlei
a67a6aa685 Merge pull request #414 from cordoval/DDC-1872
[DDC-1872] Overriding Mapping Annotations
2012-10-06 01:35:47 -07:00
Benjamin Eberlei
a5e043e6e6 Merge pull request #444 from goetas/xmlfix
Fixed some typo error in XML Exporter
2012-10-05 14:16:59 -07:00
Benjamin Eberlei
f7220ae416 Merge pull request #455 from radmar/master
Fixed unique-constraint name in XML Exporter
2012-10-05 11:23:55 -07:00
Benjamin Eberlei
44c0ca4d3c [DDC-2059] Fix column and foreign key interfering with each other during reverse engineering. 2012-10-05 20:03:51 +02:00
Benjamin Eberlei
fd28624120 Merge pull request #456 from Slamdunk/patch-1
Optimize autoload prefix in composer.json
2012-10-05 10:05:14 -07:00
Benjamin Eberlei
a0440b63bb Merge pull request #462 from doctrine/DDC-2055
[DDC-2055] Generate SELECT clause from ResultSetMappingBuilder
2012-10-05 09:46:37 -07:00
Benjamin Eberlei
0c8be37ca9 Merge pull request #458 from barelon/master
Use cascade=all if all cascade options set
2012-10-05 09:45:44 -07:00
Benjamin Eberlei
13762f20c9 Merge pull request #422 from FabioBatSilva/DDC-1574
DDC-1574 - "new" operator
2012-10-05 07:31:18 -07:00
Benjamin Eberlei
a47359e3f5 [DDC-2055] Fix CS 2012-10-04 20:18:10 +02:00
Benjamin Eberlei
91caff1d89 Merge pull request #459 from FabioBatSilva/DDC-2012
Fix DDC-2012
2012-10-03 03:46:04 -07:00
Benjamin Eberlei
913377e31b [DDC-2055] Add support to generate entity result parts of the SELECT clause from a ResultSetMappingBuilder instance. Add support for column incrementing. 2012-10-03 12:35:14 +02:00
Benjamin Eberlei
079beb957e Merge pull request #461 from franmomu/patch-1
[SchemaValidator] Fix typo
2012-10-03 01:46:44 -07:00
Fran Moreno
45eef4a03c [SchemaValidator] Fix typo 2012-10-03 10:51:14 +03:00
Guilherme Blanco
3ecce5251b Merge pull request #128 from egulias/master
[Association-Mapping] - Missing many-to-many xml target-entity tag
2012-10-02 07:30:44 -07:00
Eduardo Gulias Davis
742590d1d7 [Association-Mapping] - Mising target-entity tag in xml format
In the many to many bidirectional xml format the "target-entity" tag is missing and generates a MappingException when not included.
2012-10-02 12:15:03 +03:00
barelon
919cf8558b Remove trailing whitespace 2012-10-02 00:16:29 +03:00
barelon
3b27216c51 add empty lines around if block 2012-10-02 00:14:24 +03:00
Fabio B. Silva
5cb4466f7c Fix test case 2012-09-30 15:47:00 -03:00
Fabio B. Silva
4510f5a5b8 Fix DDC-2012 2012-09-30 15:40:19 -03:00
barelon
cd37ec47d5 Set 'cascade' => 'all' if all cascade options set 2012-09-30 01:16:21 +03:00
barelon
c97eff94f5 Output cascade={"all"} if all cascade options set 2012-09-30 01:12:06 +03:00
Fabio B. Silva
dd984c7319 remove extra line 2012-09-29 16:19:03 -03:00
Fabio B. Silva
5f89fa4190 fix CS 2012-09-29 16:19:03 -03:00
Fabio B. Silva
7c754e495e support namespace alias 2012-09-29 16:19:03 -03:00
Fabio B. Silva
1bd6e841bf Fix some CS 2012-09-29 16:19:02 -03:00
Fabio B. Silva
de93983dff assume entity namespace when not given 2012-09-29 16:19:02 -03:00
Fabio B. Silva
3aa8d3fdac test constructor exceptions 2012-09-29 16:19:01 -03:00
Fabio B. Silva
91efe10855 fix some cs on ObjectHydrator 2012-09-29 16:19:01 -03:00
Fabio B. Silva
4dca27962e support multiple operators 2012-09-29 16:19:01 -03:00
Fabio B. Silva
6844116b94 test case expression 2012-09-29 16:19:00 -03:00
Fabio B. Silva
f0403a5394 test literal values 2012-09-29 16:19:00 -03:00
Fabio B. Silva
e5e45a3a5c test sql generation 2012-09-29 16:18:59 -03:00
Fabio B. Silva
ddb2651691 fix tests on postgres 2012-09-29 16:18:59 -03:00
Fabio B. Silva
af2f556fd3 small refactory 2012-09-29 16:18:59 -03:00
Fabio B. Silva
b19e4a6440 support arithmetic expression and aggregate functions 2012-09-29 16:18:58 -03:00
Fabio B. Silva
88f04b5ebd parse nested new operators 2012-09-29 16:18:58 -03:00
Fabio B. Silva
2b403b7dad basic support refactory 2012-09-29 16:18:58 -03:00
Fabio B. Silva
b29d47a682 cache new object mappings 2012-09-29 16:18:58 -03:00
Fabio B. Silva
0fbb78e61a basic support, need some code refactory and improvements 2012-09-29 16:18:57 -03:00
Fabio B. Silva
ed89695a8c collect new object parameters 2012-09-29 16:18:57 -03:00
Fabio B. Silva
0e60c50c5e small code refactoring 2012-09-29 16:18:56 -03:00
Fabio B. Silva
0c1a8cd43f sql generation 2012-09-29 16:18:56 -03:00
Fabio B. Silva
ee7b5da64a start work 2012-09-29 16:18:56 -03:00
Filippo Tessarotto
95971a6180 Optimize autoload prefix in composer.json
By having more specific autoload prefixes it is possible to reduce the number of stat calls made.
2012-09-28 09:58:38 +03:00
Marcin Radziwoński
380f4fbac7 Fixed unique-constraint name in XML Exporter 2012-09-26 14:27:16 +02:00
Guilherme Blanco
831f0acdc5 Merge pull request #450 from KonstantinKuklin/master
fix some phpdoc
2012-09-20 18:10:22 -07:00
Konstantin Kuklin
34d8843fd6 improve phpdoc 2012-09-21 03:20:06 +04:00
Lennart Hildebrandt
a61afedcf9 Fixed typo for mapping type "array" 2012-09-20 13:11:36 +02:00
Lennart Hildebrandt
06ad3389e0 Added .idea for PhpStorm contributers 2012-09-20 13:11:09 +02:00
Guilherme Blanco
fa29d36d09 Merge pull request #126 from barelon/patch-1
Fix some typos in annotations reference
2012-09-18 08:56:50 -07:00
barelon
c463121da8 Fix some typos in annotations reference
- Changed capitalization of the `@GeneratedValue` and `@Version` examples which incorrectly used lower case

- Fixed parameter names in `@NamedNativeQuery` and `@SqlResultSetMapping`

- Changed the Docblock style for the @MappedSuperclass example to the style used by all examples
2012-09-18 11:28:24 +03:00
Benjamin Eberlei
a9517b1b17 Merge pull request #436 from Powerhamster/comment-fixes
Comment fixes
2012-09-17 03:45:34 -07:00
Benjamin Eberlei
a256c43871 Merge pull request #442 from FabioBatSilva/fix-overrides-annot
Remove unused code
2012-09-17 03:33:19 -07:00
Asmir Mustafic
bc277c6e28 spaces 2012-09-13 11:04:23 +02:00
Asmir Mustafic
f86dcfc288 typo fix 2012-09-13 09:40:14 +02:00
Guilherme Blanco
68f543b8bb Merge pull request #443 from cas87/patch-1
Allow 'nullable' attribute to be used during XML export
2012-09-12 20:12:33 -07:00
Cas
de5b20d0bf Update lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
Allow 'nullable' attribute to be exported for fields, something which already worked in YamlExport. This addition saved me a lot of time during development, not having to manually re-factor after each export.

Don't know why this was missing, maybe it's me who is missing something, so let me know ;)
2012-09-13 03:43:27 +03:00
Fabio B. Silva
8193397d4f remove duplicate code 2012-09-12 21:31:02 -03:00
Guilherme Blanco
dacb51fba2 Merge pull request #437 from sroddy/persistent_collection_matching_fix
Fixes PersistentCollection::matching() when collection is not initialize...
2012-09-07 13:18:45 -07:00
Stefano Rodriguez
9a14b40495 use of assertCount 2012-09-07 14:44:18 +02:00
Stefano Rodriguez
bb8dd6cb11 Fixes PersistentCollection::matching() when collection is not initialized and there are NEW entities in the collection 2012-09-07 10:46:34 +02:00
Stefano Rodriguez
4b3ecfe674 Added a failing test case on PersistentCollection::matching() when collection is not initialized and there are NEW entities in the collection 2012-09-07 10:46:33 +02:00
Thomas Rothe
7acdcd6952 added missing use statement 2012-09-06 21:03:40 +02:00
Thomas Rothe
7beffb5a5f Several fixes for comments
updated @param and @throws annotations
2012-09-06 21:03:26 +02:00
Marco Pivetta
0ff1f418bd Update en/reference/tools.rst
Fixed import as reported by manoelcampos@gmail.com
2012-09-05 22:31:07 +03:00
Benjamin Eberlei
ab990cfba6 Merge branch 'DDC-2003' 2012-09-05 19:28:42 +02:00
Benjamin Eberlei
2c99f97c8b [DDC-2003] Remove unused variable 2012-09-05 19:28:32 +02:00
Bilal Amarni
a9b4debe37 allowed to pass filter objects to the configurator 2012-09-03 10:52:46 +02:00
Josiah Truasheim
959c4f026f Refactored the SqlValueVisitor to move all type processing to the entity persister. 2012-08-31 20:58:16 +07:00
Josiah Truasheim
e0d16331a4 Fixed formatting issues identified by Stof 2012-08-31 19:51:22 +07:00
Josiah Truasheim
a6b6b25267 Removed the closure keyword as it isn't supported in PHP 5.3 2012-08-31 18:16:02 +07:00
Josiah Truasheim
c7f5d9d77d Fixed DDC-2003 using closures to reference the functionality of the calling entity persister from the SQL value visitor. 2012-08-31 18:12:44 +07:00
Josiah Truasheim
783c53d57c Added a failing test for DDC-2003 2012-08-31 17:52:46 +07:00
Bilal Amarni
d47b872292 fixed typo 2012-08-30 16:35:46 +03:00
Bilal Amarni
7c7118d883 simplified interface check 2012-08-30 16:25:50 +03:00
Karsten Dambekalns
4e4cf33342 Update en/reference/working-with-associations.rst
Clarifiy that orphanRemoval works with one-to-one, one-to-many and many-to-many associations.
2012-08-30 11:56:06 +03:00
Benjamin Eberlei
bc2476f342 [DDC-1918] Fix weird results at the end of paginator when using fetch joins 2012-08-29 15:16:07 +02:00
Benjamin Eberlei
9c682efb2f Merge pull request #431 from pitiflautico/patch-1
[ORM] Fix double semicolon
2012-08-29 05:33:12 -07:00
Benjamin Eberlei
267daa5fc1 Merge pull request #428 from chEbba/query-builder-common-criteria
Add QueryBuilder::addCriteria() for Criteria - QueryBuilder bridge
2012-08-29 05:06:50 -07:00
Kirill chEbba Chebunin
ac98f15cfa Fix ORMInvalidArgumentException factory methods with return instead of throw 2012-08-29 14:02:51 +02:00
Kirill chEbba Chebunin
e68807ad4f Change version for QueryExpressionVisitor 2012-08-29 16:00:02 +04:00
Kirill chEbba Chebunin
a162f00ecc Remove builders from QueryExpressionVisitorTest constructor 2012-08-29 15:48:04 +04:00
Daniel Perez Pinazo
5b8ead9db8 [ORM] Fix double semicolon 2012-08-29 13:40:36 +03:00
Francesc Rosàs
e873351624 Remove "before the lists of scheduled changes are cleared"
It is not true.
2012-08-23 21:51:33 +03:00
Benjamin Eberlei
9ae1f804e1 Merge pull request #120 from saltybeagle/master
Minor spelling correction & grammatical formatting
2012-08-23 06:55:26 -07:00
Brett Bieber
46be81115a Minor spelling correction & grammatical formatting 2012-08-23 08:41:19 -05:00
Kirill chEbba Chebunin
2aba7fb374 Add test for QueryBuilderTest::addCriteria with undefined limits 2012-08-20 20:31:57 +04:00
Kirill chEbba Chebunin
1c2f2b5c13 Store QueryExpressionVisitor parameters as array 2012-08-20 20:28:22 +04:00
Kirill chEbba Chebunin
433d208572 Remove extra space from QueryBuilder::addCriteria() 2012-08-20 20:27:55 +04:00
Kirill chEbba Chebunin
d3ab948d88 Overwrite query limits only if set in QueryBuilder::addCriteria() 2012-08-20 20:27:30 +04:00
Kirill chEbba Chebunin
148789600a Remove unnecessary else statements after if with return in QueryExpressionVisitor 2012-08-20 20:27:14 +04:00
Kirill chEbba Chebunin
c6b3899c2d Add QueryBuilder::addCriteria() for Criteria - QueryBuilder bridge 2012-08-20 20:27:03 +04:00
Gary Hockin
b6ddb58634 Update en/tutorials/getting-started.rst
Cleaner to remove the note, and modify the code to put the doctrine_bootstrap.php include first?
2012-08-07 13:26:51 +02:00
Benjamin Eberlei
a9dfe1e10e Merge pull request #118 from Spabby/master
Added a note to explain something that confused me for a while in this tutorial
2012-08-07 04:15:59 -07:00
Gary Hockin
711844296d Update en/tutorials/getting-started.rst
Fixed failed markdown
2012-08-07 13:12:09 +02:00
Gary Hockin
f3dea276e7 Update en/tutorials/getting-started.rst
Added note that tripped me up.
2012-08-07 13:10:25 +02:00
Benjamin Eberlei
2f72219d6e Finish first version of filtering api documentation 2012-08-01 22:15:44 +02:00
Luis Cordova
221ab3b695 [DDC-1872] adjust as per @stof comments on test skipped message 2012-08-01 02:27:23 -05:00
Benjamin Eberlei
eaeda36bdb Add filtering collections 2012-07-31 23:58:37 +02:00
Benjamin Eberlei
83b509e033 Move again into tools 2012-07-31 23:26:40 +02:00
Benjamin Eberlei
71d3f5852d Move Mapping Validation into Configuration section 2012-07-31 23:25:33 +02:00
Benjamin Eberlei
5e9255dda8 Reorganize query builder docs to put the useful stuf fon top. 2012-07-31 23:20:25 +02:00
Luis Cordova
6c932af0a0 [DDC-1872] address comments from beberlei 2012-07-29 23:33:18 -05:00
Luis Cordova
5d0082471f [DDC-1872] skip 5.4 versions for php 5.3 uncompatible tests 2012-07-29 22:55:26 -05:00
Luis Cordova
26608fed5a [DDC-1872] add tutorial for override annotations mappings 2012-07-29 00:39:24 -05:00
Luis Cordova
8742377c3b [DDC-1872] add tests to evaluate annotations overrides with traits 2012-07-29 00:03:25 -05:00
Guilherme Blanco
8a86242a5d Merge pull request #116 from benlumley/patch-2
Fix missing :
2012-07-25 16:34:54 -07:00
Ben Lumley
7c79985460 Fix missing : 2012-07-25 23:31:30 +02:00
Guilherme Blanco
1502d9b552 Merge pull request #111 from Adel-E/patch-1
Fix typo
2012-07-19 08:53:04 -07:00
Adel
f0cc192d7b Fix typo 2012-07-19 16:46:56 +02:00
Guilherme Blanco
a673018508 Merge pull request #109 from michaelperrin/typo_fixes
[Index] Small typo fix
2012-07-11 06:54:24 -07:00
Michaël Perrin
9b2f8dca64 [Index] Small typo fix 2012-07-11 11:51:29 +02:00
Benjamin Eberlei
b62ef939bf Merge pull request #108 from stephpy/fix_typo
fix typo on namespace
2012-07-09 02:12:14 -07:00
Stéphane PY
366bc21ab8 fix typo on namespace 2012-07-09 10:09:28 +02:00
Benjamin Eberlei
b3119c0a5f Merge pull request #107 from frosas/document-pre-and-post-flush-events
Document preFlush and postFlush events
2012-07-08 13:21:54 -07:00
Francesc Rosàs
610295f875 Document preFlush and postFlush events 2012-07-08 21:30:00 +02:00
Benjamin Eberlei
15c9f10bc1 Make composer subtitle to clarify this section applies to Composer only 2012-07-07 18:25:45 +02:00
Benjamin Eberlei
6943244107 Fix docs 2012-07-04 22:15:36 +02:00
Guilherme Blanco
d75569abab Merge pull request #106 from michaelperrin/typo_fixes
Fix typo in the "Getting started database" tutorial
2012-06-28 06:52:04 -07:00
Michaël Perrin
b5e11259e1 Fix typo in the "Getting started database" tutorial 2012-06-28 15:34:58 +02:00
Guilherme Blanco
86884a33f5 Merge pull request #105 from iampersistent/patch-1
Add xml code block for OrderBy
2012-06-20 07:03:41 -07:00
Richard Shank
de9f053cfb Add xml code block for OrderBy 2012-06-20 03:41:20 -07:00
Douglas Greenshields
bc76f33092 added missing JoinColumn node for xml and yaml for many-to-one unidirectional mapping 2012-06-18 19:21:44 +01:00
Guilherme Blanco
b4a9b1550c Merge pull request #103 from Dinduks/add_missing_section_in_configuration
Add a link to the connection configuration
2012-06-18 10:07:47 -07:00
Dinduks
458b0df39e Add a link to the connection configuration 2012-06-18 18:43:10 +02:00
Guilherme Blanco
b292adceb0 Merge pull request #102 from Dinduks/add_missing_section_in_configuration
Add a missing section in the Configuration manual
2012-06-18 09:05:29 -07:00
Dinduks
6e78973eec Add a missing section in the Configuration manual 2012-06-18 17:45:20 +02:00
Benjamin Eberlei
edb7950be8 Getting STarted: Code, Model, Database first 2012-06-16 13:34:23 +02:00
Benjamin Eberlei
1a9443b55a Let docs point to github for XSDs, much better to maintain for us. 2012-06-16 12:44:00 +02:00
Benjamin Eberlei
f854a99e0a Dum 2012-06-16 12:39:58 +02:00
Benjamin Eberlei
50879db001 Fixes 2012-06-16 12:39:01 +02:00
Benjamin Eberlei
63ebaea25a Some more work on index 2012-06-16 12:34:26 +02:00
Benjamin Eberlei
a3883eb306 Reworked docs towards composer, simplified chapters 2012-06-16 12:12:04 +02:00
Benjamin Eberlei
65e2f60b40 Rework configuration and tools section to include Composer 2012-06-16 11:57:56 +02:00
Tim Nagel
e5bac27fcc Initial ResolveTargetEntityListener cookbook entry 2012-06-16 17:36:40 +10:00
Guilherme Blanco
feeef689f3 Merge pull request #100 from adrienbrault/patch-1
Fix typo/Add missing words
2012-06-13 06:07:09 -07:00
Adrien Brault
47febcd7f4 Fix typo/Add missing words 2012-06-13 01:36:40 +03:00
Guilherme Blanco
138ec8411c Merge pull request #99 from ErikDubbelboer/spelling-fixes
Fixed spelling error and missing php open tag
2012-06-07 05:37:01 -07:00
Erik Dubbelboer
24d488b5f1 fixed minor errors 2012-06-07 13:53:58 +02:00
Guilherme Blanco
672b39fb84 Merge pull request #97 from patrick-mcdougle/patch-2
Fixed wording on the Alice and Bob Optimistic locking example.
2012-06-05 14:47:37 -07:00
patrick-mcdougle
9f575aad5b Fixed wording on the Alice and Bob Optimistic locking example. 2012-06-05 16:35:37 -05:00
Guilherme Blanco
988d0001d3 Merge pull request #96 from calumbrodie/patch-1
Fixed inline example of concat method
2012-05-31 06:52:44 -07:00
Guilherme Blanco
2205045ca9 Merge pull request #95 from adanlobato/patch-1
Fixed some typos on Inheritance docs
2012-05-31 06:51:28 -07:00
Calum Brodie
e41704b211 Fixed inline example of concat method 2012-05-31 14:08:56 +02:00
Adán Lobato
b25548414b Fixed some typos on Inheritance docs 2012-05-31 10:51:38 +02:00
Benjamin Eberlei
34f7ccb5fa Merge pull request #94 from shieldo/patch-1
Improved grammar/ punctuation in pagination tutorial, and brought parame...
2012-05-30 07:09:49 -07:00
Douglas Greenshields
671177e162 Improved grammar/ punctuation in pagination tutorial, and brought parameter name in code example into line with actual parameter 2012-05-30 15:59:58 +02:00
Guilherme Blanco
8b4e08d694 Updated docs (trying to fix one-to-many with unidirectional join table example). 2012-05-28 12:39:31 -04:00
Guilherme Blanco
4627c8b3ee Re-synchronized DQL EBNF with current DQL support. 2012-05-21 16:13:15 -04:00
Guilherme Blanco
b5b569afd4 Merge pull request #93 from patrick-mcdougle/patch-1
Updated the decimal type mapping have a string on the php side. (current behavior)
2012-04-26 18:09:22 -07:00
patrick-mcdougle
b184772349 Updated the decimal type mapping have a string on the php side. (current behavior) 2012-04-26 14:21:51 -05:00
Guilherme Blanco
f61bd43621 Merge pull request #86 from FabioBatSilva/patch-5
Docs for NamingStrategy
2012-04-20 21:08:53 -07:00
Guilherme Blanco
da21917dad Merge pull request #85 from Tobion/patch-1
fix confusing typo in ordered collections
2012-04-20 21:07:14 -07:00
Fabio B. Silva
e65dbcf2b5 Fix typo 2012-04-19 20:58:31 -03:00
Fabio B. Silva
a1e7389e71 docs for association/attribute override 2012-04-19 20:56:18 -03:00
Guilherme Blanco
ecd6e1d510 Merge pull request #92 from import/feature/new-cache-driver
New cache driver documentation
2012-04-19 07:02:26 -07:00
Osman Üngür
0222981161 Added notes about configuration 2012-04-19 11:34:12 +03:00
Osman Üngür
488914a4ac Added section about cache driver 2012-04-19 11:33:26 +03:00
Guilherme Blanco
7d9738e8c0 Merge pull request #91 from import/fix/sample-code-error
Fix for collection handling code sample
2012-04-18 08:40:57 -07:00
Osman Üngür
05a188da38 Fix for collection handling code sample 2012-04-18 17:13:14 +03:00
Guilherme Blanco
03a74a250a Merge pull request #89 from krevindiou/fix-1
Fix typo
2012-04-16 08:33:40 -07:00
Arnaud BUCHOUX
6a80ebf985 Fix typo 2012-04-16 17:15:18 +02:00
Guilherme Blanco
4debe46d1f Merge pull request #88 from FabioBatSilva/patch-7
Docs for Named Native Query
2012-04-16 07:57:11 -07:00
Fabio B. Silva
58d4b2a617 docs for Named Native Query 2012-04-15 19:49:42 -03:00
Fabio B. Silva
2007f1ab95 annotations reference for named native query 2012-04-15 16:57:44 -03:00
Fabio B. Silva
987834a2dd wrap lines 2012-04-15 11:34:10 -03:00
Fabio B. Silva
3076e2a1f7 docs for NamingStrategy 2012-04-15 11:34:10 -03:00
Benjamin Eberlei
543a3ddb03 Merge pull request #84 from gedrox/patch-1
[#DWEB-103] Fixed UTC timezone creation
2012-04-13 02:17:43 -07:00
Tobias Schultze
301f4d0346 fix confusing typo in ordered collections 2012-04-12 23:22:06 +03:00
gedrox
429ac54a34 [#DWEB-103] Fixed UTC timezone creation. Constant DateTimeZone::UTC is 1024, string name is required for the DateTimeZone constructor. 2012-04-11 10:02:42 +03:00
Benjamin Eberlei
e168b4e543 More prominent note about ResultSetMappingBuilder in native-sql chapter 2012-04-10 23:16:51 +02:00
Benjamin Eberlei
01381fae1f [DDC-1698] Autoloading proxies 2012-03-14 20:11:17 +01:00
Guilherme Blanco
7782f91131 Merge pull request #82 from augustohp/patch-1
Fixed typo "Assocations" in doc index
2012-02-27 10:00:24 -08:00
Augusto Pascutti
579774f505 Fixed typo "Assocations" 2012-02-27 14:55:52 -03:00
Guilherme Blanco
e8fbafd154 Fixed OneToMany bidirectional association mapping in Annotations and also included the YAML missing one. 2012-02-26 11:40:13 -05:00
Benjamin Eberlei
35ded56fdd Add note about debugging DQL queries. 2012-02-20 10:48:57 +01:00
Benjamin Eberlei
361c88d6ea Merge pull request #55 from michal-pipa/fix-indentation
Fixed indentation.
2012-02-18 15:56:26 -08:00
Benjamin Eberlei
9b484192c4 Merge pull request #81 from meze/patch-1
Fix a typo in a code example (getResults instead of getResult)
2012-02-18 15:55:38 -08:00
meze
86010bdb0d Fix a typo in a code example (getResults instead of getResult) 2012-02-19 03:01:29 +04:00
Benjamin Eberlei
138b67db86 Fix wrong use of private in mapped superclasses, only protected is supported here. 2012-02-13 11:18:35 +01:00
Benjamin Eberlei
ea95bd57ef Rework a bit 2012-02-05 22:54:28 +01:00
Benjamin Eberlei
3def848422 Fix enumeration 2012-02-05 22:51:42 +01:00
Benjamin Eberlei
6fa7580d10 Add tutorial about Pagination 2012-02-05 22:46:43 +01:00
Benjamin Eberlei
984c8f7db1 Fix versions 2012-02-05 22:28:30 +01:00
Benjamin Eberlei
53947bf2e9 Merge pull request #79 from asm89/filters
Fix code blocks
2012-01-31 13:24:41 -08:00
Alexander
bd30a04d0d Fix code blocks 2012-01-31 22:24:36 +01:00
Guilherme Blanco
18bdc53907 Merge pull request #78 from asm89/filters
Documentation for the new filter functionality
2012-01-31 13:20:55 -08:00
Alexander
6f56dbe395 Added filters to the index 2012-01-31 15:58:31 +01:00
Alexander
ff9e7ef64b Processed comments of @Ocramius 2012-01-31 15:56:24 +01:00
Alexander
cfbfac6a51 General information on how the filter work etc + warning on the enabling/disabling part 2012-01-31 15:56:24 +01:00
Alexander
7c8a9c0f9a Initial draft for filter documentation 2012-01-31 15:56:24 +01:00
Benjamin Eberlei
d378b5aec8 Update theme 2012-01-30 00:56:14 +01:00
Benjamin Eberlei
c613351f39 Added 10 quick steps section 2012-01-29 22:40:38 +01:00
Benjamin Eberlei
9bd51f2062 Update theme 2012-01-29 20:56:48 +01:00
Benjamin Eberlei
cfd5eefa7a Update theme 2012-01-29 20:54:51 +01:00
Benjamin Eberlei
781f83f648 Update unitofwork section 2012-01-29 20:45:17 +01:00
Benjamin Eberlei
02e7dcdc87 Fix conf.py for 2.2 release 2012-01-29 20:06:07 +01:00
Benjamin Eberlei
8a39a66057 Some fixes in the docs 2012-01-29 20:03:40 +01:00
Benjamin Eberlei
5e3e48c8dd Rename getting-started tutorial page. 2012-01-29 19:48:09 +01:00
Benjamin Eberlei
0b7d5f2813 Merge pull request #50 from cordoval/patch-3
corrected rst for bash like code blocks
2012-01-29 10:36:41 -08:00
Benjamin Eberlei
ccabbf328f Merge pull request #56 from michal-pipa/fix-underline
Fixed title underline.
2012-01-29 10:36:25 -08:00
Guilherme Blanco
022c08d947 Merge pull request #77 from Ocramius/patch-3
Making the correct usage of LIKE expressions and placeholders explicit
2012-01-29 07:40:52 -08:00
Marco Pivetta
f9523aa419 Making the correct usage of LIKE expressions and placeholders explicit 2012-01-29 15:59:45 +01:00
Benjamin Eberlei
b0ec3dfb47 Started refactoring of the documentation towards smaller chapters, grouped into logical units with better explanations (hopefully). 2012-01-28 00:49:37 +01:00
Benjamin Eberlei
19b7d4d0d4 Simplify section names even more 2012-01-27 21:43:04 +01:00
Benjamin Eberlei
d5a97c0c59 Add fancy new index page, moving toc to toc.rst 2012-01-27 21:36:36 +01:00
Guilherme Blanco
3b9aac21c4 Merge pull request #76 from shiroyuki/patch-1
Changed from "@var string" to "@var int" for the complete version of ent...
2012-01-26 08:57:28 -08:00
Juti Noppornpitak
3880ec6839 Changed from "@var string" to "@var int" for the complete version of entities/User.php. 2012-01-26 11:29:32 -05:00
Benjamin Eberlei
9602e6785e Updated theme 2012-01-23 00:44:19 +01:00
Benjamin Eberlei
7918a42a0e Theme submodule 2012-01-22 23:25:48 +01:00
Benjamin Eberlei
81ba71e8d5 Remove _theme 2012-01-22 23:24:01 +01:00
Benjamin Eberlei
23529e839d Adjust css 2012-01-22 23:15:52 +01:00
Benjamin Eberlei
34a696c3d6 Add all static dependencies instead of loading them from doctrine project site. 2012-01-22 23:09:21 +01:00
Benjamin Eberlei
cad694e469 Explicit Javascripts 2012-01-22 22:49:14 +01:00
Benjamin Eberlei
17d91d173b Change _templates override into a theme "doctrine". 2012-01-22 22:23:19 +01:00
Guilherme Blanco
1b23b4bc47 Merge pull request #75 from hype-/patch-1
Added missing docblock endings.
2012-01-16 13:20:53 -08:00
Mikko Hirvonen
d44d82b694 Added missing docblock endings. 2012-01-16 22:08:49 +02:00
Guilherme Blanco
649d29414f Fixed one-to-many unidirectional with join table chapter. 2012-01-13 01:09:28 -05:00
Benjamin Eberlei
7b4349a9ce Rewrite installation and configuration of Tools chapter. 2012-01-09 10:36:56 +01:00
Benjamin Eberlei
1d5597917b Fix TIP and show new cache instropection API (2.2) 2012-01-09 08:37:12 +01:00
Benjamin Eberlei
ce0873d589 Merge pull request #73 from AmirBehzad/TutorialFixes
Update en/tutorials/getting-started-xml-edition.rst
2012-01-05 13:40:57 -08:00
AmirBehzad Eslami
bc91e5c0fd Separated listings of User.php, Bug.php, and Product.php. Added missed statement to use ArrayCollection in User.php . 2012-01-06 01:03:15 +03:30
Benjamin Eberlei
6d1f716f8b Update en/tutorials/getting-started-xml-edition.rst 2012-01-05 21:40:15 +01:00
Benjamin Eberlei
442227fc89 Update en/reference/architecture.rst 2012-01-05 10:28:46 +01:00
Guilherme Blanco
ae1c171392 Merge pull request #70 from maastermedia/master
Typos fixed
2011-12-30 20:18:50 -08:00
Peter Kokot
65c64f52c8 typo in reference/tools 2011-12-31 04:37:25 +01:00
Peter Kokot
1c31603e17 type varchar replaced with type string 2011-12-31 04:33:46 +01:00
Benjamin Eberlei
894dfd1a6b Update en/reference/yaml-mapping.rst 2011-12-22 23:06:59 +01:00
Guilherme Blanco
d23b3bb056 Merge pull request #69 from keymaster/patch-1
Clarify the performance warning.
2011-12-21 06:56:17 -08:00
keymaster
0b819ca3b0 Clarify the performance warning. 2011-12-21 12:24:37 +02:00
Guilherme Blanco
041a4e0b43 Merge pull request #66 from FabioBatSilva/patch-2
add doc for default repository class
2011-12-20 08:34:27 -08:00
Fabio B. Silva
ca87ddd540 add doc for default repository class 2011-12-20 09:15:37 -02:00
Guilherme Blanco
e29dfabb74 Merge pull request #65 from FabioBatSilva/patch-1
[Annotations] add doc for @MappedSuperclass#repositoryClass
2011-12-19 12:41:15 -08:00
Fabio B. Silva
43e4e1c389 add doc for MappedSuperclass repositoryClass 2011-12-19 18:35:01 -02:00
Benjamin Eberlei
e42d70a2b0 Clarify how the CLI is setup 2011-12-17 23:56:10 +01:00
Benjamin Eberlei
48acbf75cd Reference new cookbook entry 2011-12-17 16:28:46 +01:00
Benjamin Eberlei
22ac3a3099 Add cookbook entry on saving entities in the session. 2011-12-17 16:28:31 +01:00
Guilherme Blanco
373090f223 Merge pull request #64 from ebernhardson/master
Replace non-existant constant T_ABS
2011-12-13 20:04:23 -08:00
ebernhardson
5ea8861bf3 replace non-existant constant Lexer::T_ABS 2011-12-13 10:36:14 -08:00
Guilherme Blanco
e85ce5c02f Merge pull request #63 from Ocramius/patch-2
Fixing minor issues reported by BostjanWrk on IRC about the RSM Builder ...
2011-12-13 06:31:30 -08:00
Marco Pivetta
220c6c4e0e Fixing minor issues reported by BostjanWrk on IRC about the RSM Builder example 2011-12-13 11:30:09 +01:00
Benjamin Eberlei
f057587457 Merge pull request #62 from jsor/cookbook_types_fix
Add missing canRequireSQLConversion() in example type code
2011-12-02 12:58:54 -08:00
Jan Sorgalla
69295ba076 Add missing canRequireSQLConversion() in example type code 2011-12-02 20:59:17 +01:00
Benjamin Eberlei
76254d693d Merge pull request #61 from jsor/cookbook_types
Cookbook article: Advanced field value conversion using custom mapping types
2011-11-29 03:13:26 -08:00
jsor
cbefb7c543 Finalize first version 2011-11-29 10:31:07 +01:00
Jan Sorgalla
228d8517c7 Add type 2011-11-28 21:06:01 +01:00
jsor
bece5f0f91 Change ref name 2011-11-28 15:22:55 +01:00
jsor
1300758499 Rename article and add more text 2011-11-28 15:19:49 +01:00
jsor
129b9d0945 Setup article 2011-11-28 11:52:17 +01:00
Benjamin Eberlei
b9b05fc3eb Fix for DDC-1293 2011-11-18 23:10:40 +01:00
Guilherme Blanco
4c8ab82f9c Merge pull request #60 from Ocramius/patch-1
Fixing invalid XML mapping samples
2011-11-16 11:42:05 -08:00
Marco Pivetta
2200c1f7e1 Fixing invalid XML mapping samples 2011-11-16 20:00:21 +01:00
Guilherme Blanco
59849f73bd Merge pull request #59 from romainneutron/master
Fix some YAML syntax errors
2011-11-15 15:48:30 -08:00
Benjamin Eberlei
51211980a4 Remove ON in docs 2011-11-15 22:21:15 +01:00
Romain Neutron
c53e2772a0 Fix YAML syntax errors in examples 2011-11-15 22:10:56 +01:00
Guilherme Blanco
650a80a61a Merge pull request #57 from volftomas/master
Minor changes
2011-11-08 05:57:38 -08:00
Tomas Paladin Volf
cfe5424cf9 Fixed pear command for install, "boostrap" => "bootstrap" 2011-11-08 14:44:48 +01:00
Guilherme Blanco
59b4641d29 Merge pull request #54 from michal-pipa/fix-link
Changed external link to internal link.
2011-11-07 04:50:09 -08:00
Michał Pipa
64200c405e Fixed title underline. 2011-11-07 08:19:20 +01:00
Michał Pipa
0eed56fae9 Fixed indentation. 2011-11-07 08:18:22 +01:00
Michał Pipa
c0f86e796d Changed external link to internal link. 2011-11-07 07:53:05 +01:00
Guilherme Blanco
0f11b0c61d Merge pull request #53 from michal-pipa/doc
Fixed broken link.
2011-10-31 09:43:13 -07:00
Guilherme Blanco
981a2d4341 Merge pull request #52 from michal-pipa/c21aaebbc4159f27d6db1194d585ba8895057f6a
Changed 'Symfony 2' to 'Symfony2'.
2011-10-31 09:16:11 -07:00
Michał Pipa
299642083b Fixed broken link. 2011-10-31 17:10:30 +01:00
Michał Pipa
c21aaebbc4 Changed 'Symfony 2' to 'Symfony2'.
http://symfony.com/blog/talk-about-symfony2-not-symfony-2
2011-10-31 17:09:15 +01:00
Guilherme Blanco
0317f43987 Merge pull request #51 from asm89/patch-1
Fix typos in 'Working with objects' php examples
2011-10-26 07:48:36 -07:00
Alexander
78ef07f630 Update en/reference/working-with-objects.rst 2011-10-26 14:12:32 +03:00
Benjamin Eberlei
e98cb4f145 Document AbstractQuery#getOneOrNullResult() 2011-10-26 00:54:06 +03:00
Luis Cordova
cf44745d08 corrected rst for bash like code blocks 2011-10-25 15:50:29 -05:00
Benjamin Eberlei
196fd79d5f Merge pull request #27 from chriswoodford/persisting-the-decorator
Persisting the decorator
2011-10-25 13:47:24 -07:00
Benjamin Eberlei
8dc77a7083 Merge pull request #43 from marcw/patch-1
Fixed namespace in code-block
2011-10-25 13:45:58 -07:00
Benjamin Eberlei
a5688f60d3 Merge pull request #44 from mweimerskirch/patch-1
Documented the onClear event
2011-10-25 13:45:41 -07:00
Benjamin Eberlei
288ec8aa5c Merge pull request #45 from oyerli/patch-1
Fixed typo in the orderBy method.
2011-10-25 13:45:24 -07:00
Benjamin Eberlei
c7658d6285 Merge pull request #49 from cordoval/patch-2
typo change from contains to consists of
2011-10-25 13:45:08 -07:00
Luis Cordova
1bc0efba43 typo change from contains to consists of 2011-10-25 15:33:30 -05:00
Guilherme Blanco
de75ea88b6 Merge pull request #48 from cordoval/patch-1
two typos fixed
2011-10-25 13:11:20 -07:00
Luis Cordova
0a989e63d2 two typos fixed 2011-10-25 15:08:52 -05:00
Benjamin Eberlei
237c20c9b6 Enhanced docs on UnitOfWork#computeChangeSets 2011-10-15 18:09:27 +02:00
Benjamin Eberlei
6d4337fc71 More details on partial objects 2011-10-15 16:14:36 +02:00
Benjamin Eberlei
b88ef8b1a5 Add docs on SimplifiedXmlDriver and SimplifiedYamlDriver 2011-10-15 09:47:56 +02:00
Guilherme Blanco
9c389a49c7 Fixes DDC-509 2011-10-11 01:27:30 -03:00
Guilherme Blanco
da4948944d Merge pull request #47 from mdpatrick/interveawed_association_mapping
Corrected a typo (interveawed)
2011-10-04 10:33:48 -07:00
Dan Patrick
1a1d36c73f Corrected a typo (interveawed) 2011-10-04 12:19:10 -05:00
Chris Woodford
d3f6ffb09e Added cookbook/decorator-pattern to index file 2011-09-18 18:39:36 -04:00
Guilherme Blanco
f32a780459 Merge pull request #46 from havvg/master
fix example php code on sequence generator
2011-09-13 20:00:45 -07:00
Toni Uebernickel
3ec55d0cdd fix sequence generator php code on sequenceName 2011-09-13 20:32:04 +02:00
Ozan Yerli
a61c7e59d6 Fixed typo in the orderBy method. 2011-09-04 23:43:43 +03:00
Benjamin Eberlei
8084b6cbf0 Add docs on DDC-659 feature (ClassMetadataBuilder) 2011-09-04 14:25:03 +02:00
Michel Weimerskirch
79c113b532 Documented the onClear event. (using text from the docblock comment) 2011-09-02 22:38:47 +03:00
Benjamin Eberlei
e6e1243852 Merge branch 'master' of github.com:doctrine/orm-documentation 2011-08-27 12:36:56 +02:00
Benjamin Eberlei
5fc0ede5bf Fixed the tutorial, it was a mess! Now its explaining everything step by step and all bugs are removed. Changed introduction and configuration to use the simpler Setup helper class 2011-08-27 12:36:37 +02:00
Marc Weistroff
c90f3cf275 Fixed namespace in code-block 2011-08-26 02:07:56 +03:00
Joseph Rouff
ffa2a545fa Fix typo 2011-08-25 01:36:21 +03:00
Guilherme Blanco
35cb7b97db Merge pull request #42 from rouffj/patch-1
Fix typo
2011-08-24 09:32:11 -07:00
Guilherme Blanco
a5ac76b192 Added new support to DQL: ORDER BY now supports SingleValuedPathExpression and INSTANCE OF now supports multi-value checking. 2011-08-15 01:57:02 -03:00
Benjamin Eberlei
26c56dd0d2 Merge pull request #40 from hhamon/query_builder_fix
[QueryBuilder] added missing $
2011-08-14 09:24:21 -07:00
Hugo Hamon
31f34e95cc [QueryBuilder] added missing $ 2011-08-14 18:21:31 +02:00
Guilherme Blanco
189c729f15 Added support to CaseExpression. 2011-08-08 02:08:19 -03:00
Benjamin Eberlei
60ed7769cd Merge branch 'master' of github.com:doctrine/orm-documentation 2011-08-06 19:13:01 +02:00
Benjamin Eberlei
5ee8861350 Add note about comparing datetime and object by reference 2011-08-06 19:12:42 +02:00
Guilherme Blanco
01caa0d06e Merge pull request #39 from craue/patch-1
completed the sentence in section "postUpdate, postRemove, postPersist"
2011-08-04 16:16:20 -07:00
Christian Raue
1de9b906fd completed the sentence in section "postUpdate, postRemove, postPersist" 2011-08-05 02:10:40 +03:00
Guilherme Blanco
255cf347ec Merge pull request #38 from mdpatrick/grammar_on_getting_started_xml_edition
Small grammar changes in section explaining lazyload/ArrayCollection.
2011-08-01 20:33:08 -07:00
Dan Patrick
6cd7d21db1 Small grammar changes in section explaining lazyload/ArrayCollection. 2011-08-01 18:04:14 -05:00
Guilherme Blanco
67818ea2cc Merge pull request #37 from mdpatrick/associations_grammar_errors
Fixed minor grammatical errors in working-with-associations.rst
2011-07-30 15:40:12 -07:00
Dan Patrick
bfe5bea68d Fixed grammatical errors in working-with-associations.rst 2011-07-30 17:15:44 -05:00
Benjamin Eberlei
3a70ee6662 Merge pull request #25 from wilmoore/master
use 'string' instead of 'varchar'
2011-07-26 14:25:53 -07:00
Benjamin Eberlei
c0860a6018 Merge pull request #35 from mridgway/DDC-1270
[DDC-1270] Fixed invalid expr()->*() function calls; Added isNull and isN
2011-07-26 14:23:38 -07:00
Benjamin Eberlei
da60e86993 Merge pull request #34 from mridgway/DDC-725
[DDC-725] Removed onUpdate property
2011-07-26 14:22:59 -07:00
Benjamin Eberlei
ecb13a87dc Bugfix 2011-07-13 21:31:31 +02:00
Benjamin Eberlei
d8125768a3 Copy new build process for docs into orm docs from DBAL 2011-07-13 21:19:09 +02:00
Benjamin Eberlei
91b2c82c58 Brought most of the documentation up to date on 2.1 2011-07-13 20:31:01 +02:00
Benjamin Eberlei
660ead4b0e FAQ and Composite Key renaming 2011-07-13 19:04:21 +02:00
Benjamin Eberlei
c876f9edb2 Add warning to Association Mapping chapter that referencedColumnName have to primary key columns 2011-07-12 23:01:42 +02:00
Benjamin Eberlei
f4074dbe1d Removed solved limitations and added missing ones 2011-07-12 22:58:24 +02:00
Michael Ridgway
175faeb5f2 [DDC-1270] Fixed invalid expr()->*() function calls; Added isNull and isNotNull functions; Fixed casing on orX and andX 2011-07-11 13:25:15 -04:00
Benjamin Eberlei
82419813df Another inheritance question 2011-07-10 20:34:34 +02:00
Benjamin Eberlei
609e3b8c92 Write something about all FAQ entries that were empty 2011-07-10 20:31:16 +02:00
Benjamin Eberlei
fac1a517df Finish chapter on composite primary keys (still missing XML and YAML example though) 2011-07-10 20:03:59 +02:00
Benjamin Eberlei
653add64f9 Fix bug in mappings of Aggregate Column cookbook entry 2011-07-09 21:26:13 +02:00
Benjamin Eberlei
89b807177e Merge branch 'master' of github.com:doctrine/orm-documentation 2011-06-28 23:29:06 +02:00
Benjamin Eberlei
09d5169a8b Remove methods that not exist anymore from Expr object documentation 2011-06-28 23:28:55 +02:00
Michael Ridgway
8af162711e Removed onUpdate property 2011-06-28 16:34:12 -04:00
Benjamin Eberlei
503b6c1716 Merge pull request #33 from nicodmf/master
Little typo
2011-06-28 08:53:57 -07:00
Nicolas de Marqué Fromentin
ad012a63cb Little typo 2011-06-28 16:22:14 +02:00
Benjamin Eberlei
36e500682a Started FAQ 2011-06-20 21:20:23 +02:00
Benjamin Eberlei
de5952f597 Fix association mappings 2011-06-16 21:52:51 +02:00
Benjamin Eberlei
f6aa387e6f Fix missing chars in xml comment 2011-06-16 21:27:20 +02:00
Benjamin Eberlei
e750b27edb Fix another bug, yet another :) 2011-06-16 21:23:39 +02:00
Benjamin Eberlei
3417f3716e Fix another bug2 2011-06-16 21:20:56 +02:00
Benjamin Eberlei
5c5feab38e Fix another bug 2011-06-16 21:19:25 +02:00
Benjamin Eberlei
97c305452e Fix bug in docs 2011-06-16 21:18:17 +02:00
Benjamin Eberlei
41600667c2 More association mapping yml+xml code blocks 2011-06-12 23:43:29 +02:00
Benjamin Eberlei
c187862e4f Reorder paragraph and fix note. 2011-06-12 23:26:54 +02:00
Benjamin Eberlei
d8f9c5380a More xml+yml configuration blocks 2011-06-12 23:22:28 +02:00
Benjamin Eberlei
b5827ea83f Add tons of xml and yaml configuration blocks to basic- and association-mapping chapters 2011-06-12 23:07:21 +02:00
Benjamin Eberlei
6816816101 Fix bug in previous commit 2011-06-11 10:07:18 +02:00
Benjamin Eberlei
06e45f7587 Fix bug in previous commit 2011-06-11 09:59:17 +02:00
Benjamin Eberlei
71c47f69ec Mention 5.3 dependency in getting started tutorial, and link to entity restrictions aswell. Add the func_get_args() restriction to the list in architecture. 2011-06-11 09:52:17 +02:00
Benjamin Eberlei
6f909b6e69 Clarifications and additions in DQL and Working with objects chapter 2011-06-11 08:59:33 +02:00
Benjamin Eberlei
a5cfd2321f Document Mssql Datetim2 behavior 2011-06-05 17:21:11 +02:00
Guilherme Blanco
26c2690536 Merge pull request #31 from Infranology/typos
fixed constants typos in "Entity State"
2011-06-01 20:19:12 -07:00
Eriksen Costa
729ad9e5c9 fixed constants typos in "Entity State" 2011-06-02 00:14:46 -03:00
Guilherme Blanco
48cf91a3d0 Merge pull request #30 from renansaddam/patch-1
Version 2.0.5 no longer needs $cli call and the namespace for Components
2011-05-19 10:16:40 -07:00
Renan Gonçalves aka renan.saddam
457abbacef Version 2.0.5 no longer needs $cli call and the namespace for Components has changed. 2011-05-19 06:20:50 -07:00
Guilherme Blanco
7adbf5698a Merge pull request #29 from HoffmannP/ORMDOC
Ormdoc
2011-05-18 11:31:42 -07:00
Berengar W. Lehr
f58dcbaa8a 1. Replaced "fi"-ligature to actually "fi"-letters as pdflatex inputenc package does not support that unicode character
2. Replaced external link to internal document with internal link (now actuall link in documentation should work)
2011-05-18 20:08:49 +02:00
Berengar W. Lehr
6d457d9927 1. Changed external links syntax in internal link syntax to repair link (dql-… file)
2. Replaced unicode "fi"-ligatur with "fi" to enable pdflatex-ing b/c utf8-inputenc-package does - for unknown reasons - not support unicode "fi"-ligatur
2011-05-18 19:49:48 +02:00
Guilherme Blanco
e665d9f6df Merge pull request #28 from brikou/patch-1
fixed setQueryHint > setHint
2011-05-18 05:47:33 -07:00
Brikou CARRE
d436ea19df fixed setQueryHint > setHint 2011-05-18 02:51:22 -07:00
Chris Woodford
6cd778f940 wrote a quick introduction 2011-05-05 21:36:18 -04:00
Chris Woodford
e9d096e411 cleaning up some sentences. better flow 2011-05-05 21:23:10 -04:00
Chris Woodford
894b2614ed fixed some typos 2011-05-05 21:16:40 -04:00
Chris Woodford
c242ab4371 some tweaks to class descriptions 2011-05-03 23:04:41 -04:00
Chris Woodford
a51f182cc0 first draft of cookbook article 2011-05-03 22:48:40 -04:00
Guilherme Blanco
302199938f Merged pull request #24 from gimler/master.
tutorial
2011-04-29 20:47:31 -07:00
Guilherme Blanco
8d66809d0b Merged pull request #26 from asartalo/master.
Getting Started tutorial corrections
2011-04-29 20:25:40 -07:00
asartalo
16f132bff0 Corrected annotation for sample code: moved repositoryClass attribute from @Table to @Entity. 2011-04-24 13:24:54 +08:00
asartalo
3cac853dd4 Changed instances of entity manager variable '' to '' for consistency. 2011-04-24 13:21:34 +08:00
asartalo
511268ddd7 Removed another instance of '--force' Option for the orrm:schema-tool:create command as this is not available for this command. 2011-04-24 10:52:18 +08:00
asartalo
01bfc4f2f1 Removed '--force' Option for the orrm:schema-tool:create command as this is not available for this command. 2011-04-24 10:38:35 +08:00
Wil Moore III
3a80896173 Changed registerDoctrineTypeMapping('enum', 'varchar'); to registerDoctrineTypeMapping('enum', 'string'); as 'string' is the correct type to map to whereas varchar is only an alias. 2011-04-08 10:44:55 -07:00
Benjamin Eberlei
f76728818b Add note box on cascade operations being performed in memory and reference to foreign key /database-level onDelete option for deleting associtions 2011-04-06 23:36:50 +02:00
Benjamin Eberlei
a0b41feb72 Update section on mixed query and add notes on multiple entities in FROM clause. (update paragraph) 2011-04-03 20:13:34 +02:00
Benjamin Eberlei
2e777f99b9 Update section on mixed query and add notes on multiple entities in FROM clause. 2011-04-03 20:00:43 +02:00
Benjamin Eberlei
a259ac9bcf Merge branch 'master' of github.com:doctrine/orm-documentation 2011-03-31 21:49:51 +02:00
Benjamin Eberlei
04527a8bcb Add cookbook entry on MySQL Enums. 2011-03-31 21:49:32 +02:00
Gordon Franke
63c431f01d fix entity manager reference in repository code sample 2011-03-31 19:55:57 +08:00
Gordon Franke
7639f1e99b fix entity manager reference in repository code sample 2011-03-31 08:57:27 +02:00
Benjamin Eberlei
abc8f29800 [DDC-692] Add docs on 2.1 read only entities feature 2011-03-29 20:30:10 +02:00
Benjamin Eberlei
22ab3d1256 Fixed several issues and merged pull requests into docs. 2011-03-28 20:40:39 +02:00
Benjamin Eberlei
126e592758 Fix YAML docs on cascade 2011-03-27 22:23:37 +02:00
Benjamin Eberlei
cca642b094 Remove CASE, COALESCSE, NULLIF EBNF rules for the time being, they are not yet supported. 2011-03-20 12:05:28 +01:00
Benjamin Eberlei
c551192b6b DBAL-86 - Fix reference to nonexisting Configuration#setCustomTypes() 2011-02-27 09:03:59 +01:00
Benjamin Eberlei
d0ae95604f Add warnining about date types assuming default timezone. 2011-02-26 16:29:11 +01:00
Benjamin Eberlei
e94d15ec11 Fix DDC-1039 2011-02-26 11:53:43 +01:00
Benjamin Eberlei
0252368af2 Fix some Sphinx/ReST warnings 2011-02-26 11:51:43 +01:00
Benjamin Eberlei
e1c2084eeb Add section on EntityRepository into Getting Started Tutorial. 2011-02-26 11:51:30 +01:00
Benjamin Eberlei
aab2303c37 Fix Getting Started. 2011-02-26 11:12:58 +01:00
Jonathan H. Wage
c8c4c4ed46 Updating css. 2011-02-20 11:12:51 -06:00
Benjamin Eberlei
654dbb1b10 Fix <pre> tag styling having a very small line-height. 2011-02-20 11:34:59 +01:00
Benjamin Eberlei
9a289e2982 Adopt new Sphinx layout 2011-02-20 11:00:39 +01:00
Benjamin Eberlei
51fe83b7be Merge branch 'master' of github.com:doctrine/orm-documentation 2011-02-15 21:33:29 +01:00
Benjamin Eberlei
755f0b3dbb Add section about columnDefinition into basic mapping. 2011-02-15 21:33:24 +01:00
Benjamin Eberlei
35dae4e1f4 Add note about columnDefinition SchemaTool. 2011-02-15 21:31:20 +01:00
Jonathan H. Wage
1d24cb4828 Removing indices and tables as they are just broken links and don't do anything. 2011-02-13 16:24:52 -06:00
Benjamin Eberlei
24defe7100 Add notes to Tools about EntityGenerator, ConvertMapping and Reverse Engineering 2011-02-13 12:57:04 +01:00
Benjamin Eberlei
6309710ccc Fix some glitches in the docs: 2011-02-13 12:47:51 +01:00
Benjamin Eberlei
b794643735 Updated Limitations and Known Issues Chapter 2011-02-05 18:08:39 +01:00
Benjamin Eberlei
a592dc116d First part of a tutorial on composite primary keys and identity through foreign entities. 2011-02-05 18:01:10 +01:00
Benjamin Eberlei
eea5b71da5 Add tutorial on extra lazy associations 2011-02-05 16:14:51 +01:00
Benjamin Eberlei
93207c081e Add another paragraph with functionalities not described yet. 2011-02-05 15:26:58 +01:00
Benjamin Eberlei
94244683b0 Fix typo in new indexed assocations tutorial, thanks @gordonslondon 2011-02-05 15:23:39 +01:00
Benjamin Eberlei
609176a18f Merge branch 'master' of github.com:doctrine/orm-documentation 2011-02-05 13:48:41 +01:00
Benjamin Eberlei
c0cefa8749 Fixed TOCTree for tutorial on indexed associations. 2011-02-05 13:48:12 +01:00
Benjamin Eberlei
0f974c562c Add Working with Indexed Associations Tutorial 2011-02-05 13:43:45 +01:00
Ivar Nesje
af60471b62 fixed indentation on previous commit 2011-02-02 06:37:13 +08:00
Ivar Nesje
8fc7eb295b Fixed lifecycleCallbacks documentation bug when using YAML mapping 2011-02-02 06:37:03 +08:00
Ray Rehbein
2a38e5f408 Syntex and code correction in example 2011-02-02 05:48:49 +08:00
Ray Rehbein
be8d34dc21 Whitespace correction 2011-02-02 05:48:19 +08:00
Ray Rehbein
fc6cec9074 Added setParamater calls to examples
Whitespace changes to break up the long SQL lines into a readable format
2011-02-02 05:48:18 +08:00
Ray Rehbein
0411b1e75d Attempt at correction for a formatting glitch.
It appears Sphinx doesn't use the `` mark in the middle of a word correctly
2011-02-02 05:48:18 +08:00
Ray Rehbein
d81dca3e90 Corrected example calling wrong method name 2011-02-02 05:48:18 +08:00
Ray Rehbein
c89290e507 Corrected mismatch between example and comment entities. 2011-02-02 05:48:17 +08:00
Joel Clermont
754ebc052e DDC-823 - Fix minor grammar and punctuation mistakes 2011-02-02 05:46:25 +08:00
Benjamin Eberlei
7d42497e09 Fix typo with SQLLogger in configuration.rst 2011-01-31 22:56:09 +01:00
Benjamin Eberlei
7093e37b45 Merge branch 'master' of github.com:doctrine/orm-documentation 2011-01-31 22:47:13 +01:00
Benjamin Eberlei
51bdd6499a Fix typo in codeigniter coobkok entry 2011-01-31 22:46:41 +01:00
Benjamin Eberlei
0e5b30902c Enhanced QueryBuilder docs with paragraph on limit and executing queries. 2011-01-23 11:16:25 +01:00
Benjamin Eberlei
721915d61b Fix bug in configurationblock.css destroying simple bullet lists. 2011-01-02 11:53:12 +01:00
Benjamin Eberlei
f4e93e7550 Add section on orphan removal to Working with Associations chapter. 2011-01-02 11:18:22 +01:00
Benjamin Eberlei
4a231a34f2 Clarify MappedSuperclass and Unidirectional associations (with info on one-to-many and many-to-many associations). 2010-12-31 14:44:14 +01:00
Benjamin Eberlei
72081ff7ba Note that Native SQL Query is not to be used for DELETE, UPDATE and INSERT statements. 2010-12-30 22:13:57 +01:00
Benjamin Eberlei
ef8689c400 Incorporate DDC-879 into Cookbook. 2010-12-28 00:23:06 +01:00
Benjamin Eberlei
6bf2f22315 Add another note about how Query#setParameter() accepts named or positional parameters. 2010-12-20 22:19:02 +01:00
Benjamin Eberlei
34057c5e4b Add note about how Query#setParameter() accepts named or positional parameters. 2010-12-20 22:12:24 +01:00
Benjamin Eberlei
53ebc683c9 Update limitations and known issues section in manual. 2010-12-20 21:51:05 +01:00
Benjamin Eberlei
2eab525077 Fix some small problems in the docs. 2010-12-18 17:14:20 +01:00
Benjamin Eberlei
6a0f3f2d7b Add code-configuration directive, thank you Fabien! 2010-12-16 21:59:27 +01:00
Benjamin Eberlei
65fe9b86c5 Fix another code block 2010-12-14 23:35:17 +01:00
Benjamin Eberlei
76743431a4 Fix wrong code in Mini tutorial 2010-12-14 23:34:41 +01:00
Benjamin Eberlei
2e00e9d715 Fix another mess in Mini Tutorial. 2010-12-14 23:33:31 +01:00
Benjamin Eberlei
c8e7ff51c4 Merge branch 'master' of github.com:doctrine/orm-documentation 2010-12-14 23:32:57 +01:00
Benjamin Eberlei
6e7f47bf9e Fix mess in Mini-Tutorial of Introduction chapter. 2010-12-14 23:29:05 +01:00
ajessu
34dc2e6506 Delete duplicate item on menu 2010-12-15 00:41:09 +08:00
Benjamin Eberlei
29b47d3d44 Fix @Table not supporting schema as attribute anymore. 2010-12-12 13:18:18 +01:00
Benjamin Eberlei
0618944f8a DDC-901 - Fix documentation bug in Cookbook SQL Walker entry. 2010-12-12 13:12:44 +01:00
Albert Jessurum
d37120bb15 Fixed links 2010-12-12 18:04:13 +08:00
beberlei
5d58d9171e Merge ReST branch into master, ByeBye Markdown. 2010-12-11 12:31:31 +01:00
beberlei
9c6d3dbecd Add link to Doctrine homepage to docs layout template. 2010-12-11 11:29:37 +01:00
Benjamin Eberlei
eb0fd4d066 Add section about database and unit of work being out of sync and how this effects your code. 2010-12-11 01:01:44 +01:00
Benjamin Eberlei
01c2a09991 Add Working with DateTime chapter. 2010-12-03 22:47:33 +01:00
Benjamin Eberlei
46983465fd Finialized ReST doc changes, merged changes from latest Markdown docs. 2010-12-03 20:13:10 +01:00
Benjamin Eberlei
6789f2c8d1 Several changes and fixes to the docs. 2010-12-03 17:58:01 +01:00
Benjamin Eberlei
1b9e9c019d DDC-862 - Fix Codeigniter Cookbook entry 2010-11-16 22:03:27 +01:00
Benjamin Eberlei
49ecdff016 DDC-763 - Add note about handling merges of multiple entities which share subgraphs of objects 2010-11-10 23:49:07 +01:00
Benjamin Eberlei
f2b20e5949 DDC-736 - Add note about order of the identfication variables during fetch joins requirements. 2010-11-10 23:43:24 +01:00
goran
54a61bbbc2 Changed method name in an example for fetching class metadata 2010-11-11 03:24:14 +08:00
Timo A. Hummel
69d4e185d8 Added documentation notice regarding @version in combination with @id (DDC-873) 2010-11-11 03:23:52 +08:00
Timo A. Hummel
87c1c50bfa Fixed documentation issue for cascade="ALL" (DDC-850) 2010-11-11 03:23:11 +08:00
Benjamin Eberlei
de1d72f348 DDC-866 - Fix EBNF grammer rule 2010-11-09 22:19:07 +01:00
Benjamin Eberlei
ee042bc642 Some changes left 2010-11-09 22:18:25 +01:00
Benjamin Eberlei
c22bddc9a7 DDC-866 Fix deprecated EBNF rule 2010-11-09 22:17:31 +01:00
Benjamin Eberlei
a5a0dfa96e Converted ORM Docs into ReST 2010-11-01 22:03:50 +01:00
Benjamin Eberlei
e7e1f62f72 Add Sphinx Configs 2010-11-01 21:21:07 +01:00
Benjamin Eberlei
aa25b7cc0a Add Sphinx Configs 2010-11-01 21:21:01 +01:00
Benjamin Eberlei
1bfeaf3eaf Initial conversion from Markdown to ReST - Finalized Cookbook 2010-11-01 21:16:12 +01:00
Benjamin Eberlei
6985b671d8 Add note about float type 2010-10-31 15:13:51 +01:00
Benjamin Eberlei
468c878c92 Add hint about multiple directories in Metadata drivers to configuration section 2010-10-31 07:34:43 +01:00
Benjamin Eberlei
05f5ae1519 DDC-732 - Document sql schema requirements for inheritance strategies 2010-10-30 18:16:13 +02:00
Benjamin Eberlei
61640ef7ce Add Note that this is not a holy-grail but may need adjustments for other versions 2010-10-30 12:08:28 +02:00
Benjamin Eberlei
833a4a9319 Clarify not to use prefix blacklash in targetEntity 2010-10-29 14:12:29 +02:00
Benjamin Eberlei
3182f150c1 Fix a little render glitch 2010-10-29 13:30:02 +02:00
Jonathan H. Wage
62aef84205 Merge remote branch 'ralfas/master' 2010-10-18 17:15:38 -05:00
Benjamin Eberlei
9c63363ccc Add details on the negative performance impact of STI and CTI in many-to-one or one-to-one scenarios 2010-10-11 20:36:52 +02:00
Ralfas
e4b1357a22 fixed typos and grammar 2010-10-07 22:39:52 +01:00
Ralfas
f8ba66bb0c fixed typos 2010-10-05 22:43:56 +01:00
Ralfas
61c1f0e1ed fixed typos 2010-10-05 13:11:34 +01:00
Ralfas
8ac6d29c74 fixed typos 2010-10-05 13:09:10 +01:00
Ralfas
6b01986c48 fixed typos 2010-10-05 12:58:43 +01:00
Ralfas
efe2a18189 2010-10-04 11:29:40 -07:00
Benjamin Eberlei
e9617f1e50 DDC-798 - Clarify parameters for MEMBER OF expression 2010-09-30 22:09:49 +02:00
Benjamin Eberlei
4f18aaaf6e DDC-797 - Fix dql example bug 2010-09-30 22:05:39 +02:00
Benjamin Eberlei
d2efb5bbc8 Add NOT INSTANCE OF use-case to DQL manual 2010-09-27 22:59:50 +02:00
Benjamin Eberlei
e8eed2ebae Add legacy identifier quoting to the list of Known Issues 2010-09-23 22:48:39 +02:00
Benjamin Eberlei
7a8b69edbb Extend restriction and caution notes on identifier quoting 2010-09-23 22:40:12 +02:00
Benjamin Eberlei
bebc8cf871 Add section about deferred schema validation into association mapping chapter, add note about private/protected property in entities for lazy-laoding purposes, added subchapters on identity map internals and object graph traversal to the Working with Objects section 2010-09-21 21:55:35 +02:00
Christian Heinrich
453341c754 Updated strategy cookbook introduction
- Removed annoying tabs
- Removed some comments
- Hopefully, it will display now correctly
2010-09-20 10:53:29 -05:00
Michael Ridgway
13a99c30ea Fixed example in Establishing Associations 2010-09-09 12:39:02 -05:00
Christian Heinrich
e342b4536a Added a caution sign for case-sensitivity of mapping types.
This might help to prevent beginners from being confused when an error is raised due to
wrong spelling. (Like DateTime (wrong) <-> datetime (right))
2010-09-06 11:09:54 -05:00
Benjamin Eberlei
3d7eb3bac8 Enhanced Native SQL documentation 2010-09-04 09:19:05 +02:00
Christian Heinrich
d8dd44aa16 Added a naming convention for events 2010-09-03 10:50:56 -05:00
Benjamin Eberlei
d4489d1bdc Added large Note/Warning on SchemaTool usage and assumptions 2010-08-31 23:23:05 +02:00
Benjamin Eberlei
a6cdafe85c Merge branch 'master' of github.com:doctrine/orm-documentation 2010-08-31 23:10:45 +02:00
beberlei
088ccf58fc Updated XML Cookbook Getting Started and Tools Chapter 2010-08-29 10:50:07 +02:00
beberlei
d2d32e5439 Fix Cookbook XML Getting Started still refering to old Doctrine Console 2010-08-29 10:38:57 +02:00
Christian Heinrich
4232509427 Renamed a variable 2010-08-17 14:01:43 -05:00
Benjamin Eberlei
82874181b0 Add section on INSTANCE OF Dql Operator 2010-08-08 21:20:58 +02:00
Benjamin Eberlei
9fa64adbda Added another fact to Limitations section 2010-08-08 21:14:56 +02:00
Jonathan H. Wage
70d12fc57a [DDC-663] Making example for installing via pear more generic. 2010-08-08 12:21:03 -05:00
Your Name
732dee92ad I guess you meant "Now you can test" or "Now test the ..." 2010-08-02 08:41:31 -05:00
Your Name
fa5768b14d Fixed typos 2010-08-02 08:41:31 -05:00
Your Name
1fe35e518c Fixed typo 2010-08-02 08:41:31 -05:00
Benjamin Eberlei
d859a77b52 Fix a typo, reworked main paragraph and moved behavior section to bottom 2010-08-01 17:09:02 +02:00
Benjamin Eberlei
f89646eabe Added note about NestedSet to limitations section 2010-08-01 17:02:27 +02:00
Benjamin Eberlei
ec307a6046 Added small block on not supporting behaviors to limitations section 2010-08-01 16:56:36 +02:00
Benjamin Eberlei
437f14aa4e Fix bug in ticket link 2010-08-01 16:44:01 +02:00
Benjamin Eberlei
c5512b933e Add Limitations and Known Issues Appendix to the manual 2010-08-01 16:41:22 +02:00
Benjamin Eberlei
a6b5ee3cd3 Add Limitations and Known Issues Appendix to the manual 2010-08-01 16:37:53 +02:00
Benjamin Eberlei
93c061b7a5 Fixed some escaping issue with xml reference 2010-08-01 15:47:34 +02:00
Benjamin Eberlei
a34bab7f1e Merge branch 'master' of github.com:doctrine/orm-documentation 2010-08-01 15:44:13 +02:00
Benjamin Eberlei
96538ae2fe Seperated Change Tracking Policies and Partial Objects from Configuration Chapter, Finished XML Mapping Chapter with a reference on all tags and attributes 2010-08-01 15:41:40 +02:00
Roman S. Borschel
fcea78a6cb Updated merging docs. 2010-07-31 12:00:42 +02:00
Your Name
bf23503000 Missing field name? 2010-07-30 01:46:52 +08:00
Benjamin Eberlei
84c1cc8865 Fix bug in the documentation leading to an error 2010-07-24 15:16:13 +02:00
Benjamin Eberlei
c6e423024e Reference Configuration section for bootstrapping after each Install section 2010-07-24 14:23:35 +02:00
Benjamin Eberlei
9c28cc5b19 Rephrased some sentences in Working with Assocations 2010-07-24 10:53:35 +02:00
Benjamin Eberlei
23efc790c1 Split Working with Objects into two chapters, adding Working with Associations 2010-07-24 10:46:54 +02:00
Benjamin Eberlei
99533afd11 Added EntityManager interaction into examples 2010-07-23 23:51:25 +02:00
Benjamin Eberlei
f309190486 Clarified up and downsides of $collection->toArray() 2010-07-23 23:46:47 +02:00
Benjamin Eberlei
3b76ea9ffe Fix code box in Note 2010-07-23 23:43:44 +02:00
Benjamin Eberlei
e0c702d068 Fix little bug in Note box 2010-07-23 23:42:03 +02:00
Benjamin Eberlei
b5e5cb1c65 Removed examples of Nested Path Expressions from DQL docs 2010-07-23 23:39:36 +02:00
Benjamin Eberlei
31b8141fee Reworked Introduction a bit 2010-07-23 23:31:27 +02:00
Benjamin Eberlei
62c4f3e6fb Updated documentation on chosing inverse-owning side for many-to-many associations and came up with a significantly enhanced example for the working with associations chapter 2010-07-23 23:21:17 +02:00
Benjamin Eberlei
298773b2f8 Added section on collection field initialization and added constructors with initialization to all examples of toMany collections 2010-07-23 21:36:25 +02:00
Benjamin Eberlei
0a066533de Rephrased Obtaining Entity Manager and moved some sentences around 2010-07-22 23:38:09 +02:00
Benjamin Eberlei
f8c22abaa6 Use $applicationMode flag in obtaining entity manager example to make sure people understand that different settings for production and development are necessary 2010-07-22 23:30:17 +02:00
Benjamin Eberlei
974e31a307 Use $applicationMode flag in obtaining entity manager example to make sure people understand that different settings for production and development are necessary 2010-07-22 23:29:21 +02:00
Benjamin Eberlei
d5afa35cb8 Added dev vs production configuration section 2010-07-22 23:25:29 +02:00
Benjamin Eberlei
439cccbc0d Enhanced Bootstrap Section for more information on Autoloading in different setups (PEAR vs Git) 2010-07-22 22:55:00 +02:00
Benjamin Eberlei
b1f6fe2528 Updated Introduction to be more consistent with current Github development model 2010-07-18 22:57:20 +02:00
Benjamin Eberlei
a851e08109 Updated Introduction to be more consistent with current Github development model 2010-07-18 22:55:36 +02:00
Benjamin Eberlei
e7066d6f36 Updated Introduction to be more consistent with current Github development model 2010-07-18 22:45:17 +02:00
Benjamin Eberlei
29cb77b964 Merge branch 'master' of github.com:doctrine/orm-documentation 2010-07-18 21:13:07 +02:00
Benjamin Eberlei
4c813f60f9 Updated Aggregate Fields, Added generated SQL for all Association Mappings 2010-07-18 21:12:51 +02:00
beberlei
0c8e0450de Merge branch 'master' of github.com:doctrine/orm-documentation 2010-07-10 08:33:17 +02:00
beberlei
1017e2c6c7 Extended details on how to remove entities and their associations 2010-07-10 08:33:12 +02:00
Roman S. Borschel
0428774ec8 Added more information about flushing semantics. 2010-07-08 00:26:57 +02:00
Benjamin Eberlei
59aafe100b Added Aggregate Fields documentation 2010-07-07 22:34:51 +02:00
eXtreme
400be2a3e6 fixing codeblocks 2010-07-07 22:19:36 +08:00
Benjamin Eberlei
8d2da96480 Fixed error in Sandbox Tutorial 2010-07-04 18:57:51 +02:00
Benjamin Eberlei
80fd691880 Update docs on using own types, aswell as on using Collection::clear() 2010-07-03 16:57:02 +02:00
Lars Olesen
8e7385ccc2 Added the name space in front of Xmldriver, as it is not stated anywhere on this page which namespace is used. 2010-06-21 05:35:07 +08:00
Lars Olesen
16740b9695 Fixes typo. 2010-06-21 05:35:07 +08:00
Jonathan H. Wage
823db6071b Changing case. 2010-06-17 13:32:11 -04:00
Jonathan H. Wage
27233af0d2 Removing reference to Query object before it is introduced 2010-06-17 12:09:11 -04:00
Jonathan H. Wage
e71f00296e Fixing php code 2010-06-17 12:07:43 -04:00
Jonathan H. Wage
c7a5a695d3 [DDC-246] Added section showing DQL examples when dealing with SINGLE_TABLE and JOINED inheritance since it affects the generated SQL of a DQL query. 2010-06-17 12:03:01 -04:00
Jonathan H. Wage
cc2d84c992 Adding php syntax highlighting 2010-06-17 10:07:18 -04:00
Jonathan H. Wage
53ec0700bb Merge branch 'master' of github.com:doctrine/orm-documentation 2010-06-17 10:02:14 -04:00
Jonathan H. Wage
88e5babb56 [DDC-572] Updating documentation for inversedBy and mappedBy 2010-06-17 10:01:49 -04:00
beberlei
50e35e6bdc Merge branch 'master' of github.com:doctrine/orm-documentation 2010-06-10 23:27:28 +02:00
beberlei
d872d7f0b1 Updated Cookbook Getting Started XML Edition Tutorial with Array and Scalar Hydration examples, tweaked several passages a little bit 2010-06-10 21:38:22 +02:00
beberlei
51729cbaa7 Enhanced Description of how the different events work and what restrictions apply to them. 2010-06-10 21:06:23 +02:00
Thibault Duplessis
854a966a22 Fix Query::HYDRATE_SINGLE_SCALAR in single scalar result example 2010-06-07 16:54:22 -07:00
Jonathan H. Wage
9d2f7f0686 Updating documentation for custom hydrators. 2010-06-03 14:13:39 -04:00
Jonathan H. Wage
37124c4e0a Adding section for custom hydrators. 2010-06-02 23:41:41 -04:00
Jonathan H. Wage
30b9cfce3d [DDC-540] Doc improvement 2010-05-25 13:38:16 -04:00
Rich Bowen
e127274aa5 Fixes missing quote. 2010-05-24 15:34:58 -04:00
Roman S. Borschel
c34b5ad1a7 Added strategy cookbook entry to the index. 2010-05-22 13:52:20 +02:00
Jonathan H. Wage
10b676aa2b Merge commit '5c79ca25aabaf574d71d6bc622c13fd6045626d2' 2010-05-20 08:35:02 -04:00
Jonathan H. Wage
0698a8c455 Fixing php code 2010-05-18 11:51:49 -04:00
Jonathan H. Wage
1193c530c9 Merge branch 'master' of github.com:doctrine/orm-documentation 2010-05-18 11:50:18 -04:00
Jonathan H. Wage
18b9c6cd69 Updating documentation for converting mapping information and reverse engineering databases to entities. 2010-05-18 11:49:44 -04:00
Benjamin Eberlei
9231f54313 DDC-153 - Added cookbook entry contributed by merk (thanks!) 2010-05-16 09:50:07 +02:00
Benjamin Eberlei
72c2432586 DDC-590 - Added docs on Locking Support 2010-05-15 11:27:49 +02:00
Christian Heinrich
5c79ca25aa Updated formatting and fixed mistakes 2010-05-15 00:40:18 +02:00
Jonathan H. Wage
a59b62e3ba Merge remote branch 'mridgway/master' 2010-05-14 15:26:28 -04:00
Jonathan H. Wage
f99a096d01 Adding a little more information to the dql chapter. 2010-05-14 15:23:51 -04:00
Michael Ridgway
a3b42392b4 Fixed broken reference to DBAL section 2010-05-14 11:32:12 -07:00
Jonathan H. Wage
5a79963bd2 Removing dbal documentation from orm docs 2010-05-14 11:12:54 -04:00
Roman S. Borschel
184a402f39 Fixed typo 2010-05-13 13:14:37 +02:00
Roman S. Borschel
7d79777bfb Merge commit 'origin/master' 2010-05-13 13:06:20 +02:00
Roman S. Borschel
84c1d34028 Added documentation about control abstractions for transaction handling. 2010-05-13 13:06:16 +02:00
Christian Heinrich
21bbbb1f1f Updated query builder docs 2010-05-13 00:58:17 +02:00
Benjamin Eberlei
177a9ce4d2 Update Getting Started XML Edition to work with inversed-by attributes 2010-05-12 23:53:09 +02:00
Benjamin Eberlei
150bca0498 Merge branch 'master' of github.com:doctrine/orm-documentation 2010-05-12 23:52:38 +02:00
Jonathan H. Wage
0c60efc03b Merge remote branch 'shurakai/master' 2010-05-12 09:29:31 -04:00
Christian Heinrich
b857655992 Improved query builder section
-> Added a new section about binding params to the query
-> Added a short note on how to use $qb->expr()->in() with string values
2010-05-12 14:43:09 +02:00
Jonathan H. Wage
dd6eafbb6c Merge branch 'master' of github.com:doctrine/orm-documentation 2010-05-11 11:45:28 -04:00
Roman S. Borschel
0799a5b5e9 Polished docs on DBAL, Transactions and Concurrency. 2010-05-11 15:26:35 +02:00
Matthieu Bontemps
a1079e692c Fix a few typos in doctrine manual 2010-05-11 11:46:10 +02:00
Christian Heinrich
f9b77f9854 Added strategy cookbook preview 2010-05-10 18:26:32 +02:00
Roman S. Borschel
bc0f853b52 Clarified docs on identifier generation strategies. 2010-05-06 13:08:36 +02:00
Roman S. Borschel
a3feeef88c Clarified docs on identifier generation strategies. 2010-05-06 13:07:54 +02:00
Roman S. Borschel
c18e23b817 Clarified docs on identifier generation strategies. 2010-05-06 13:02:21 +02:00
Roman S. Borschel
4121c1ca72 Clarified docs on identifier generation strategies. 2010-05-06 12:45:46 +02:00
Roman S. Borschel
7ffdd80bb2 Clarified docs on working with objects. 2010-05-05 11:10:00 +02:00
Roman S. Borschel
51f9fb35c6 Merge commit 'origin/master' 2010-05-05 10:58:49 +02:00
Roman S. Borschel
e155e86517 Clarified docs on persisting new objects. 2010-05-05 10:58:11 +02:00
Benjamin Eberlei
d835372e93 Merge branch 'master' of github.com:doctrine/orm-documentation 2010-05-01 03:38:27 +02:00
Benjamin Eberlei
b4bc4b029d Fix DDC-560 2010-05-01 03:38:03 +02:00
Benjamin Eberlei
c0dc0112d3 Fix DDC-557 2010-05-01 03:36:40 +02:00
Jonathan H. Wage
e01510953e [DDC-443] Adding many-to-one unidirectional example 2010-04-30 16:11:35 -04:00
Roman S. Borschel
74ecfca43e Fixed section about partial objects. 2010-04-29 23:44:25 +02:00
Benjamin Eberlei
6d34b91425 DDC-539 - Fix typo 2010-04-26 21:54:10 +02:00
Jonathan H. Wage
605ee881c5 Misc. fixes and initial entry of PHP Mapping and Metadata Drivers chapters. 2010-04-26 11:55:43 -04:00
Jonathan H. Wage
fc290404e1 Changing note to caution 2010-04-23 12:16:31 -04:00
Benjamin Eberlei
d837a2110b Updated XML Getting Started Tutorial to comply with current Console API 2010-04-18 19:31:41 +02:00
Benjamin Eberlei
8426a3da11 DDC-510 - Updated docs to reflect that Annotations Metadata Driver is not a default anymore, but required to specifiy 2010-04-12 21:58:21 +02:00
Benjamin Eberlei
2a1f5e121b DDC-442 - Fix example for timestamp optimistic lock 2010-04-11 14:38:19 +02:00
Benjamin Eberlei
997ef97521 Updated SchemaTool usage docs with mapping paths information example 2010-04-10 12:04:23 +02:00
Benjamin Eberlei
8aed5c72df Updated ORM Tools Documentation 2010-04-10 11:50:40 +02:00
Guilherme Blanco
d1fbaae91f [2.0-DOC] Changed manual with new Console implementation 2010-04-09 01:09:14 -03:00
Jonathan H. Wage
ee34c42697 Adding dbal chapter back 2010-04-06 14:43:34 -04:00
Jonathan H. Wage
2adf9378e4 - 2010-04-06 14:37:15 -04:00
Jonathan H. Wage
1e7193134a - 2010-04-06 14:36:40 -04:00
Jonathan H. Wage
33ff1df4ec Adding cookbook 2010-04-06 14:30:12 -04:00
Jonathan H. Wage
69158cd4f3 first commit 2010-04-06 14:27:51 -04:00
2235 changed files with 180942 additions and 103872 deletions

123
.doctrine-project.json Normal file
View File

@@ -0,0 +1,123 @@
{
"active": true,
"name": "Object Relational Mapper",
"shortName": "ORM",
"slug": "orm",
"docsSlug": "doctrine-orm",
"versions": [
{
"name": "4.0",
"branchName": "4.0.x",
"slug": "latest",
"upcoming": true
},
{
"name": "3.1",
"branchName": "3.1.x",
"slug": "3.1",
"upcoming": true
},
{
"name": "3.0",
"branchName": "3.0.x",
"slug": "3.0",
"current": true
},
{
"name": "2.19",
"branchName": "2.19.x",
"slug": "2.19",
"upcoming": true
},
{
"name": "2.18",
"branchName": "2.18.x",
"slug": "2.18",
"maintained": true
},
{
"name": "2.17",
"branchName": "2.17.x",
"slug": "2.17",
"maintained": false
},
{
"name": "2.16",
"branchName": "2.16.x",
"slug": "2.16",
"maintained": false
},
{
"name": "2.15",
"branchName": "2.15.x",
"slug": "2.15",
"maintained": false
},
{
"name": "2.14",
"branchName": "2.14.x",
"slug": "2.14",
"maintained": false
},
{
"name": "2.13",
"branchName": "2.13.x",
"slug": "2.13",
"maintained": false
},
{
"name": "2.12",
"branchName": "2.12.x",
"slug": "2.12",
"maintained": false
},
{
"name": "2.11",
"branchName": "2.11.x",
"slug": "2.11",
"maintained": false
},
{
"name": "2.10",
"branchName": "2.10.x",
"slug": "2.10",
"maintained": false
},
{
"name": "2.9",
"branchName": "2.9.x",
"slug": "2.9",
"maintained": false
},
{
"name": "2.8",
"branchName": "2.8.x",
"slug": "2.8",
"maintained": false
},
{
"name": "2.7",
"branchName": "2.7",
"slug": "2.7",
"maintained": false
},
{
"name": "2.6",
"branchName": "2.6",
"slug": "2.6",
"maintained": false
},
{
"name": "2.5",
"branchName": "2.5",
"slug": "2.5",
"maintained": false
},
{
"name": "2.4",
"branchName": "2.4",
"slug": "2.4",
"maintained": false
}
]
}

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
/.github export-ignore
/ci export-ignore
/docs export-ignore
/tests export-ignore
/tools export-ignore
.doctrine-project.json export-ignore
.gitattributes export-ignore
.gitignore export-ignore
build.properties export-ignore
build.properties.dev export-ignore
build.xml export-ignore
CONTRIBUTING.md export-ignore
phpunit.xml.dist export-ignore
run-all.sh export-ignore
phpcs.xml.dist export-ignore
phpbench.json export-ignore
phpstan.neon export-ignore
phpstan-baseline.neon export-ignore
phpstan-dbal2.neon export-ignore
phpstan-params.neon export-ignore
phpstan-persistence2.neon export-ignore
psalm.xml export-ignore
psalm-baseline.xml export-ignore

37
.github/ISSUE_TEMPLATE/BC_Break.md vendored Normal file
View File

@@ -0,0 +1,37 @@
---
name: 💥 BC Break
about: Have you encountered an issue during upgrade? 💣
---
<!--
Before reporting a BC break, please consult the upgrading document to make sure it's not an expected change: https://github.com/doctrine/orm/blob/2.9.x/UPGRADE.md
-->
### BC Break Report
<!-- Fill in the relevant information below to help triage your issue. -->
| Q | A
|------------ | ------
| BC Break | yes
| Version | x.y.z
#### Summary
<!-- Provide a summary describing the problem you are experiencing. -->
#### Previous behavior
<!-- What was the previous (working) behavior? -->
#### Current behavior
<!-- What is the current (broken) behavior? -->
#### How to reproduce
<!--
Provide steps to reproduce the BC break.
If possible, also add a code snippet with relevant configuration, entity mappings, DQL etc.
Adding a failing Unit or Functional Test would help us a lot - you can submit it in a Pull Request separately, referencing this bug report.
-->

34
.github/ISSUE_TEMPLATE/Bug.md vendored Normal file
View File

@@ -0,0 +1,34 @@
---
name: 🐞 Bug Report
about: Something is broken? 🔨
---
### Bug Report
<!-- Fill in the relevant information below to help triage your issue. -->
| Q | A
|------------ | ------
| BC Break | yes/no
| Version | x.y.z
#### Summary
<!-- Provide a summary describing the problem you are experiencing. -->
#### Current behavior
<!-- What is the current (buggy) behavior? -->
#### How to reproduce
<!--
Provide steps to reproduce the bug.
If possible, also add a code snippet with relevant configuration, entity mappings, DQL etc.
Adding a failing Unit or Functional Test would help us a lot - you can submit one in a Pull Request separately, referencing this bug report.
-->
#### Expected behavior
<!-- What was the expected (correct) behavior? -->

View File

@@ -0,0 +1,18 @@
---
name: 🎉 Feature Request
about: You have a neat idea that should be implemented? 🎩
---
### Feature Request
<!-- Fill in the relevant information below to help triage your issue. -->
| Q | A
|------------ | ------
| New Feature | yes
| RFC | yes/no
| BC Break | yes/no
#### Summary
<!-- Provide a summary of the feature you would like to see implemented. -->

View File

@@ -0,0 +1,6 @@
---
name: ❓ Support Question
about: Have a problem that you can't figure out? 🤔
---
Please use https://github.com/doctrine/orm/discussions instead.

View File

@@ -0,0 +1,19 @@
---
name: 🐞 Failing Test
about: You found a bug and have a failing Unit or Functional test? 🔨
---
### Failing Test
<!-- Fill in the relevant information below to help triage your issue. -->
| Q | A
|------------ | ------
| BC Break | yes/no
| Version | x.y.z
#### Summary
<!-- Provide a summary of the failing scenario. -->

View File

@@ -0,0 +1,18 @@
---
name: ⚙ Improvement
about: You have some improvement to make Doctrine better? 🎁
---
### Improvement
<!-- Fill in the relevant information below to help triage your issue. -->
| Q | A
|------------ | ------
| New Feature | yes
| RFC | yes/no
| BC Break | yes/no
#### Summary
<!-- Provide a summary of the improvement you are submitting. -->

View File

@@ -0,0 +1,26 @@
---
name: 🎉 New Feature
about: You have implemented some neat idea that you want to make part of Doctrine? 🎩
---
<!--
Thank you for submitting new feature!
Pick the target branch based according to these criteria:
* submitting a bugfix: target the lowest active stable branch: 2.9.x
* submitting a new feature: target the next minor branch: 2.10.x
* submitting a BC-breaking change: target the next major branch: 3.0.x
-->
### New Feature
<!-- Fill in the relevant information below to help triage your issue. -->
| Q | A
|------------ | ------
| New Feature | yes
| RFC | yes/no
| BC Break | yes/no
#### Summary
<!-- Provide a summary of the feature you have implemented. -->

27
.github/workflows/coding-standards.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: "Coding Standards"
on:
pull_request:
branches:
- "*.x"
paths:
- .github/workflows/coding-standards.yml
- bin/**
- composer.*
- src/**
- phpcs.xml.dist
- tests/**
push:
branches:
- "*.x"
paths:
- .github/workflows/coding-standards.yml
- bin/**
- composer.*
- src/**
- phpcs.xml.dist
- tests/**
jobs:
coding-standards:
uses: "doctrine/.github/.github/workflows/coding-standards.yml@3.0.0"

View File

@@ -0,0 +1,342 @@
name: "Continuous Integration"
on:
pull_request:
branches:
- "*.x"
paths:
- .github/workflows/continuous-integration.yml
- ci/**
- composer.*
- src/**
- phpunit.xml.dist
- tests/**
push:
branches:
- "*.x"
paths:
- .github/workflows/continuous-integration.yml
- ci/**
- composer.*
- src/**
- phpunit.xml.dist
- tests/**
env:
fail-fast: true
jobs:
phpunit-smoke-check:
name: "PHPUnit with SQLite"
runs-on: "ubuntu-22.04"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
dbal-version:
- "default"
- "3.7"
extension:
- "sqlite3"
- "pdo_sqlite"
deps:
- "highest"
include:
- php-version: "8.2"
dbal-version: "4@dev"
extension: "pdo_sqlite"
- php-version: "8.2"
dbal-version: "4@dev"
extension: "sqlite3"
- php-version: "8.1"
dbal-version: "default"
deps: "lowest"
extension: "pdo_sqlite"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "apcu, pdo, ${{ matrix.extension }}"
coverage: "pcov"
ini-values: "zend.assertions=1, apc.enable_cli=1"
- name: "Require specific DBAL version"
run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update"
if: "${{ matrix.dbal-version != 'default' }}"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"
dependency-versions: "${{ matrix.deps }}"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage-no-cache.xml"
env:
ENABLE_SECOND_LEVEL_CACHE: 0
- name: "Run PHPUnit with Second Level Cache"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --exclude-group performance,non-cacheable,locking_functional --coverage-clover=coverage-cache.xml"
env:
ENABLE_SECOND_LEVEL_CACHE: 1
- name: "Upload coverage file"
uses: "actions/upload-artifact@v3"
with:
name: "phpunit-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage"
path: "coverage*.xml"
phpunit-postgres:
name: "PHPUnit with PostgreSQL"
runs-on: "ubuntu-22.04"
needs: "phpunit-smoke-check"
strategy:
matrix:
php-version:
- "8.2"
- "8.3"
dbal-version:
- "default"
- "3.7"
postgres-version:
- "15"
extension:
- pdo_pgsql
- pgsql
include:
- php-version: "8.2"
dbal-version: "4@dev"
postgres-version: "14"
extension: pdo_pgsql
- php-version: "8.2"
dbal-version: "3.7"
postgres-version: "9.6"
extension: pdo_pgsql
services:
postgres:
image: "postgres:${{ matrix.postgres-version }}"
env:
POSTGRES_PASSWORD: "postgres"
options: >-
--health-cmd "pg_isready"
ports:
- "5432:5432"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "pgsql pdo_pgsql"
coverage: "pcov"
ini-values: "zend.assertions=1, apc.enable_cli=1"
- name: "Require specific DBAL version"
run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update"
if: "${{ matrix.dbal-version != 'default' }}"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_pgsql.xml --coverage-clover=coverage.xml"
- name: "Upload coverage file"
uses: "actions/upload-artifact@v3"
with:
name: "${{ github.job }}-${{ matrix.postgres-version }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage"
path: "coverage.xml"
phpunit-mariadb:
name: "PHPUnit with MariaDB"
runs-on: "ubuntu-22.04"
needs: "phpunit-smoke-check"
strategy:
matrix:
php-version:
- "8.2"
- "8.3"
dbal-version:
- "default"
- "3.7"
- "4@dev"
mariadb-version:
- "10.9"
extension:
- "mysqli"
- "pdo_mysql"
services:
mariadb:
image: "mariadb:${{ matrix.mariadb-version }}"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: "doctrine_tests"
options: >-
--health-cmd "mysqladmin ping --silent"
ports:
- "3306:3306"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Require specific DBAL version"
run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update"
if: "${{ matrix.dbal-version != 'default' }}"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1, apc.enable_cli=1"
extensions: "${{ matrix.extension }}"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml"
- name: "Upload coverage file"
uses: "actions/upload-artifact@v3"
with:
name: "${{ github.job }}-${{ matrix.mariadb-version }}-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage"
path: "coverage.xml"
phpunit-mysql:
name: "PHPUnit with MySQL"
runs-on: "ubuntu-22.04"
needs: "phpunit-smoke-check"
strategy:
matrix:
php-version:
- "8.2"
- "8.3"
dbal-version:
- "default"
- "3.7"
mysql-version:
- "5.7"
- "8.0"
extension:
- "mysqli"
- "pdo_mysql"
include:
- php-version: "8.2"
dbal-version: "4@dev"
mysql-version: "8.0"
extension: "mysqli"
- php-version: "8.2"
dbal-version: "4@dev"
mysql-version: "8.0"
extension: "pdo_mysql"
services:
mysql:
image: "mysql:${{ matrix.mysql-version }}"
options: >-
--health-cmd "mysqladmin ping --silent"
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes
-e MYSQL_DATABASE=doctrine_tests
ports:
- "3306:3306"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1, apc.enable_cli=1"
extensions: "${{ matrix.extension }}"
- name: "Require specific DBAL version"
run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update"
if: "${{ matrix.dbal-version != 'default' }}"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--ignore-platform-req=php+"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage-no-cache.xml"
env:
ENABLE_SECOND_LEVEL_CACHE: 0
- name: "Run PHPUnit with Second Level Cache"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --exclude-group performance,non-cacheable,locking_functional --coverage-clover=coverage-no-cache.xml"
env:
ENABLE_SECOND_LEVEL_CACHE: 1
- name: "Upload coverage files"
uses: "actions/upload-artifact@v3"
with:
name: "${{ github.job }}-${{ matrix.mysql-version }}-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.dbal-version }}-coverage"
path: "coverage*.xml"
upload_coverage:
name: "Upload coverage to Codecov"
runs-on: "ubuntu-22.04"
needs:
- "phpunit-smoke-check"
- "phpunit-postgres"
- "phpunit-mariadb"
- "phpunit-mysql"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Download coverage files"
uses: "actions/download-artifact@v3"
with:
path: "reports"
- name: "Upload to Codecov"
uses: "codecov/codecov-action@v3"
with:
directory: reports

44
.github/workflows/documentation.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
name: "Documentation"
on:
pull_request:
branches:
- "*.x"
paths:
- .github/workflows/documentation.yml
- docs/**
push:
branches:
- "*.x"
paths:
- .github/workflows/documentation.yml
- docs/**
jobs:
validate-with-guides:
name: "Validate documentation with phpDocumentor/guides"
runs-on: "ubuntu-22.04"
steps:
- name: "Checkout code"
uses: "actions/checkout@v4"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.2"
- name: "Remove existing composer file"
run: "rm composer.json"
- name: "Require phpdocumentor/guides-cli"
run: "composer require --dev phpdocumentor/guides-cli --no-update"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "highest"
- name: "Run guides-cli"
run: "vendor/bin/guides -vvv --no-progress docs/en 2>&1 | grep -v 'No template found for rendering directive' | ( ! grep WARNING )"

61
.github/workflows/phpbench.yml vendored Normal file
View File

@@ -0,0 +1,61 @@
name: "Performance benchmark"
on:
pull_request:
branches:
- "*.x"
paths:
- .github/workflows/phpbench.yml
- composer.*
- src/**
- phpbench.json
- tests/**
push:
branches:
- "*.x"
paths:
- .github/workflows/phpbench.yml
- composer.*
- src/**
- phpbench.json
- tests/**
env:
fail-fast: true
jobs:
phpbench:
name: "PHPBench"
runs-on: "ubuntu-22.04"
strategy:
matrix:
php-version:
- "8.1"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1, apc.enable_cli=1"
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v3"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
- name: "Install dependencies with composer"
run: "composer update --no-interaction --no-progress"
- name: "Run PHPBench"
run: "vendor/bin/phpbench run --report=default"

View File

@@ -0,0 +1,15 @@
name: "Automatic Releases"
on:
milestone:
types:
- "closed"
jobs:
release:
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@3.0.0"
secrets:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
ORGANIZATION_ADMIN_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }}

89
.github/workflows/static-analysis.yml vendored Normal file
View File

@@ -0,0 +1,89 @@
name: "Static Analysis"
on:
pull_request:
branches:
- "*.x"
paths:
- .github/workflows/static-analysis.yml
- composer.*
- src/**
- phpstan*
- psalm*
- tests/StaticAnalysis/**
push:
branches:
- "*.x"
paths:
- .github/workflows/static-analysis.yml
- composer.*
- src/**
- phpstan*
- psalm*
- tests/StaticAnalysis/**
jobs:
static-analysis-phpstan:
name: Static Analysis with PHPStan
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- dbal-version: default
config: phpstan.neon
- dbal-version: 3.8.2
config: phpstan-dbal3.neon
steps:
- name: "Checkout code"
uses: "actions/checkout@v4"
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "8.2"
tools: cs2pr
- name: Require specific DBAL version
run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update"
if: "${{ matrix.dbal-version != 'default' }}"
- name: Install dependencies with Composer
uses: ramsey/composer-install@v2
- name: Run static analysis with phpstan/phpstan
run: "vendor/bin/phpstan analyse -c ${{ matrix.config }} --error-format=checkstyle | cs2pr"
static-analysis-psalm:
name: Static Analysis with Psalm
runs-on: ubuntu-22.04
strategy:
matrix:
dbal-version:
- default
- 3.8.2
steps:
- name: "Checkout code"
uses: "actions/checkout@v4"
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "8.2"
tools: cs2pr
- name: Require specific DBAL version
run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update"
if: "${{ matrix.dbal-version != 'default' }}"
- name: Install dependencies with Composer
uses: ramsey/composer-install@v2
- name: Run static analysis with Vimeo Psalm
run: vendor/bin/psalm --shepherd

14
.gitignore vendored
View File

@@ -3,9 +3,15 @@ logs/
reports/
dist/
download/
lib/api/
lib/Doctrine/Common
lib/Doctrine/DBAL
/.settings/
.buildpath
.project
.project
.idea
*.iml
vendor/
/tests/Doctrine/Performance/history.db
/.phpcs-cache
composer.lock
.phpunit.cache
.phpunit.result.cache
/*.phpunit.xml

15
.gitmodules vendored
View File

@@ -1,15 +0,0 @@
[submodule "lib/vendor/doctrine-common"]
path = lib/vendor/doctrine-common
url = git://github.com/doctrine/common.git
[submodule "lib/vendor/doctrine-dbal"]
path = lib/vendor/doctrine-dbal
url = git://github.com/doctrine/dbal.git
[submodule "lib/vendor/Symfony/Component/Console"]
path = lib/vendor/Symfony/Component/Console
url = git://github.com/symfony/Console.git
[submodule "lib/vendor/Symfony/Component/Yaml"]
path = lib/vendor/Symfony/Component/Yaml
url = git://github.com/symfony/Yaml.git
[submodule "lib/vendor/doctrine-build-common"]
path = lib/vendor/doctrine-build-common
url = git://github.com/doctrine/doctrine-build-common.git

View File

@@ -1,19 +0,0 @@
language: php
php:
- 5.3
- 5.4
env:
- DB=mysql
- DB=pgsql
- DB=sqlite
before_script:
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS doctrine_tests;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS doctrine_tests_tmp;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database doctrine_tests;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database doctrine_tests_tmp;' -U postgres; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS doctrine_tests_tmp;create database IF NOT EXISTS doctrine_tests;'; fi"
- git submodule update --init
script: phpunit --configuration tests/travis/$DB.travis.xml

69
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,69 @@
# Contribute to Doctrine
Thank you for contributing to Doctrine!
Before we can merge your Pull-Request here are some guidelines that you need to follow.
These guidelines exist not to annoy you, but to keep the code base clean,
unified and future proof.
Doctrine has [general contributing guidelines][contributor workflow], make
sure you follow them.
[contributor workflow]: https://www.doctrine-project.org/contribute/index.html
## Coding Standard
This project follows [`doctrine/coding-standard`][coding standard homepage].
You may fix many some of the issues with `vendor/bin/phpcbf`.
[coding standard homepage]: https://github.com/doctrine/coding-standard
## Unit-Tests
Please try to add a test for your pull-request.
* If you want to fix a bug or provide a reproduce case, create a test file in
``tests/Tests/ORM/Functional/Ticket`` with the name of the ticket,
``DDC1234Test.php`` for example.
* If you want to contribute new functionality add unit- or functional tests
depending on the scope of the feature.
You can run the unit-tests by calling ``vendor/bin/phpunit`` from the root of the project.
It will run all the tests with an in memory SQLite database.
In order to do that, you will need a fresh copy of the ORM, and you
will have to run a composer installation in the project:
```sh
git clone git@github.com:doctrine/orm.git
cd orm
composer install
```
You will also need to enable the PHP extension that provides the SQLite driver
for PDO: `pdo_sqlite`. How to do so depends on your system, but checking that it
is enabled can universally be done with `php -m`: that command should list the
extension.
To run the testsuite against another database, copy the ``phpunit.xml.dist``
to for example ``mysql.phpunit.xml`` and edit the parameters. You can
take a look at the ``ci/github/phpunit`` directory for some examples. Then run:
vendor/bin/phpunit -c mysql.phpunit.xml
If you do not provide these parameters, the test suite will use an in-memory
sqlite database.
Tips for creating unit tests:
1. If you put a test into the `Ticket` namespace as described above, put the testcase and all entities into the same class.
See `https://github.com/doctrine/orm/tree/3.0.x/tests/Tests/ORM/Functional/Ticket/DDC2306Test.php` for an
example.
## Getting merged
Please allow us time to review your pull requests. We will give our best to review
everything as fast as possible, but cannot always live up to our own expectations.
Thank you very much again for your contribution!

View File

@@ -1,4 +1,4 @@
Copyright (c) 2006-2012 Doctrine Project
Copyright (c) Doctrine Project
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

View File

@@ -1,19 +0,0 @@
# Doctrine 2 ORM
Master: [![Build Status](https://secure.travis-ci.org/doctrine/doctrine2.png?branch=master)](http://travis-ci.org/doctrine/doctrine2)
2.2: [![Build Status](https://secure.travis-ci.org/doctrine/doctrine2.png?branch=2.2)](http://travis-ci.org/doctrine/doctrine2)
2.1: [![Build Status](https://secure.travis-ci.org/doctrine/doctrine2.png?branch=2.1.x)](http://travis-ci.org/doctrine/doctrine2)
Doctrine 2 is an object-relational mapper (ORM) for PHP 5.3.2+ that provides transparent persistence
for PHP objects. It sits on top of a powerful database abstraction layer (DBAL). One of its key features
is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL),
inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains flexibility
without requiring unnecessary code duplication.
## More resources:
* [Website](http://www.doctrine-project.org)
* [Documentation](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/index.html)
* [Issue Tracker](http://www.doctrine-project.org/jira/browse/DDC)
* [Downloads](http://github.com/doctrine/doctrine2/downloads)

40
README.md Normal file
View File

@@ -0,0 +1,40 @@
| [4.0.x][4.0] | [3.1.x][3.1] | [3.0.x][3.0] | [2.19.x][2.19] | [2.18.x][2.18] |
|:------------------------------------------------------:|:------------------------------------------------------:|:-------------------------------------------------------:|:--------------------------------------------------------:|:---------------------------------------------------------:|
| [![Build status][4.0 image]][4.0] | [![Build status][3.1 image]][3.1] | [![Build status][3.0 image]][3.0] | [![Build status][2.19 image]][2.19] | [![Build status][2.18 image]][2.18] |
| [![Coverage Status][4.0 coverage image]][4.0 coverage] | [![Coverage Status][3.1 coverage image]][3.1 coverage] | [![Coverage Status][3.0 coverage image]][3.0 coverage] | [![Coverage Status][2.19 coverage image]][2.19 coverage] | [![Coverage Status][2.18 coverage image]][2.18 coverage] |
[<h1 align="center">🇺🇦 UKRAINE NEEDS YOUR HELP NOW!</h1>](https://www.doctrine-project.org/stop-war.html)
Doctrine ORM is an object-relational mapper for PHP 8.1+ that provides transparent persistence
for PHP objects. It sits on top of a powerful database abstraction layer (DBAL). One of its key features
is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL),
inspired by Hibernate's HQL. This provides developers with a powerful alternative to SQL that maintains flexibility
without requiring unnecessary code duplication.
## More resources:
* [Website](http://www.doctrine-project.org)
* [Documentation](https://www.doctrine-project.org/projects/doctrine-orm/en/stable/index.html)
[4.0 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=4.0.x
[4.0]: https://github.com/doctrine/orm/tree/4.0.x
[4.0 coverage image]: https://codecov.io/gh/doctrine/orm/branch/4.0.x/graph/badge.svg
[4.0 coverage]: https://codecov.io/gh/doctrine/orm/branch/4.0.x
[3.1 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=3.1.x
[3.1]: https://github.com/doctrine/orm/tree/3.1.x
[3.1 coverage image]: https://codecov.io/gh/doctrine/orm/branch/3.1.x/graph/badge.svg
[3.1 coverage]: https://codecov.io/gh/doctrine/orm/branch/3.1.x
[3.0 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=3.0.x
[3.0]: https://github.com/doctrine/orm/tree/3.0.x
[3.0 coverage image]: https://codecov.io/gh/doctrine/orm/branch/3.0.x/graph/badge.svg
[3.0 coverage]: https://codecov.io/gh/doctrine/orm/branch/3.0.x
[2.19 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.19.x
[2.19]: https://github.com/doctrine/orm/tree/2.19.x
[2.19 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.19.x/graph/badge.svg
[2.19 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.19.x
[2.18 image]: https://github.com/doctrine/orm/actions/workflows/continuous-integration.yml/badge.svg?branch=2.18.x
[2.18]: https://github.com/doctrine/orm/tree/2.18.x
[2.18 coverage image]: https://codecov.io/gh/doctrine/orm/branch/2.18.x/graph/badge.svg
[2.18 coverage]: https://codecov.io/gh/doctrine/orm/branch/2.18.x

17
SECURITY.md Normal file
View File

@@ -0,0 +1,17 @@
Security
========
The Doctrine library is operating very close to your database and as such needs
to handle and make assumptions about SQL injection vulnerabilities.
It is vital that you understand how Doctrine approaches security, because
we cannot protect you from SQL injection.
Please read the documentation chapter on Security in Doctrine DBAL and ORM to
understand the assumptions we make.
- [DBAL Security Page](https://www.doctrine-project.org/projects/doctrine-dbal/en/stable/reference/security.html)
- [ORM Security Page](https://www.doctrine-project.org/projects/doctrine-orm/en/stable/reference/security.html)
If you find a Security bug in Doctrine, please follow our
[Security reporting guidelines](https://www.doctrine-project.org/policies/security.html#reporting).

1786
UPGRADE.md

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +0,0 @@
#!/usr/bin/env php
<?php
include('doctrine.php');

View File

@@ -1,50 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
require_once 'Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Symfony');
$classLoader->register();
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$helperSet = null;
if (file_exists($configFile)) {
if ( ! is_readable($configFile)) {
trigger_error(
'Configuration file [' . $configFile . '] does not have read permission.', E_ERROR
);
}
require $configFile;
foreach ($GLOBALS as $helperSetCandidate) {
if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
$helperSet = $helperSetCandidate;
break;
}
}
}
$helperSet = ($helperSet) ?: new \Symfony\Component\Console\Helper\HelperSet();
\Doctrine\ORM\Tools\Console\ConsoleRunner::run($helperSet);

View File

@@ -1,9 +0,0 @@
@echo off
if "%PHPBIN%" == "" set PHPBIN=@php_bin@
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
GOTO RUN
:USE_PEAR_PATH
set PHPBIN=%PHP_PEAR_PHP_BIN%
:RUN
"%PHPBIN%" "@bin_dir@\doctrine" %*

View File

@@ -1,43 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
(@include_once __DIR__ . '/../vendor/autoload.php') || @include_once __DIR__ . '/../../../autoload.php';
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$helperSet = null;
if (file_exists($configFile)) {
if ( ! is_readable($configFile)) {
trigger_error(
'Configuration file [' . $configFile . '] does not have read permission.', E_ERROR
);
}
require $configFile;
foreach ($GLOBALS as $helperSetCandidate) {
if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
$helperSet = $helperSetCandidate;
break;
}
}
}
$helperSet = ($helperSet) ?: new \Symfony\Component\Console\Helper\HelperSet();
\Doctrine\ORM\Tools\Console\ConsoleRunner::run($helperSet);

View File

@@ -1,11 +0,0 @@
# Project Name
project.name=DoctrineORM
# Dependency minimum versions
dependencies.common=2.2.0beta1
dependencies.dbal=2.2.0beta1
dependencies.sfconsole=2.0.0
# Version class and file
project.version_class = Doctrine\ORM\Version
project.version_file = lib/Doctrine/ORM/Version.php

View File

@@ -1,16 +0,0 @@
version=2.0.0BETA2
dependencies.common=2.0.0BETA4
dependencies.dbal=2.0.0BETA4
stability=beta
build.dir=build
dist.dir=dist
report.dir=reports
log.archive.dir=logs
project.pirum_dir=
project.download_dir=
project.xsd_dir=
test.phpunit_configuration_file=
test.phpunit_generate_coverage=0
test.pmd_reports=0
test.pdepend_exec=
test.phpmd_exec=

114
build.xml
View File

@@ -1,114 +0,0 @@
<?xml version="1.0"?>
<project name="DoctrineORM" default="build" basedir=".">
<taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2" />
<import file="${project.basedir}/lib/vendor/doctrine-build-common/packaging.xml" />
<property file="build.properties" />
<!--
Fileset for artifacts shared across all distributed packages.
-->
<fileset id="shared-artifacts" dir=".">
<include name="LICENSE"/>
<include name="UPGRADE*" />
<include name="doctrine-mapping.xsd" />
</fileset>
<!--
Fileset for command line scripts
-->
<fileset id="bin-scripts" dir="./bin">
<include name="doctrine"/>
<include name="doctrine-pear.php"/>
<include name="doctrine.bat"/>
</fileset>
<!--
Fileset for the sources of the Doctrine Common dependency.
-->
<fileset id="common-sources" dir="./lib/vendor/doctrine-common/lib">
<include name="Doctrine/Common/**"/>
</fileset>
<!--
Fileset for the sources of the Doctrine DBAL dependency.
-->
<fileset id="dbal-sources" dir="./lib/vendor/doctrine-dbal/lib">
<include name="Doctrine/DBAL/**"/>
</fileset>
<!--
Fileset for the sources of the Doctrine ORM.
-->
<fileset id="orm-sources" dir="./lib">
<include name="Doctrine/ORM/**"/>
</fileset>
<!--
Fileset for source of the Symfony YAML and Console components.
-->
<fileset id="symfony-sources" dir="./lib/vendor">
<include name="Symfony/Component/**"/>
<exclude name="**/.git/**" />
</fileset>
<!--
Builds ORM package, preparing it for distribution.
-->
<target name="copy-files" depends="prepare">
<copy todir="${build.dir}/${project.name}-${version}">
<fileset refid="shared-artifacts"/>
</copy>
<copy todir="${build.dir}/${project.name}-${version}">
<fileset refid="common-sources"/>
<fileset refid="dbal-sources"/>
<fileset refid="orm-sources"/>
</copy>
<copy todir="${build.dir}/${project.name}-${version}/Doctrine">
<fileset refid="symfony-sources"/>
</copy>
<copy todir="${build.dir}/${project.name}-${version}/bin">
<fileset refid="bin-scripts"/>
</copy>
</target>
<!--
Builds distributable PEAR packages.
-->
<target name="define-pear-package" depends="copy-files">
<d51pearpkg2 baseinstalldir="/" dir="${build.dir}/${project.name}-${version}">
<name>DoctrineORM</name>
<summary>Doctrine Object Relational Mapper</summary>
<channel>pear.doctrine-project.org</channel>
<description>The Doctrine ORM package is the primary package containing the object relational mapper.</description>
<lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
<lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" />
<lead user="romanb" name="Roman Borschel" email="roman@code-factory.org" />
<lead user="beberlei" name="Benjamin Eberlei" email="kontakt@beberlei.de" />
<license>LGPL</license>
<version release="${pear.version}" api="${pear.version}" />
<stability release="${pear.stability}" api="${pear.stability}" />
<notes>-</notes>
<dependencies>
<php minimum_version="5.3.0" />
<pear minimum_version="1.6.0" recommended_version="1.6.1" />
<package name="DoctrineCommon" channel="pear.doctrine-project.org" minimum_version="${dependencies.common}" />
<package name="DoctrineDBAL" channel="pear.doctrine-project.org" minimum_version="${dependencies.dbal}" />
<package name="Console" channel="pear.symfony.com" minimum_version="2.0.0" />
<package name="Yaml" channel="pear.symfony.com" minimum_version="2.0.0" />
</dependencies>
<dirroles key="bin">script</dirroles>
<ignore>Doctrine/Common/</ignore>
<ignore>Doctrine/DBAL/</ignore>
<ignore>Symfony/Component/Yaml/</ignore>
<ignore>Symfony/Component/Console/</ignore>
<release>
<install as="doctrine" name="bin/doctrine" />
<install as="doctrine.php" name="bin/doctrine-pear.php" />
<install as="doctrine.bat" name="bin/doctrine.bat" />
</release>
<replacement path="bin/doctrine" type="pear-config" from="@php_bin@" to="php_bin" />
<replacement path="bin/doctrine.bat" type="pear-config" from="@bin_dir@" to="bin_dir" />
</d51pearpkg2>
</target>
</project>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="error_reporting" value="-1" />
<var name="db_driver" value="mysqli"/>
<var name="db_host" value="127.0.0.1" />
<var name="db_port" value="3306"/>
<var name="db_user" value="root" />
<var name="db_dbname" value="doctrine_tests" />
<var name="db_default_table_option_charset" value="utf8mb4" />
<var name="db_default_table_option_collation" value="utf8mb4_unicode_ci" />
<var name="db_default_table_option_engine" value="InnoDB" />
<!-- necessary change for some CLI/console output test assertions -->
<env name="COLUMNS" value="120"/>
</php>
<testsuites>
<testsuite name="Doctrine DBAL Test Suite">
<directory>../../../tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">../../../src</directory>
</include>
</source>
<groups>
<exclude>
<group>performance</group>
<group>locking_functional</group>
</exclude>
</groups>
</phpunit>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="error_reporting" value="-1" />
<var name="db_driver" value="pdo_mysql"/>
<var name="db_host" value="127.0.0.1" />
<var name="db_port" value="3306"/>
<var name="db_user" value="root" />
<var name="db_dbname" value="doctrine_tests" />
<var name="db_default_table_option_charset" value="utf8mb4" />
<var name="db_default_table_option_collation" value="utf8mb4_unicode_ci" />
<var name="db_default_table_option_engine" value="InnoDB" />
<!-- necessary change for some CLI/console output test assertions -->
<env name="COLUMNS" value="120"/>
</php>
<testsuites>
<testsuite name="Doctrine DBAL Test Suite">
<directory>../../../tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">../../../src</directory>
</include>
</source>
<groups>
<exclude>
<group>performance</group>
<group>locking_functional</group>
</exclude>
</groups>
</phpunit>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="error_reporting" value="-1" />
<var name="db_driver" value="pdo_pgsql"/>
<var name="db_host" value="localhost" />
<var name="db_user" value="postgres" />
<var name="db_password" value="postgres" />
<var name="db_dbname" value="doctrine_tests" />
<!-- necessary change for some CLI/console output test assertions -->
<env name="COLUMNS" value="120"/>
</php>
<testsuites>
<testsuite name="Doctrine DBAL Test Suite">
<directory>../../../tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">../../../src</directory>
</include>
</source>
<groups>
<exclude>
<group>performance</group>
<group>locking_functional</group>
</exclude>
</groups>
</phpunit>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="error_reporting" value="-1" />
<!-- use an in-memory sqlite database -->
<var name="db_driver" value="pdo_sqlite"/>
<var name="db_memory" value="true"/>
<!-- necessary change for some CLI/console output test assertions -->
<env name="COLUMNS" value="120"/>
</php>
<testsuites>
<testsuite name="Doctrine DBAL Test Suite">
<directory>../../../tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">../../../src</directory>
</include>
</source>
<groups>
<exclude>
<group>performance</group>
<group>locking_functional</group>
</exclude>
</groups>
</phpunit>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="error_reporting" value="-1" />
<var name="db_driver" value="pgsql"/>
<var name="db_host" value="localhost" />
<var name="db_user" value="postgres" />
<var name="db_password" value="postgres" />
<var name="db_dbname" value="doctrine_tests" />
<!-- necessary change for some CLI/console output test assertions -->
<env name="COLUMNS" value="120"/>
</php>
<testsuites>
<testsuite name="Doctrine DBAL Test Suite">
<directory>../../../tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">../../../src</directory>
</include>
</source>
<groups>
<exclude>
<group>performance</group>
<group>locking_functional</group>
</exclude>
</groups>
</phpunit>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="error_reporting" value="-1" />
<!-- use an in-memory sqlite database -->
<var name="db_driver" value="sqlite3"/>
<var name="db_memory" value="true"/>
<!-- necessary change for some CLI/console output test assertions -->
<env name="COLUMNS" value="120"/>
</php>
<testsuites>
<testsuite name="Doctrine DBAL Test Suite">
<directory>../../../tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">../../../src</directory>
</include>
</source>
<groups>
<exclude>
<group>performance</group>
<group>locking_functional</group>
</exclude>
</groups>
</phpunit>

View File

@@ -1,32 +1,65 @@
{
"name": "doctrine/orm",
"type": "library","version":"2.3.1",
"type": "library",
"description": "Object-Relational-Mapper for PHP",
"keywords": ["orm", "database"],
"homepage": "http://www.doctrine-project.org",
"homepage": "https://www.doctrine-project.org/projects/orm.html",
"license": "MIT",
"authors": [
{"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"},
{"name": "Roman Borschel", "email": "roman@code-factory.org"},
{"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"},
{"name": "Jonathan Wage", "email": "jonwage@gmail.com"}
{"name": "Jonathan Wage", "email": "jonwage@gmail.com"},
{"name": "Marco Pivetta", "email": "ocramius@gmail.com"}
],
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true
},
"sort-packages": true
},
"require": {
"php": ">=5.3.2",
"ext-pdo": "*",
"doctrine/dbal": "2.3.*",
"symfony/console": "2.*"
"php": "^8.1",
"composer-runtime-api": "^2",
"ext-ctype": "*",
"doctrine/collections": "^2.1",
"doctrine/dbal": "^3.8.2 || ^4",
"doctrine/deprecations": "^0.5.3 || ^1",
"doctrine/event-manager": "^1.2 || ^2",
"doctrine/inflector": "^1.4 || ^2.0",
"doctrine/instantiator": "^1.3 || ^2",
"doctrine/lexer": "^3",
"doctrine/persistence": "^3.1.1",
"psr/cache": "^1 || ^2 || ^3",
"symfony/console": "^5.4 || ^6.0 || ^7.0",
"symfony/var-exporter": "~6.2.13 || ^6.3.2 || ^7.0"
},
"require-dev": {
"doctrine/coding-standard": "^12.0",
"phpbench/phpbench": "^1.0",
"phpstan/phpstan": "1.10.59",
"phpunit/phpunit": "^10.4.0",
"psr/log": "^1 || ^2 || ^3",
"squizlabs/php_codesniffer": "3.7.2",
"symfony/cache": "^5.4 || ^6.2 || ^7.0",
"vimeo/psalm": "5.22.2"
},
"suggest": {
"symfony/yaml": "If you want to use YAML Metadata Mapping Driver"
"ext-dom": "Provides support for XSD validation for XML mapping files",
"symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0"
},
"autoload": {
"psr-0": { "Doctrine\\ORM": "lib/" }
"psr-4": { "Doctrine\\ORM\\": "src" }
},
"bin": ["bin/doctrine", "bin/doctrine.php"],
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev"
"autoload-dev": {
"psr-4": {
"Doctrine\\Tests\\": "tests/Tests",
"Doctrine\\StaticAnalysis\\": "tests/StaticAnalysis",
"Doctrine\\Performance\\": "tests/Performance"
}
},
"archive": {
"exclude": ["!vendor", "tests", "*phpunit.xml", "build.xml", "build.properties", "composer.phar", "vendor/satooshi", "lib/vendor", "*.swp"]
}
}

4
docs/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
en/_exts/configurationblock.pyc
build
en/_build
.idea

3
docs/.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "en/_theme"]
path = en/_theme
url = https://github.com/doctrine/doctrine-sphinx-theme.git

362
docs/LICENSE.md Normal file
View File

@@ -0,0 +1,362 @@
The Doctrine ORM documentation is licensed under [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US)
Creative Commons Legal Code
Attribution-NonCommercial-ShareAlike 3.0 Unported
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR
DAMAGES RESULTING FROM ITS USE.
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
CONDITIONS.
1. Definitions
a. "Adaptation" means a work based upon the Work, or upon the Work and
other pre-existing works, such as a translation, adaptation,
derivative work, arrangement of music or other alterations of a
literary or artistic work, or phonogram or performance and includes
cinematographic adaptations or any other form in which the Work may be
recast, transformed, or adapted including in any form recognizably
derived from the original, except that a work that constitutes a
Collection will not be considered an Adaptation for the purpose of
this License. For the avoidance of doubt, where the Work is a musical
work, performance or phonogram, the synchronization of the Work in
timed-relation with a moving image ("synching") will be considered an
Adaptation for the purpose of this License.
b. "Collection" means a collection of literary or artistic works, such as
encyclopedias and anthologies, or performances, phonograms or
broadcasts, or other works or subject matter other than works listed
in Section 1(g) below, which, by reason of the selection and
arrangement of their contents, constitute intellectual creations, in
which the Work is included in its entirety in unmodified form along
with one or more other contributions, each constituting separate and
independent works in themselves, which together are assembled into a
collective whole. A work that constitutes a Collection will not be
considered an Adaptation (as defined above) for the purposes of this
License.
c. "Distribute" means to make available to the public the original and
copies of the Work or Adaptation, as appropriate, through sale or
other transfer of ownership.
d. "License Elements" means the following high-level license attributes
as selected by Licensor and indicated in the title of this License:
Attribution, Noncommercial, ShareAlike.
e. "Licensor" means the individual, individuals, entity or entities that
offer(s) the Work under the terms of this License.
f. "Original Author" means, in the case of a literary or artistic work,
the individual, individuals, entity or entities who created the Work
or if no individual or entity can be identified, the publisher; and in
addition (i) in the case of a performance the actors, singers,
musicians, dancers, and other persons who act, sing, deliver, declaim,
play in, interpret or otherwise perform literary or artistic works or
expressions of folklore; (ii) in the case of a phonogram the producer
being the person or legal entity who first fixes the sounds of a
performance or other sounds; and, (iii) in the case of broadcasts, the
organization that transmits the broadcast.
g. "Work" means the literary and/or artistic work offered under the terms
of this License including without limitation any production in the
literary, scientific and artistic domain, whatever may be the mode or
form of its expression including digital form, such as a book,
pamphlet and other writing; a lecture, address, sermon or other work
of the same nature; a dramatic or dramatico-musical work; a
choreographic work or entertainment in dumb show; a musical
composition with or without words; a cinematographic work to which are
assimilated works expressed by a process analogous to cinematography;
a work of drawing, painting, architecture, sculpture, engraving or
lithography; a photographic work to which are assimilated works
expressed by a process analogous to photography; a work of applied
art; an illustration, map, plan, sketch or three-dimensional work
relative to geography, topography, architecture or science; a
performance; a broadcast; a phonogram; a compilation of data to the
extent it is protected as a copyrightable work; or a work performed by
a variety or circus performer to the extent it is not otherwise
considered a literary or artistic work.
h. "You" means an individual or entity exercising rights under this
License who has not previously violated the terms of this License with
respect to the Work, or who has received express permission from the
Licensor to exercise rights under this License despite a previous
violation.
i. "Publicly Perform" means to perform public recitations of the Work and
to communicate to the public those public recitations, by any means or
process, including by wire or wireless means or public digital
performances; to make available to the public Works in such a way that
members of the public may access these Works from a place and at a
place individually chosen by them; to perform the Work to the public
by any means or process and the communication to the public of the
performances of the Work, including by public digital performance; to
broadcast and rebroadcast the Work by any means including signs,
sounds or images.
j. "Reproduce" means to make copies of the Work by any means including
without limitation by sound or visual recordings and the right of
fixation and reproducing fixations of the Work, including storage of a
protected performance or phonogram in digital form or other electronic
medium.
2. Fair Dealing Rights. Nothing in this License is intended to reduce,
limit, or restrict any uses free from copyright or rights arising from
limitations or exceptions that are provided for in connection with the
copyright protection under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License,
Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
perpetual (for the duration of the applicable copyright) license to
exercise the rights in the Work as stated below:
a. to Reproduce the Work, to incorporate the Work into one or more
Collections, and to Reproduce the Work as incorporated in the
Collections;
b. to create and Reproduce Adaptations provided that any such Adaptation,
including any translation in any medium, takes reasonable steps to
clearly label, demarcate or otherwise identify that changes were made
to the original Work. For example, a translation could be marked "The
original work was translated from English to Spanish," or a
modification could indicate "The original work has been modified.";
c. to Distribute and Publicly Perform the Work including as incorporated
in Collections; and,
d. to Distribute and Publicly Perform Adaptations.
The above rights may be exercised in all media and formats whether now
known or hereafter devised. The above rights include the right to make
such modifications as are technically necessary to exercise the rights in
other media and formats. Subject to Section 8(f), all rights not expressly
granted by Licensor are hereby reserved, including but not limited to the
rights described in Section 4(e).
4. Restrictions. The license granted in Section 3 above is expressly made
subject to and limited by the following restrictions:
a. You may Distribute or Publicly Perform the Work only under the terms
of this License. You must include a copy of, or the Uniform Resource
Identifier (URI) for, this License with every copy of the Work You
Distribute or Publicly Perform. You may not offer or impose any terms
on the Work that restrict the terms of this License or the ability of
the recipient of the Work to exercise the rights granted to that
recipient under the terms of the License. You may not sublicense the
Work. You must keep intact all notices that refer to this License and
to the disclaimer of warranties with every copy of the Work You
Distribute or Publicly Perform. When You Distribute or Publicly
Perform the Work, You may not impose any effective technological
measures on the Work that restrict the ability of a recipient of the
Work from You to exercise the rights granted to that recipient under
the terms of the License. This Section 4(a) applies to the Work as
incorporated in a Collection, but this does not require the Collection
apart from the Work itself to be made subject to the terms of this
License. If You create a Collection, upon notice from any Licensor You
must, to the extent practicable, remove from the Collection any credit
as required by Section 4(d), as requested. If You create an
Adaptation, upon notice from any Licensor You must, to the extent
practicable, remove from the Adaptation any credit as required by
Section 4(d), as requested.
b. You may Distribute or Publicly Perform an Adaptation only under: (i)
the terms of this License; (ii) a later version of this License with
the same License Elements as this License; (iii) a Creative Commons
jurisdiction license (either this or a later license version) that
contains the same License Elements as this License (e.g.,
Attribution-NonCommercial-ShareAlike 3.0 US) ("Applicable License").
You must include a copy of, or the URI, for Applicable License with
every copy of each Adaptation You Distribute or Publicly Perform. You
may not offer or impose any terms on the Adaptation that restrict the
terms of the Applicable License or the ability of the recipient of the
Adaptation to exercise the rights granted to that recipient under the
terms of the Applicable License. You must keep intact all notices that
refer to the Applicable License and to the disclaimer of warranties
with every copy of the Work as included in the Adaptation You
Distribute or Publicly Perform. When You Distribute or Publicly
Perform the Adaptation, You may not impose any effective technological
measures on the Adaptation that restrict the ability of a recipient of
the Adaptation from You to exercise the rights granted to that
recipient under the terms of the Applicable License. This Section 4(b)
applies to the Adaptation as incorporated in a Collection, but this
does not require the Collection apart from the Adaptation itself to be
made subject to the terms of the Applicable License.
c. You may not exercise any of the rights granted to You in Section 3
above in any manner that is primarily intended for or directed toward
commercial advantage or private monetary compensation. The exchange of
the Work for other copyrighted works by means of digital file-sharing
or otherwise shall not be considered to be intended for or directed
toward commercial advantage or private monetary compensation, provided
there is no payment of any monetary compensation in con-nection with
the exchange of copyrighted works.
d. If You Distribute, or Publicly Perform the Work or any Adaptations or
Collections, You must, unless a request has been made pursuant to
Section 4(a), keep intact all copyright notices for the Work and
provide, reasonable to the medium or means You are utilizing: (i) the
name of the Original Author (or pseudonym, if applicable) if supplied,
and/or if the Original Author and/or Licensor designate another party
or parties (e.g., a sponsor institute, publishing entity, journal) for
attribution ("Attribution Parties") in Licensor's copyright notice,
terms of service or by other reasonable means, the name of such party
or parties; (ii) the title of the Work if supplied; (iii) to the
extent reasonably practicable, the URI, if any, that Licensor
specifies to be associated with the Work, unless such URI does not
refer to the copyright notice or licensing information for the Work;
and, (iv) consistent with Section 3(b), in the case of an Adaptation,
a credit identifying the use of the Work in the Adaptation (e.g.,
"French translation of the Work by Original Author," or "Screenplay
based on original Work by Original Author"). The credit required by
this Section 4(d) may be implemented in any reasonable manner;
provided, however, that in the case of a Adaptation or Collection, at
a minimum such credit will appear, if a credit for all contributing
authors of the Adaptation or Collection appears, then as part of these
credits and in a manner at least as prominent as the credits for the
other contributing authors. For the avoidance of doubt, You may only
use the credit required by this Section for the purpose of attribution
in the manner set out above and, by exercising Your rights under this
License, You may not implicitly or explicitly assert or imply any
connection with, sponsorship or endorsement by the Original Author,
Licensor and/or Attribution Parties, as appropriate, of You or Your
use of the Work, without the separate, express prior written
permission of the Original Author, Licensor and/or Attribution
Parties.
e. For the avoidance of doubt:
i. Non-waivable Compulsory License Schemes. In those jurisdictions in
which the right to collect royalties through any statutory or
compulsory licensing scheme cannot be waived, the Licensor
reserves the exclusive right to collect such royalties for any
exercise by You of the rights granted under this License;
ii. Waivable Compulsory License Schemes. In those jurisdictions in
which the right to collect royalties through any statutory or
compulsory licensing scheme can be waived, the Licensor reserves
the exclusive right to collect such royalties for any exercise by
You of the rights granted under this License if Your exercise of
such rights is for a purpose or use which is otherwise than
noncommercial as permitted under Section 4(c) and otherwise waives
the right to collect royalties through any statutory or compulsory
licensing scheme; and,
iii. Voluntary License Schemes. The Licensor reserves the right to
collect royalties, whether individually or, in the event that the
Licensor is a member of a collecting society that administers
voluntary licensing schemes, via that society, from any exercise
by You of the rights granted under this License that is for a
purpose or use which is otherwise than noncommercial as permitted
under Section 4(c).
f. Except as otherwise agreed in writing by the Licensor or as may be
otherwise permitted by applicable law, if You Reproduce, Distribute or
Publicly Perform the Work either by itself or as part of any
Adaptations or Collections, You must not distort, mutilate, modify or
take other derogatory action in relation to the Work which would be
prejudicial to the Original Author's honor or reputation. Licensor
agrees that in those jurisdictions (e.g. Japan), in which any exercise
of the right granted in Section 3(b) of this License (the right to
make Adaptations) would be deemed to be a distortion, mutilation,
modification or other derogatory action prejudicial to the Original
Author's honor and reputation, the Licensor will waive or not assert,
as appropriate, this Section, to the fullest extent permitted by the
applicable national law, to enable You to reasonably exercise Your
right under Section 3(b) of this License (right to make Adaptations)
but not otherwise.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING AND TO THE
FULLEST EXTENT PERMITTED BY APPLICABLE LAW, LICENSOR OFFERS THE WORK AS-IS
AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE
WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT
LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT
DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED
WARRANTIES, SO THIS EXCLUSION MAY NOT APPLY TO YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
a. This License and the rights granted hereunder will terminate
automatically upon any breach by You of the terms of this License.
Individuals or entities who have received Adaptations or Collections
from You under this License, however, will not have their licenses
terminated provided such individuals or entities remain in full
compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
survive any termination of this License.
b. Subject to the above terms and conditions, the license granted here is
perpetual (for the duration of the applicable copyright in the Work).
Notwithstanding the above, Licensor reserves the right to release the
Work under different license terms or to stop distributing the Work at
any time; provided, however that any such election will not serve to
withdraw this License (or any other license that has been, or is
required to be, granted under the terms of this License), and this
License will continue in full force and effect unless terminated as
stated above.
8. Miscellaneous
a. Each time You Distribute or Publicly Perform the Work or a Collection,
the Licensor offers to the recipient a license to the Work on the same
terms and conditions as the license granted to You under this License.
b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
offers to the recipient a license to the original Work on the same
terms and conditions as the license granted to You under this License.
c. If any provision of this License is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this License, and without further action
by the parties to this agreement, such provision shall be reformed to
the minimum extent necessary to make such provision valid and
enforceable.
d. No term or provision of this License shall be deemed waived and no
breach consented to unless such waiver or consent shall be in writing
and signed by the party to be charged with such waiver or consent.
e. This License constitutes the entire agreement between the parties with
respect to the Work licensed here. There are no understandings,
agreements or representations with respect to the Work not specified
here. Licensor shall not be bound by any additional provisions that
may appear in any communication from You. This License may not be
modified without the mutual written agreement of the Licensor and You.
f. The rights granted under, and the subject matter referenced, in this
License were drafted utilizing the terminology of the Berne Convention
for the Protection of Literary and Artistic Works (as amended on
September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996
and the Universal Copyright Convention (as revised on July 24, 1971).
These rights and subject matter take effect in the relevant
jurisdiction in which the License terms are sought to be enforced
according to the corresponding provisions of the implementation of
those treaty provisions in the applicable national law. If the
standard suite of rights granted under applicable copyright law
includes additional rights not granted under this License, such
additional rights are deemed to be included in the License; this
License is not intended to restrict the license of any rights under
applicable law.
Creative Commons Notice
Creative Commons is not a party to this License, and makes no warranty
whatsoever in connection with the Work. Creative Commons will not be
liable to You or any party on any legal theory for any damages
whatsoever, including without limitation any general, special,
incidental or consequential damages arising in connection to this
license. Notwithstanding the foregoing two (2) sentences, if Creative
Commons has expressly identified itself as the Licensor hereunder, it
shall have all rights and obligations of Licensor.
Except for the limited purpose of indicating to the public that the
Work is licensed under the CCPL, Creative Commons does not authorize
the use by either party of the trademark "Creative Commons" or any
related trademark or logo of Creative Commons without the prior
written consent of Creative Commons. Any permitted use will be in
compliance with Creative Commons' then-current trademark usage
guidelines, as may be published on its website or otherwise made
available upon request from time to time. For the avoidance of doubt,
this trademark restriction does not form part of this License.
Creative Commons may be contacted at https://creativecommons.org/.

18
docs/README.md Normal file
View File

@@ -0,0 +1,18 @@
# Doctrine ORM Documentation
## How to Generate:
Using Ubuntu 14.04 LTS:
1. Run ./bin/install-dependencies.sh
2. Run ./bin/generate-docs.sh
It will generate the documentation into the build directory of the checkout.
## Theme issues
If you get a "Theme error", check if the `en/_theme` subdirectory is empty,
in which case you will need to run:
1. git submodule init
2. git submodule update

10
docs/bin/generate-docs.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
EXECPATH=`dirname $0`
cd $EXECPATH
cd ..
rm build -Rf
sphinx-build en build
sphinx-build -b latex en build/pdf
rubber --into build/pdf --pdf build/pdf/Doctrine2ORM.tex

View File

@@ -0,0 +1,2 @@
#!/bin/bash
sudo apt-get update && sudo apt-get install -y python2.7 python-sphinx python-pygments

89
docs/en/Makefile Normal file
View File

@@ -0,0 +1,89 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Doctrine2ORM.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Doctrine2ORM.qhc"
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

View File

@@ -0,0 +1,91 @@
#Copyright (c) 2010 Fabien Potencier
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is furnished
#to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all
#copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#THE SOFTWARE.
from docutils.parsers.rst import Directive, directives
from docutils import nodes
from string import upper
class configurationblock(nodes.General, nodes.Element):
pass
class ConfigurationBlock(Directive):
has_content = True
required_arguments = 0
optional_arguments = 0
final_argument_whitespace = True
option_spec = {}
formats = {
'html': 'HTML',
'xml': 'XML',
'php': 'PHP',
'jinja': 'Twig',
'html+jinja': 'Twig',
'jinja+html': 'Twig',
'php+html': 'PHP',
'html+php': 'PHP',
'ini': 'INI',
}
def run(self):
env = self.state.document.settings.env
node = nodes.Element()
node.document = self.state.document
self.state.nested_parse(self.content, self.content_offset, node)
entries = []
for i, child in enumerate(node):
if isinstance(child, nodes.literal_block):
# add a title (the language name) before each block
#targetid = "configuration-block-%d" % env.new_serialno('configuration-block')
#targetnode = nodes.target('', '', ids=[targetid])
#targetnode.append(child)
innernode = nodes.emphasis(self.formats[child['language']], self.formats[child['language']])
para = nodes.paragraph()
para += [innernode, child]
entry = nodes.list_item('')
entry.append(para)
entries.append(entry)
resultnode = configurationblock()
resultnode.append(nodes.bullet_list('', *entries))
return [resultnode]
def visit_configurationblock_html(self, node):
self.body.append(self.starttag(node, 'div', CLASS='configuration-block'))
def depart_configurationblock_html(self, node):
self.body.append('</div>\n')
def visit_configurationblock_latex(self, node):
pass
def depart_configurationblock_latex(self, node):
pass
def setup(app):
app.add_node(configurationblock,
html=(visit_configurationblock_html, depart_configurationblock_html),
latex=(visit_configurationblock_latex, depart_configurationblock_latex))
app.add_directive('configuration-block', ConfigurationBlock)

1
docs/en/_theme Submodule

Submodule docs/en/_theme added at 6f1bc8bead

View File

@@ -0,0 +1,220 @@
Advanced field value conversion using custom mapping types
==========================================================
.. sectionauthor:: Jan Sorgalla <jsorgalla@googlemail.com>
When creating entities, you sometimes have the need to transform field values
before they are saved to the database. In Doctrine you can use Custom Mapping
Types to solve this (see: :ref:`reference-basic-mapping-custom-mapping-types`).
There are several ways to achieve this: converting the value inside the Type
class, converting the value on the database-level or a combination of both.
This article describes the third way by implementing the MySQL specific column
type `Point <https://dev.mysql.com/doc/refman/8.0/en/gis-class-point.html>`_.
The ``Point`` type is part of the `Spatial extension <https://dev.mysql.com/doc/refman/8.0/en/spatial-extensions.html>`_
of MySQL and enables you to store a single location in a coordinate space by
using x and y coordinates. You can use the Point type to store a
longitude/latitude pair to represent a geographic location.
The entity
----------
We create a simple entity with a field ``$point`` which holds a value object
``Point`` representing the latitude and longitude of the position.
The entity class:
.. code-block:: php
<?php
namespace Geo\Entity;
use Geo\ValueObject\Point;
#[Entity]
class Location
{
#[Column(type: 'point')]
private Point $point;
#[Column]
private string $address;
public function setPoint(Point $point): void
{
$this->point = $point;
}
public function getPoint(): Point
{
return $this->point;
}
public function setAddress(string $address): void
{
$this->address = $address;
}
public function getAddress(): string
{
return $this->address;
}
}
We use the custom type ``point`` in the ``#[Column]`` attribute of the
``$point`` field. We will create this custom mapping type in the next chapter.
The point class:
.. code-block:: php
<?php
namespace Geo\ValueObject;
class Point
{
public function __construct(
private float $latitude,
private float $longitude,
) {
}
public function getLatitude(): float
{
return $this->latitude;
}
public function getLongitude(): float
{
return $this->longitude;
}
}
The mapping type
----------------
Now we're going to create the ``point`` type and implement all required methods.
.. code-block:: php
<?php
namespace Geo\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Geo\ValueObject\Point;
class PointType extends Type
{
const POINT = 'point';
public function getName()
{
return self::POINT;
}
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
return 'POINT';
}
public function convertToPHPValue($value, AbstractPlatform $platform)
{
list($longitude, $latitude) = sscanf($value, 'POINT(%f %f)');
return new Point($latitude, $longitude);
}
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value instanceof Point) {
$value = sprintf('POINT(%F %F)', $value->getLongitude(), $value->getLatitude());
}
return $value;
}
public function convertToPHPValueSQL($sqlExpr, AbstractPlatform $platform)
{
return sprintf('AsText(%s)', $sqlExpr);
}
public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
{
return sprintf('PointFromText(%s)', $sqlExpr);
}
}
We do a 2-step conversion here. In the first step, we convert the ``Point``
object into a string representation before saving to the database (in the
``convertToDatabaseValue`` method) and back into an object after fetching the
value from the database (in the ``convertToPHPValue`` method).
The format of the string representation format is called
`Well-known text (WKT) <https://en.wikipedia.org/wiki/Well-known_text>`_.
The advantage of this format is, that it is both human readable and parsable by MySQL.
Internally, MySQL stores geometry values in a binary format that is not
identical to the WKT format. So, we need to let MySQL transform the WKT
representation into its internal format.
This is where the ``convertToPHPValueSQL`` and ``convertToDatabaseValueSQL``
methods come into play.
This methods wrap a sql expression (the WKT representation of the Point) into
MySQL functions `ST_PointFromText <https://dev.mysql.com/doc/refman/8.0/en/gis-wkt-functions.html#function_st-pointfromtext>`_
and `ST_AsText <https://dev.mysql.com/doc/refman/8.0/en/gis-format-conversion-functions.html#function_st-astext>`_
which convert WKT strings to and from the internal format of MySQL.
.. note::
When using DQL queries, the ``convertToPHPValueSQL`` and
``convertToDatabaseValueSQL`` methods only apply to identification variables
and path expressions in SELECT clauses. Expressions in WHERE clauses are
**not** wrapped!
If you want to use Point values in WHERE clauses, you have to implement a
:doc:`user defined function <dql-user-defined-functions>` for
``PointFromText``.
Example usage
-------------
.. code-block:: php
<?php
// Bootstrapping stuff...
// $em = new \Doctrine\ORM\EntityManager($connection, $config);
// Setup custom mapping type
use Doctrine\DBAL\Types\Type;
Type::addType('point', 'Geo\Types\PointType');
$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('point', 'point');
// Store a Location object
use Geo\Entity\Location;
use Geo\ValueObject\Point;
$location = new Location();
$location->setAddress('1600 Amphitheatre Parkway, Mountain View, CA');
$location->setPoint(new Point(37.4220761, -122.0845187));
$em->persist($location);
$em->flush();
$em->clear();
// Fetch the Location object
$query = $em->createQuery("SELECT l FROM Geo\Entity\Location l WHERE l.address = '1600 Amphitheatre Parkway, Mountain View, CA'");
$location = $query->getSingleResult();
/** @var Geo\ValueObject\Point */
$point = $location->getPoint();

View File

@@ -0,0 +1,375 @@
Aggregate Fields
================
.. sectionauthor:: Benjamin Eberlei <kontakt@beberlei.de>
You will often come across the requirement to display aggregate
values of data that can be computed by using the MIN, MAX, COUNT or
SUM SQL functions. For any ORM this is a tricky issue
traditionally. Doctrine ORM offers several ways to get access to
these values and this article will describe all of them from
different perspectives.
You will see that aggregate fields can become very explicit
features in your domain model and how this potentially complex
business rules can be easily tested.
An example model
----------------
Say you want to model a bank account and all their entries. Entries
into the account can either be of positive or negative money
values. Each account has a credit limit and the account is never
allowed to have a balance below that value.
For simplicity we live in a world where money is composed of
integers only. Also we omit the receiver/sender name, stated reason
for transfer and the execution date. These all would have to be
added on the ``Entry`` object.
Our entities look like:
.. code-block:: php
<?php
namespace Bank\Entities;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
#[ORM\Entity]
class Account
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id;
#[ORM\OneToMany(targetEntity: Entry::class, mappedBy: 'account', cascade: ['persist'])]
private Collection $entries;
public function __construct(
#[ORM\Column(type: 'string', unique: true)]
private string $no,
#[ORM\Column(type: 'integer')]
private int $maxCredit = 0,
) {
$this->entries = new ArrayCollection();
}
}
#[ORM\Entity]
class Entry
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id;
public function __construct(
#[ORM\ManyToOne(targetEntity: Account::class, inversedBy: 'entries')]
private Account $account,
#[ORM\Column(type: 'integer')]
private int $amount,
) {
// more stuff here, from/to whom, stated reason, execution date and such
}
public function getAmount(): Amount
{
return $this->amount;
}
}
Using DQL
---------
The Doctrine Query Language allows you to select for aggregate
values computed from fields of your Domain Model. You can select
the current balance of your account by calling:
.. code-block:: php
<?php
$dql = "SELECT SUM(e.amount) AS balance FROM Bank\Entities\Entry e " .
"WHERE e.account = ?1";
$balance = $em->createQuery($dql)
->setParameter(1, $myAccountId)
->getSingleScalarResult();
The ``$em`` variable in this (and forthcoming) example holds the
Doctrine ``EntityManager``. We create a query for the SUM of all
amounts (negative amounts are withdraws) and retrieve them as a
single scalar result, essentially return only the first column of
the first row.
This approach is simple and powerful, however it has a serious
drawback. We have to execute a specific query for the balance
whenever we need it.
To implement a powerful domain model we would rather have access to
the balance from our ``Account`` entity during all times (even if
the Account was not persisted in the database before!).
Also an additional requirement is the max credit per ``Account``
rule.
We cannot reliably enforce this rule in our ``Account`` entity with
the DQL retrieval of the balance. There are many different ways to
retrieve accounts. We cannot guarantee that we can execute the
aggregation query for all these use-cases, let alone that a
userland programmer checks this balance against newly added
entries.
Using your Domain Model
-----------------------
``Account`` and all the ``Entry`` instances are connected through a
collection, which means we can compute this value at runtime:
.. code-block:: php
<?php
class Account
{
// .. previous code
public function getBalance(): int
{
$balance = 0;
foreach ($this->entries as $entry) {
$balance += $entry->getAmount();
}
return $balance;
}
}
Now we can always call ``Account::getBalance()`` to access the
current account balance.
To enforce the max credit rule we have to implement the "Aggregate
Root" pattern as described in Eric Evans book on Domain Driven
Design. Described with one sentence, an aggregate root controls the
instance creation, access and manipulation of its children.
In our case we want to enforce that new entries can only added to
the ``Account`` by using a designated method. The ``Account`` is
the aggregate root of this relation. We can also enforce the
correctness of the bi-directional ``Account`` <-> ``Entry``
relation with this method:
.. code-block:: php
<?php
class Account
{
public function addEntry(int $amount): void
{
$this->assertAcceptEntryAllowed($amount);
$this->entries[] = new Entry($this, $amount);
}
}
Now look at the following test-code for our entities:
.. code-block:: php
<?php
use PHPUnit\Framework\TestCase;
class AccountTest extends TestCase
{
public function testAddEntry()
{
$account = new Account("123456", maxCredit: 200);
$this->assertEquals(0, $account->getBalance());
$account->addEntry(500);
$this->assertEquals(500, $account->getBalance());
$account->addEntry(-700);
$this->assertEquals(-200, $account->getBalance());
}
public function testExceedMaxLimit()
{
$account = new Account("123456", maxCredit: 200);
$this->expectException(Exception::class);
$account->addEntry(-1000);
}
}
To enforce our rule we can now implement the assertion in
``Account::addEntry``:
.. code-block:: php
<?php
class Account
{
// .. previous code
private function assertAcceptEntryAllowed(int $amount): void
{
$futureBalance = $this->getBalance() + $amount;
$allowedMinimalBalance = ($this->maxCredit * -1);
if ($futureBalance < $allowedMinimalBalance) {
throw new Exception("Credit Limit exceeded, entry is not allowed!");
}
}
}
We haven't talked to the entity manager for persistence of our
account example before. You can call
``EntityManager::persist($account)`` and then
``EntityManager::flush()`` at any point to save the account to the
database. All the nested ``Entry`` objects are automatically
flushed to the database also.
.. code-block:: php
<?php
$account = new Account("123456", 200);
$account->addEntry(500);
$account->addEntry(-200);
$em->persist($account);
$em->flush();
The current implementation has a considerable drawback. To get the
balance, we have to initialize the complete ``Account::$entries``
collection, possibly a very large one. This can considerably hurt
the performance of your application.
Using an Aggregate Field
------------------------
To overcome the previously mentioned issue (initializing the whole
entries collection) we want to add an aggregate field called
"balance" on the Account and adjust the code in
``Account::getBalance()`` and ``Account:addEntry()``:
.. code-block:: php
<?php
class Account
{
#[ORM\Column(type: 'integer')]
private int $balance = 0;
public function getBalance(): int
{
return $this->balance;
}
public function addEntry(int $amount): void
{
$this->assertAcceptEntryAllowed($amount);
$this->entries[] = new Entry($this, $amount);
$this->balance += $amount;
}
}
This is a very simple change, but all the tests still pass. Our
account entities return the correct balance. Now calling the
``Account::getBalance()`` method will not occur the overhead of
loading all entries anymore. Adding a new Entry to the
``Account::$entities`` will also not initialize the collection
internally.
Adding a new entry is therefore very performant and explicitly
hooked into the domain model. It will only update the account with
the current balance and insert the new entry into the database.
Tackling Race Conditions with Aggregate Fields
----------------------------------------------
Whenever you denormalize your database schema race-conditions can
potentially lead to inconsistent state. See this example:
.. code-block:: php
<?php
use Bank\Entities\Account;
// The Account $accId has a balance of 0 and a max credit limit of 200:
// request 1 account
$account1 = $em->find(Account::class, $accId);
// request 2 account
$account2 = $em->find(Account::class, $accId);
$account1->addEntry(-200);
$account2->addEntry(-200);
// now request 1 and 2 both flush the changes.
The aggregate field ``Account::$balance`` is now -200, however the
SUM over all entries amounts yields -400. A violation of our max
credit rule.
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.
Optimistic locking is as easy as adding a version column:
.. code-block:: php
<?php
class Account
{
#[ORM\Column(type: 'integer')]
#[ORM\Version]
private int $version;
}
The previous example would then throw an exception in the face of
whatever request saves the entity last (and would create the
inconsistent state).
Pessimistic locking requires an additional flag set on the
``EntityManager::find()`` call, enabling write locking directly in
the database using a FOR UPDATE.
.. code-block:: php
<?php
use Bank\Entities\Account;
use Doctrine\DBAL\LockMode;
$account = $em->find(Account::class, $accId, LockMode::PESSIMISTIC_READ);
Keeping Updates and Deletes in Sync
-----------------------------------
The example shown in this article does not allow changes to the
value in ``Entry``, which considerably simplifies the effort to
keep ``Account::$balance`` in sync. If your use-case allows fields
to be updated or related entities to be removed you have to
encapsulate this logic in your "Aggregate Root" entity and adjust
the aggregate field accordingly.
Conclusion
----------
This article described how to obtain aggregate values using DQL or
your domain model. It showed how you can easily add an aggregate
field that offers serious performance benefits over iterating all
the related objects that make up an aggregate value. Finally I
showed how you can ensure that your aggregate fields do not get out
of sync due to race-conditions and concurrent access.

View File

@@ -0,0 +1,101 @@
Custom Mapping Types
====================
Doctrine allows you to create new mapping types. This can come in
handy when you're missing a specific mapping type or when you want
to replace the existing implementation of a mapping type.
In order to create a new mapping type you need to subclass
``Doctrine\DBAL\Types\Type`` and implement/override the methods as
you wish. Here is an example skeleton of such a custom type class:
.. code-block:: php
<?php
namespace My\Project\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
/**
* My custom datatype.
*/
class MyType extends Type
{
const MYTYPE = 'mytype'; // modify to match your type name
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
// return the SQL used to create your column type. To create a portable column type, use the $platform.
}
public function convertToPHPValue($value, AbstractPlatform $platform)
{
// This is executed when the value is read from the database. Make your conversions here, optionally using the $platform.
}
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
// This is executed when the value is written to the database. Make your conversions here, optionally using the $platform.
}
public function getName()
{
return self::MYTYPE; // modify to match your constant name
}
}
.. note::
The following assumptions are applied to mapping types by the ORM:
- The ``UnitOfWork`` never passes values to the database convert
method that did not change in the request.
- The ``UnitOfWork`` internally assumes that entity identifiers are
castable to string. Hence, when using custom types that map to PHP
objects as IDs, such objects must implement the ``__toString()`` magic
method.
When you have implemented the type you still need to let Doctrine
know about it. This can be achieved through the
``Doctrine\DBAL\Types\Type#addType($name, $className)``
method. See the following example:
.. code-block:: php
<?php
// in bootstrapping code
// ...
use Doctrine\DBAL\Types\Type;
// ...
// Register my type
Type::addType('mytype', 'My\Project\Types\MyType');
To convert the underlying database type of your
new "mytype" directly into an instance of ``MyType`` when performing
schema operations, the type has to be registered with the database
platform as well:
.. code-block:: php
<?php
$conn = $em->getConnection();
$conn->getDatabasePlatform()->registerDoctrineTypeMapping('db_mytype', 'mytype');
When registering the custom types in the configuration you specify a unique
name for the mapping type and map that to the corresponding fully qualified
class name. Now the new type can be used when mapping columns:
.. code-block:: php
<?php
class MyPersistentClass
{
/** @Column(type="mytype") */
private $field;
}

View File

@@ -0,0 +1,239 @@
Persisting the Decorator Pattern
================================
.. sectionauthor:: Chris Woodford <chris.woodford@gmail.com>
This recipe will show you a simple example of how you can use
Doctrine ORM to persist an implementation of the
`Decorator Pattern <https://en.wikipedia.org/wiki/Decorator_pattern>`_
Component
---------
The ``Component`` class needs to be persisted, so it's going to
be an ``Entity``. As the top of the inheritance hierarchy, it's going
to have to define the persistent inheritance. For this example, we
will use Single Table Inheritance, but Class Table Inheritance
would work as well. In the discriminator map, we will define two
concrete subclasses, ``ConcreteComponent`` and ``ConcreteDecorator``.
.. code-block:: php
<?php
namespace Test;
#[Entity]
#[InheritanceType('SINGLE_TABLE')]
#[DiscriminatorColumn(name: 'discr', type: 'string')]
#[DiscriminatorMap(['cc' => Component\ConcreteComponent::class,
'cd' => Decorator\ConcreteDecorator::class])]
abstract class Component
{
#[Id, Column]
#[GeneratedValue(strategy: 'AUTO')]
protected int|null $id = null;
#[Column(type: 'string', nullable: true)]
protected $name;
public function getId(): int|null
{
return $this->id;
}
public function setName(string $name): void
{
$this->name = $name;
}
public function getName(): string
{
return $this->name;
}
}
ConcreteComponent
-----------------
The ``ConcreteComponent`` class is pretty simple and doesn't do much
more than extend the abstract ``Component`` class (only for the
purpose of keeping this example simple).
.. code-block:: php
<?php
namespace Test\Component;
use Test\Component;
#[Entity]
class ConcreteComponent extends Component
{}
Decorator
---------
The ``Decorator`` class doesn't need to be persisted, but it does
need to define an association with a persisted ``Entity``. We can
use a ``MappedSuperclass`` for this.
.. code-block:: php
<?php
namespace Test;
#[MappedSuperclass]
abstract class Decorator extends Component
{
#[OneToOne(targetEntity: Component::class, cascade: ['all'])]
#[JoinColumn(name: 'decorates', referencedColumnName: 'id')]
protected $decorates;
/**
* initialize the decorator
* @param Component $c
*/
public function __construct(Component $c)
{
$this->setDecorates($c);
}
/**
* (non-PHPdoc)
* @see Test.Component::getName()
*/
public function getName(): string
{
return 'Decorated ' . $this->getDecorates()->getName();
}
/** the component being decorated */
protected function getDecorates(): Component
{
return $this->decorates;
}
/** sets the component being decorated */
protected function setDecorates(Component $c): void
{
$this->decorates = $c;
}
}
All operations on the ``Decorator`` (i.e. persist, remove, etc) will
cascade from the ``Decorator`` to the ``Component``. This means that
when we persist a ``Decorator``, Doctrine will take care of
persisting the chain of decorated objects for us. A ``Decorator`` can
be treated exactly as a ``Component`` when it comes time to
persisting it.
The ``Decorator's`` constructor accepts an instance of a
``Component``, as defined by the ``Decorator`` pattern. The
setDecorates/getDecorates methods have been defined as protected to
hide the fact that a ``Decorator`` is decorating a ``Component`` and
keeps the ``Component`` interface and the ``Decorator`` interface
identical.
To illustrate the intended result of the ``Decorator`` pattern, the
getName() method has been overridden to append a string to the
``Component's`` getName() method.
ConcreteDecorator
-----------------
The final class required to complete a simple implementation of the
Decorator pattern is the ``ConcreteDecorator``. In order to further
illustrate how the ``Decorator`` can alter data as it moves through
the chain of decoration, a new field, "special", has been added to
this class. The getName() has been overridden and appends the value
of the getSpecial() method to its return value.
.. code-block:: php
<?php
namespace Test\Decorator;
use Test\Decorator;
#[Entity]
class ConcreteDecorator extends Decorator
{
#[Column(type: 'string', nullable: true)]
protected string|null $special = null;
public function setSpecial(string|null $special): void
{
$this->special = $special;
}
public function getSpecial(): string|null
{
return $this->special;
}
/**
* (non-PHPdoc)
* @see Test.Component::getName()
*/
public function getName(): string
{
return '[' . $this->getSpecial()
. '] ' . parent::getName();
}
}
Examples
--------
Here is an example of how to persist and retrieve your decorated
objects
.. code-block:: php
<?php
use Test\Component\ConcreteComponent,
Test\Decorator\ConcreteDecorator;
// assumes Doctrine ORM is configured and an instance of
// an EntityManager is available as $em
// create a new concrete component
$c = new ConcreteComponent();
$c->setName('Test Component 1');
$em->persist($c); // assigned unique ID = 1
// create a new concrete decorator
$c = new ConcreteComponent();
$c->setName('Test Component 2');
$d = new ConcreteDecorator($c);
$d->setSpecial('Really');
$em->persist($d);
// assigns c as unique ID = 2, and d as unique ID = 3
$em->flush();
$c = $em->find('Test\Component', 1);
$d = $em->find('Test\Component', 3);
echo get_class($c);
// prints: Test\Component\ConcreteComponent
echo $c->getName();
// prints: Test Component 1
echo get_class($d)
// prints: Test\Component\ConcreteDecorator
echo $d->getName();
// prints: [Really] Decorated Test Component 2

View File

@@ -0,0 +1,217 @@
Extending DQL in Doctrine ORM: Custom AST Walkers
===============================================
.. sectionauthor:: Benjamin Eberlei <kontakt@beberlei.de>
The Doctrine Query Language (DQL) is a proprietary sql-dialect that
substitutes tables and columns for Entity names and their fields.
Using DQL you write a query against the database using your
entities. With the help of the metadata you can write very concise,
compact and powerful queries that are then translated into SQL by
the Doctrine ORM.
In Doctrine 1 the DQL language was not implemented using a real
parser. This made modifications of the DQL by the user impossible.
Doctrine ORM in contrast has a real parser for the DQL language,
which transforms the DQL statement into an
`Abstract Syntax Tree <https://en.wikipedia.org/wiki/Abstract_syntax_tree>`_
and generates the appropriate SQL statement for it. Since this
process is deterministic Doctrine heavily caches the SQL that is
generated from any given DQL query, which reduces the performance
overhead of the parsing process to zero.
You can modify the Abstract syntax tree by hooking into DQL parsing
process by adding a Custom Tree Walker. A walker is an interface
that walks each node of the Abstract syntax tree, thereby
generating the SQL statement.
There are two types of custom tree walkers that you can hook into
the DQL parser:
- An output walker. This one actually generates the SQL, and there
is only ever one of them. We implemented the default SqlWalker
implementation for it.
- A tree walker. There can be many tree walkers, they cannot
generate the SQL, however they can modify the AST before its
rendered to SQL.
Now this is all awfully technical, so let me come to some use-cases
fast to keep you motivated. Using walker implementation you can for
example:
- Modify the AST to generate a Count Query to be used with a
paginator for any given DQL query.
- Modify the Output Walker to generate vendor-specific SQL
(instead of ANSI).
- Modify the AST to add additional where clauses for specific
entities (example ACL, country-specific content...)
- Modify the Output walker to pretty print the SQL for debugging
purposes.
In this cookbook-entry I will show examples of the first two
points. There are probably much more use-cases.
Generic count query for pagination
----------------------------------
Say you have a blog and posts all with one category and one author.
A query for the front-page or any archive page might look something
like:
.. code-block:: sql
SELECT p, c, a FROM BlogPost p JOIN p.category c JOIN p.author a WHERE ...
Now in this query the blog post is the root entity, meaning it's the
one that is hydrated directly from the query and returned as an
array of blog posts. In contrast the comment and author are loaded
for deeper use in the object tree.
A pagination for this query would want to approximate the number of
posts that match the WHERE clause of this query to be able to
predict the number of pages to show to the user. A draft of the DQL
query for pagination would look like:
.. code-block:: sql
SELECT count(DISTINCT p.id) FROM BlogPost p JOIN p.category c JOIN p.author a WHERE ...
Now you could go and write each of these queries by hand, or you
can use a tree walker to modify the AST for you. Let's see how the
API would look for this use-case:
.. code-block:: php
<?php
$pageNum = 1;
$query = $em->createQuery($dql);
$query->setFirstResult( ($pageNum-1) * 20)->setMaxResults(20);
$totalResults = Paginate::count($query);
$results = $query->getResult();
The ``Paginate::count(Query $query)`` looks like:
.. code-block:: php
<?php
class Paginate
{
static public function count(Query $query)
{
/** @var Query $countQuery */
$countQuery = clone $query;
$countQuery->setHint(Query::HINT_CUSTOM_TREE_WALKERS, array('DoctrineExtensions\Paginate\CountSqlWalker'));
$countQuery->setFirstResult(null)->setMaxResults(null);
return $countQuery->getSingleScalarResult();
}
}
It clones the query, resets the limit clause first and max results
and registers the ``CountSqlWalker`` custom tree walker which
will modify the AST to execute a count query. The walkers
implementation is:
.. code-block:: php
<?php
class CountSqlWalker extends TreeWalkerAdapter
{
/**
* Walks down a SelectStatement AST node, thereby generating the appropriate SQL.
*
* @return string The SQL.
*/
public function walkSelectStatement(SelectStatement $AST)
{
$parent = null;
$parentName = null;
foreach ($this->_getQueryComponents() as $dqlAlias => $qComp) {
if ($qComp['parent'] === null && $qComp['nestingLevel'] == 0) {
$parent = $qComp;
$parentName = $dqlAlias;
break;
}
}
$pathExpression = new PathExpression(
PathExpression::TYPE_STATE_FIELD | PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION, $parentName,
$parent['metadata']->getSingleIdentifierFieldName()
);
$pathExpression->type = PathExpression::TYPE_STATE_FIELD;
$AST->selectClause->selectExpressions = array(
new SelectExpression(
new AggregateExpression('count', $pathExpression, true), null
)
);
}
}
This will delete any given select expressions and replace them with
a distinct count query for the root entities primary key. This will
only work if your entity has only one identifier field (composite
keys won't work).
Modify the Output Walker to generate Vendor specific SQL
--------------------------------------------------------
Most RMDBS have vendor-specific features for optimizing select
query execution plans. You can write your own output walker to
introduce certain keywords using the Query Hint API. A query hint
can be set via ``Query::setHint($name, $value)`` as shown in the
previous example with the ``HINT_CUSTOM_TREE_WALKERS`` query hint.
We will implement a custom Output Walker that allows to specify the
``SQL_NO_CACHE`` query hint.
.. code-block:: php
<?php
$dql = "SELECT p, c, a FROM BlogPost p JOIN p.category c JOIN p.author a WHERE ...";
$query = $m->createQuery($dql);
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'DoctrineExtensions\Query\MysqlWalker');
$query->setHint("mysqlWalker.sqlNoCache", true);
$results = $query->getResult();
Our ``MysqlWalker`` will extend the default ``SqlWalker``. We will
modify the generation of the SELECT clause, adding the
``SQL_NO_CACHE`` on those queries that need it:
.. code-block:: php
<?php
class MysqlWalker extends SqlWalker
{
/**
* Walks down a SelectClause AST node, thereby generating the appropriate SQL.
*
* @param $selectClause
* @return string The SQL.
*/
public function walkSelectClause($selectClause)
{
$sql = parent::walkSelectClause($selectClause);
if ($this->getQuery()->getHint('mysqlWalker.sqlNoCache') === true) {
if ($selectClause->isDistinct) {
$sql = str_replace('SELECT DISTINCT', 'SELECT DISTINCT SQL_NO_CACHE', $sql);
} else {
$sql = str_replace('SELECT', 'SELECT SQL_NO_CACHE', $sql);
}
}
return $sql;
}
}
Writing extensions to the Output Walker requires a very deep
understanding of the DQL Parser and Walkers, but may offer your
huge benefits with using vendor specific features. This would still
allow you write DQL queries instead of NativeQueries to make use of
vendor specific features.

View File

@@ -0,0 +1,249 @@
DQL User Defined Functions
==========================
.. sectionauthor:: Benjamin Eberlei <kontakt@beberlei.de>
By default DQL supports a limited subset of all the vendor-specific
SQL functions common between all the vendors. However in many cases
once you have decided on a specific database vendor, you will never
change it during the life of your project. This decision for a
specific vendor potentially allows you to make use of powerful SQL
features that are unique to the vendor.
It is worth to mention that Doctrine ORM also allows you to handwrite
your SQL instead of extending the DQL parser. Extending DQL is sort of an
advanced extension point. You can map arbitrary SQL to your objects
and gain access to vendor specific functionalities using the
``EntityManager#createNativeQuery()`` API as described in
the :doc:`Native Query <../reference/native-sql>` chapter.
The DQL Parser has hooks to register functions that can then be
used in your DQL queries and transformed into SQL, allowing to
extend Doctrines Query capabilities to the vendors strength. This
post explains the User-Defined Functions API (UDF) of the Dql
Parser and shows some examples to give you some hints how you would
extend DQL.
There are three types of functions in DQL, those that return a
numerical value, those that return a string and those that return a
Date. Your custom method has to be registered as either one of
those. The return type information is used by the DQL parser to
check possible syntax errors during the parsing process, for
example using a string function return value in a math expression.
Registering your own DQL functions
----------------------------------
You can register your functions adding them to the ORM
configuration:
.. code-block:: php
<?php
$config = new \Doctrine\ORM\Configuration();
$config->addCustomStringFunction($name, $class);
$config->addCustomNumericFunction($name, $class);
$config->addCustomDatetimeFunction($name, $class);
$em = new EntityManager($connection, $config);
The ``$name`` is the name the function will be referred to in the
DQL query. ``$class`` is a string of a class-name which has to
extend ``Doctrine\ORM\Query\Node\FunctionNode``. This is a class
that offers all the necessary API and methods to implement a UDF.
Instead of providing the function class name, you can also provide
a callable that returns the function object:
.. code-block:: php
<?php
$config = new \Doctrine\ORM\Configuration();
$config->addCustomStringFunction($name, function () {
return new MyCustomFunction();
});
In this post we will implement some MySql specific Date calculation
methods, which are quite handy in my opinion:
Date Diff
---------
`Mysql's DateDiff function <https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_datediff>`_
takes two dates as argument and calculates the difference in days
with ``date1-date2``.
The DQL parser is a top-down recursive descent parser to generate
the Abstract-Syntax Tree (AST) and uses a TreeWalker approach to
generate the appropriate SQL from the AST. This makes reading the
Parser/TreeWalker code manageable in a finite amount of time.
The ``FunctionNode`` class I referred to earlier requires you to
implement two methods, one for the parsing process (obviously)
called ``parse`` and one for the TreeWalker process called
``getSql()``. I show you the code for the DateDiff method and
discuss it step by step:
.. code-block:: php
<?php
/**
* DateDiffFunction ::= "DATEDIFF" "(" ArithmeticPrimary "," ArithmeticPrimary ")"
*/
class DateDiff extends FunctionNode
{
// (1)
public $firstDateExpression = null;
public $secondDateExpression = null;
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(TokenType::T_IDENTIFIER); // (2)
$parser->match(TokenType::T_OPEN_PARENTHESIS); // (3)
$this->firstDateExpression = $parser->ArithmeticPrimary(); // (4)
$parser->match(TokenType::T_COMMA); // (5)
$this->secondDateExpression = $parser->ArithmeticPrimary(); // (6)
$parser->match(TokenType::T_CLOSE_PARENTHESIS); // (3)
}
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{
return 'DATEDIFF(' .
$this->firstDateExpression->dispatch($sqlWalker) . ', ' .
$this->secondDateExpression->dispatch($sqlWalker) .
')'; // (7)
}
}
The Parsing process of the DATEDIFF function is going to find two
expressions the date1 and the date2 values, whose AST Node
representations will be saved in the variables of the DateDiff
FunctionNode instance at (1).
The parse() method has to cut the function call "DATEDIFF" and its
argument into pieces. Since the parser detects the function using a
lookahead the T\_IDENTIFIER of the function name has to be taken
from the stack (2), followed by a detection of the arguments in
(4)-(6). The opening and closing parenthesis have to be detected
also. This happens during the Parsing process and leads to the
generation of a DateDiff FunctionNode somewhere in the AST of the
dql statement.
The ``ArithmeticPrimary`` method call is the most common
denominator of valid EBNF tokens taken from the :ref:`DQL EBNF grammar
<dql_ebnf_grammar>`
that matches our requirements for valid input into the DateDiff Dql
function. Picking the right tokens for your methods is a tricky
business, but the EBNF grammar is pretty helpful finding it, as is
looking at the Parser source code.
Now in the TreeWalker process we have to pick up this node and
generate SQL from it, which apparently is quite easy looking at the
code in (7). Since we don't know which type of AST Node the first
and second Date expression are we are just dispatching them back to
the SQL Walker to generate SQL from and then wrap our DATEDIFF
function call around this output.
Now registering this DateDiff FunctionNode with the ORM using:
.. code-block:: php
<?php
$config = new \Doctrine\ORM\Configuration();
$config->addCustomStringFunction('DATEDIFF', 'DoctrineExtensions\Query\MySql\DateDiff');
We can do fancy stuff like:
.. code-block:: sql
SELECT p FROM DoctrineExtensions\Query\BlogPost p WHERE DATEDIFF(CURRENT_TIME(), p.created) < 7
Date Add
--------
Often useful it the ability to do some simple date calculations in
your DQL query using
`MySql's DATE_ADD function <https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-add>`_.
I'll skip the blah and show the code for this function:
.. code-block:: php
<?php
/**
* DateAddFunction ::=
* "DATE_ADD" "(" ArithmeticPrimary ", INTERVAL" ArithmeticPrimary Identifier ")"
*/
class DateAdd extends FunctionNode
{
public $firstDateExpression = null;
public $intervalExpression = null;
public $unit = null;
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);
$this->firstDateExpression = $parser->ArithmeticPrimary();
$parser->match(TokenType::T_COMMA);
$parser->match(TokenType::T_IDENTIFIER);
$this->intervalExpression = $parser->ArithmeticPrimary();
$parser->match(TokenType::T_IDENTIFIER);
/** @var Lexer $lexer */
$lexer = $parser->getLexer();
$this->unit = $lexer->token['value'];
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{
return 'DATE_ADD(' .
$this->firstDateExpression->dispatch($sqlWalker) . ', INTERVAL ' .
$this->intervalExpression->dispatch($sqlWalker) . ' ' . $this->unit .
')';
}
}
The only difference compared to the DATEDIFF here is, we
additionally need the ``Lexer`` to access the value of the
``T_IDENTIFIER`` token for the Date Interval unit, for example the
MONTH in:
.. code-block:: sql
SELECT p FROM DoctrineExtensions\Query\BlogPost p WHERE DATE_ADD(CURRENT_TIME(), INTERVAL 4 MONTH) > p.created
The above method now only supports the specification using
``INTERVAL``, to also allow a real date in DATE\_ADD we need to add
some decision logic to the parsing process (makes up for a nice
exercise).
Now as you see, the Parsing process doesn't catch all the possible
SQL errors, here we don't match for all the valid inputs for the
interval unit. However where necessary we rely on the database
vendors SQL parser to show us further errors in the parsing
process, for example if the Unit would not be one of the supported
values by MySql.
Conclusion
----------
Now that you all know how you can implement vendor specific SQL
functionalities in DQL, we would be excited to see user extensions
that add vendor specific function packages, for example more math
functions, XML + GIS Support, Hashing functions and so on.
For ORM we will come with the current set of functions, however for
a future version we will re-evaluate if we can abstract even more
vendor sql functions and extend the DQL languages scope.
Code for this Extension to DQL and other Doctrine Extensions can be
found
`in the GitHub DoctrineExtensions repository <https://github.com/beberlei/DoctrineExtensions>`_.

View File

@@ -0,0 +1,93 @@
Entities in the Session
=======================
There are several use-cases to save entities in the session, for example:
1. User data
2. Multi-step forms
To achieve this with Doctrine you have to pay attention to some details to get
this working.
Updating an entity
------------------
In Doctrine an entity objects has to be "managed" by an EntityManager to be
updatable. Entities saved into the session are not managed in the next request
anymore. This means that you have to update the entities with the stored session
data after you fetch the entities from the EntityManager again.
For a representative User object the code to get data from the session into a
managed Doctrine object can look like these examples:
Working with scalars
~~~~~~~~~~~~~~~~~~~~
In simpler applications there is no need to work with objects in sessions and you can use
separate session elements.
.. code-block:: php
<?php
require_once 'bootstrap.php';
session_start();
if (isset($_SESSION['userId']) && is_int($_SESSION['userId'])) {
$userId = $_SESSION['userId'];
$em = GetEntityManager(); // creates an EntityManager
$user = $em->find(User::class, $userId);
$user->setValue($_SESSION['storedValue']);
$em->flush();
}
Working with custom data transfer objects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If objects are needed, we discourage the storage of entity objects in the session. It's
preferable to use a `DTO (data transfer object) <https://en.wikipedia.org/wiki/Data_transfer_object>`_
instead and merge the DTO data later with the entity.
.. code-block:: php
<?php
require_once 'bootstrap.php';
session_start();
if (isset($_SESSION['user']) && $_SESSION['user'] instanceof UserDto) {
$userDto = $_SESSION['user'];
$em = GetEntityManager(); // creates an EntityManager
$userEntity = $em->find(User::class, $userDto->getId());
$userEntity->populateFromDto($userDto);
$em->flush();
}
Serializing entity into the session
-----------------------------------
Entities that are serialized into the session normally contain references to
other entities as well. Think of the user entity has a reference to their
articles, groups, photos or many other different entities. If you serialize
this object into the session then you don't want to serialize the related
entities as well. This is why you shouldn't serialize an entity and use
only the needed values of it. This can happen with the help of a DTO.
.. code-block:: php
<?php
require_once 'bootstrap.php';
$em = GetEntityManager(); // creates an EntityManager
$user = $em->find("User", 1);
$userDto = new UserDto($user->getId(), $user->getFirstName(), $user->getLastName());
// or "UserDto::createFrom($user);", but don't store an entity in a property. Only its values without relations.
$_SESSION['user'] = $userDto;

View File

@@ -0,0 +1,112 @@
Implementing ArrayAccess for Domain Objects
===========================================
.. sectionauthor:: Roman Borschel <roman@code-factory.org>
This recipe will show you how to implement ArrayAccess for your
domain objects in order to allow more uniform access, for example
in templates. In these examples we will implement ArrayAccess on a
`Layer Supertype <https://martinfowler.com/eaaCatalog/layerSupertype.html>`_
for all our domain objects.
Option 1
--------
In this implementation we will make use of PHPs highly dynamic
nature to dynamically access properties of a subtype in a supertype
at runtime. Note that this implementation has 2 main caveats:
- It will not work with private fields
- It will not go through any getters/setters
.. code-block:: php
<?php
abstract class DomainObject implements ArrayAccess
{
public function offsetExists($offset) {
return isset($this->$offset);
}
public function offsetSet($offset, $value) {
$this->$offset = $value;
}
public function offsetGet($offset) {
return $this->$offset;
}
public function offsetUnset($offset) {
$this->$offset = null;
}
}
Option 2
--------
In this implementation we will dynamically invoke getters/setters.
Again we use PHPs dynamic nature to invoke methods on a subtype
from a supertype at runtime. This implementation has the following
caveats:
- It relies on a naming convention
- The semantics of offsetExists can differ
- offsetUnset will not work with typehinted setters
.. code-block:: php
<?php
abstract class DomainObject implements ArrayAccess
{
public function offsetExists($offset) {
// In this example we say that exists means it is not null
$value = $this->{"get$offset"}();
return $value !== null;
}
public function offsetSet($offset, $value) {
$this->{"set$offset"}($value);
}
public function offsetGet($offset) {
return $this->{"get$offset"}();
}
public function offsetUnset($offset) {
$this->{"set$offset"}(null);
}
}
Read-only
---------
You can slightly tweak option 1 or option 2 in order to make array
access read-only. This will also circumvent some of the caveats of
each option. Simply make offsetSet and offsetUnset throw an
exception (i.e. BadMethodCallException).
.. code-block:: php
<?php
abstract class DomainObject implements ArrayAccess
{
public function offsetExists($offset) {
// option 1 or option 2
}
public function offsetSet($offset, $value) {
throw new BadMethodCallException("Array access of class " . get_class($this) . " is read-only!");
}
public function offsetGet($offset) {
// option 1 or option 2
}
public function offsetUnset($offset) {
throw new BadMethodCallException("Array access of class " . get_class($this) . " is read-only!");
}
}

View File

@@ -0,0 +1,198 @@
Mysql Enums
===========
The type system of Doctrine ORM consists of flyweights, which means there is only
one instance of any given type. Additionally types do not contain state. Both
assumptions make it rather complicated to work with the Enum Type of MySQL that
is used quite a lot by developers.
When using Enums with a non-tweaked Doctrine ORM application you will get
errors from the Schema-Tool commands due to the unknown database type "enum".
By default Doctrine does not map the MySQL enum type to a Doctrine type.
This is because Enums contain state (their allowed values) and Doctrine
types don't.
This cookbook entry shows two possible solutions to work with MySQL enums.
But first a word of warning. The MySQL Enum type has considerable downsides:
- Adding new values requires to rebuild the whole table, which can take hours
depending on the size.
- Enums are ordered in the way the values are specified, not in their "natural" order.
- Enums validation mechanism for allowed values is not necessarily good,
specifying invalid values leads to an empty enum for the default MySQL error
settings. You can easily replicate the "allow only some values" requirement
in your Doctrine entities.
Solution 1: Mapping to Varchars
-------------------------------
You can map ENUMs to varchars. You can register MySQL ENUMs to map to Doctrine
varchars. This way Doctrine always resolves ENUMs to Doctrine varchars. It
will even detect this match correctly when using SchemaTool update commands.
.. code-block:: php
<?php
$conn = $em->getConnection();
$conn->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
In this case you have to ensure that each varchar field that is an enum in the
database only gets passed the allowed values. You can easily enforce this in your
entities:
.. code-block:: php
<?php
#[Entity]
class Article
{
const STATUS_VISIBLE = 'visible';
const STATUS_INVISIBLE = 'invisible';
#[Column(type: "string")]
private $status;
public function setStatus($status)
{
if (!in_array($status, array(self::STATUS_VISIBLE, self::STATUS_INVISIBLE))) {
throw new \InvalidArgumentException("Invalid status");
}
$this->status = $status;
}
}
If you want to actively create enums through the Doctrine Schema-Tool by using
the **columnDefinition** attribute.
.. code-block:: php
<?php
#[Entity]
class Article
{
#[Column(type: "string", columnDefinition: "ENUM('visible', 'invisible')")]
private $status;
}
In this case however Schema-Tool update will have a hard time not to request changes for this column on each call.
Solution 2: Defining a Type
---------------------------
You can make a stateless ENUM type by creating a type class for each unique set of ENUM values.
For example for the previous enum type:
.. code-block:: php
<?php
namespace MyProject\DBAL;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
class EnumVisibilityType extends Type
{
const ENUM_VISIBILITY = 'enumvisibility';
const STATUS_VISIBLE = 'visible';
const STATUS_INVISIBLE = 'invisible';
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
return "ENUM('visible', 'invisible')";
}
public function convertToPHPValue($value, AbstractPlatform $platform)
{
return $value;
}
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if (!in_array($value, array(self::STATUS_VISIBLE, self::STATUS_INVISIBLE))) {
throw new \InvalidArgumentException("Invalid status");
}
return $value;
}
public function getName()
{
return self::ENUM_VISIBILITY;
}
public function requiresSQLCommentHint(AbstractPlatform $platform)
{
return true;
}
}
You can register this type with ``Type::addType('enumvisibility', 'MyProject\DBAL\EnumVisibilityType');``.
Then in your entity you can just use this type:
.. code-block:: php
<?php
#[Entity]
class Article
{
#[Column(type: "enumvisibility")]
private $status;
}
You can generalize this approach easily to create a base class for enums:
.. code-block:: php
<?php
namespace MyProject\DBAL;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
abstract class EnumType extends Type
{
protected $name;
protected $values = array();
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
$values = array_map(function($val) { return "'".$val."'"; }, $this->values);
return "ENUM(".implode(", ", $values).")";
}
public function convertToPHPValue($value, AbstractPlatform $platform)
{
return $value;
}
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if (!in_array($value, $this->values)) {
throw new \InvalidArgumentException("Invalid '".$this->name."' value.");
}
return $value;
}
public function getName()
{
return $this->name;
}
public function requiresSQLCommentHint(AbstractPlatform $platform)
{
return true;
}
}
With this base class you can define an enum as easily as:
.. code-block:: php
<?php
namespace MyProject\DBAL;
class EnumVisibilityType extends EnumType
{
protected $name = 'enumvisibility';
protected $values = array('visible', 'invisible');
}

View File

@@ -0,0 +1,130 @@
Keeping your Modules independent
=================================
One of the goals of using modules is to create discrete units of functionality
that do not have many (if any) dependencies, allowing you to use that
functionality in other applications without including unnecessary items.
Doctrine ORM includes a new utility called the ``ResolveTargetEntityListener``,
that functions by intercepting certain calls inside Doctrine and rewrite
targetEntity parameters in your metadata mapping at runtime. It means that
in your bundle you are able to use an interface or abstract class in your
mappings and expect correct mapping to a concrete entity at runtime.
This functionality allows you to define relationships between different entities
but not making them hard dependencies.
Background
----------
In the following example, the situation is we have an `InvoiceModule`
which provides invoicing functionality, and a `CustomerModule` that
contains customer management tools. We want to keep these separated,
because they can be used in other systems without each other, but for
our application we want to use them together.
In this case, we have an ``Invoice`` entity with a relationship to a
non-existent object, an ``InvoiceSubjectInterface``. The goal is to get
the ``ResolveTargetEntityListener`` to replace any mention of the interface
with a real object that implements that interface.
Set up
------
We're going to use the following basic entities (which are incomplete
for brevity) to explain how to set up and use the RTEL.
A Customer entity
.. code-block:: php
<?php
// src/Acme/AppModule/Entity/Customer.php
namespace Acme\AppModule\Entity;
use Doctrine\ORM\Mapping as ORM;
use Acme\CustomerModule\Entity\Customer as BaseCustomer;
use Acme\InvoiceModule\Model\InvoiceSubjectInterface;
#[ORM\Entity]
#[ORM\Table(name: 'customer')]
class Customer extends BaseCustomer implements InvoiceSubjectInterface
{
// In our example, any methods defined in the InvoiceSubjectInterface
// are already implemented in the BaseCustomer
}
An Invoice entity
.. code-block:: php
<?php
// src/Acme/InvoiceModule/Entity/Invoice.php
namespace Acme\InvoiceModule\Entity;
use Doctrine\ORM\Mapping AS ORM;
use Acme\InvoiceModule\Model\InvoiceSubjectInterface;
#[ORM\Entity]
#[ORM\Table(name: 'invoice')]
class Invoice
{
#[ORM\ManyToOne(targetEntity: InvoiceSubjectInterface::class)]
protected InvoiceSubjectInterface $subject;
}
An InvoiceSubjectInterface
.. code-block:: php
<?php
// src/Acme/InvoiceModule/Model/InvoiceSubjectInterface.php
namespace Acme\InvoiceModule\Model;
/**
* An interface that the invoice Subject object should implement.
* In most circumstances, only a single object should implement
* this interface as the ResolveTargetEntityListener can only
* change the target to a single object.
*/
interface InvoiceSubjectInterface
{
// List any additional methods that your InvoiceModule
// will need to access on the subject so that you can
// be sure that you have access to those methods.
/**
* @return string
*/
public function getName();
}
Next, we need to configure the listener. Add this to the area you set up Doctrine. You
must set this up in the way outlined below, otherwise you can not be guaranteed that
the targetEntity resolution will occur reliably:
.. code-block:: php
<?php
$evm = new \Doctrine\Common\EventManager;
$rtel = new \Doctrine\ORM\Tools\ResolveTargetEntityListener;
// Adds a target-entity class
$rtel->addResolveTargetEntity('Acme\\InvoiceModule\\Model\\InvoiceSubjectInterface', 'Acme\\CustomerModule\\Entity\\Customer', array());
// Add the ResolveTargetEntityListener
$evm->addEventListener(Doctrine\ORM\Events::loadClassMetadata, $rtel);
$connection = \Doctrine\DBAL\DriverManager::getConnection($connectionOptions, $config, $evm);
$em = new \Doctrine\ORM\EntityManager($connection, $config, $evm);
Final Thoughts
--------------
With the ``ResolveTargetEntityListener``, we are able to decouple our
bundles, keeping them usable by themselves, but still being able to
define relationships between different objects. By using this method,
I've found my bundles end up being easier to maintain independently.

View File

@@ -0,0 +1,84 @@
SQL-Table Prefixes
==================
This recipe is intended as an example of implementing a
loadClassMetadata listener to provide a Table Prefix option for
your application. The method used below is not a hack, but fully
integrates into the Doctrine system, all SQL generated will include
the appropriate table prefix.
In most circumstances it is desirable to separate different
applications into individual databases, but in certain cases, it
may be beneficial to have a table prefix for your Entities to
separate them from other vendor products in the same database.
Implementing the listener
-------------------------
The listener in this example has been set up with the
DoctrineExtensions namespace. You create this file in your
library/DoctrineExtensions directory, but will need to set up
appropriate autoloaders.
.. code-block:: php
<?php
namespace DoctrineExtensions;
use \Doctrine\ORM\Event\LoadClassMetadataEventArgs;
class TablePrefix
{
protected $prefix = '';
public function __construct($prefix)
{
$this->prefix = (string) $prefix;
}
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
$classMetadata = $eventArgs->getClassMetadata();
if (!$classMetadata->isInheritanceTypeSingleTable() || $classMetadata->getName() === $classMetadata->rootEntityName) {
$classMetadata->setPrimaryTable([
'name' => $this->prefix . $classMetadata->getTableName()
]);
}
foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadata::MANY_TO_MANY && $mapping['isOwningSide']) {
$mappedTableName = $mapping['joinTable']['name'];
$classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix . $mappedTableName;
}
}
}
}
Telling the EntityManager about our listener
--------------------------------------------
A listener of this type must be set up before the EntityManager has
been initialised, otherwise an Entity might be created or cached
before the prefix has been set.
.. note::
If you set this listener up, be aware that you will need
to clear your caches and drop then recreate your database schema.
.. code-block:: php
<?php
// $connectionOptions and $config set earlier
$evm = new \Doctrine\Common\EventManager;
// Table Prefix
$tablePrefix = new \DoctrineExtensions\TablePrefix('prefix_');
$evm->addEventListener(\Doctrine\ORM\Events::loadClassMetadata, $tablePrefix);
$em = new \Doctrine\ORM\EntityManager($connection, $config, $evm);

View File

@@ -0,0 +1,253 @@
Strategy-Pattern
================
This recipe will give you a short introduction on how to design
similar entities without using expensive (i.e. slow) inheritance
but with not more than *the well-known strategy pattern* event
listeners
Scenario / Problem
------------------
Given a Content-Management-System, we probably want to add / edit
some so-called "blocks" and "panels". What are they for?
- A block might be a registration form, some text content, a table
with information. A good example might also be a small calendar.
- A panel is by definition a block that can itself contain blocks.
A good example for a panel might be a sidebar box: You could easily
add a small calendar into it.
So, in this scenario, when building your CMS, you will surely add
lots of blocks and panels to your pages and you will find yourself
highly uncomfortable because of the following:
- Every existing page needs to know about the panels it contains -
therefore, you'll have an association to your panels. But if you've
got several types of panels - what do you do? Add an association to
every panel-type? This wouldn't be flexible. You might be tempted
to add an AbstractPanelEntity and an AbstractBlockEntity that use
class inheritance. Your page could then only confer to the
AbstractPanelType and Doctrine ORM would do the rest for you, i.e.
load the right entities. But - you'll for sure have lots of panels
and blocks, and even worse, you'd have to edit the discriminator
map *manually* every time you or another developer implements a new
block / entity. This would tear down any effort of modular
programming.
Therefore, we need something that's far more flexible.
Solution
--------
The solution itself is pretty easy. We will have one base class
that will be loaded via the page and that has specific behaviour -
a Block class might render the front-end and even the backend, for
example. Now, every block that you'll write might look different or
need different data - therefore, we'll offer an API to these
methods but internally, we use a strategy that exactly knows what
to do.
First of all, we need to make sure that we have an interface that
contains every needed action. Such actions would be rendering the
front-end or the backend, solving dependencies (blocks that are
supposed to be placed in the sidebar could refuse to be placed in
the middle of your page, for example).
Such an interface could look like this:
.. code-block:: php
<?php
/**
* This interface defines the basic actions that a block / panel needs to support.
*
* Every blockstrategy is *only* responsible for rendering a block and declaring some basic
* support, but *not* for updating its configuration etc. For this purpose, use controllers
* and models.
*/
interface BlockStrategyInterface {
/**
* This could configure your entity
*/
public function setConfig(Config\EntityConfig $config);
/**
* Returns the config this strategy is configured with.
* @return Core\Model\Config\EntityConfig
*/
public function getConfig();
/**
* Set the view object.
* @param \Zend_View_Interface $view
* @return \Zend_View_Helper_Interface
*/
public function setView(\Zend_View_Interface $view);
/**
* @return \Zend_View_Interface
*/
public function getView();
/**
* Renders this strategy. This method will be called when the user
* displays the site.
*
* @return string
*/
public function renderFrontend();
/**
* Renders the backend of this block. This method will be called when
* a user tries to reconfigure this block instance.
*
* Most of the time, this method will return / output a simple form which in turn
* calls some controllers.
*
* @return string
*/
public function renderBackend();
/**
* Returns all possible types of panels this block can be stacked onto
*
* @return array
*/
public function getRequiredPanelTypes();
/**
* Determines whether a Block is able to use a given type or not
* @param string $typeName The typename
* @return boolean
*/
public function canUsePanelType($typeName);
public function setBlockEntity(AbstractBlock $block);
public function getBlockEntity();
}
As you can see, we have a method "setBlockEntity" which ties a potential strategy to an object of type AbstractBlock. This type will simply define the basic behaviour of our blocks and could potentially look something like this:
.. code-block:: php
<?php
/**
* This is the base class for both Panels and Blocks.
* It shouldn't be extended by your own blocks - simply write a strategy!
*/
abstract class AbstractBlock {
/**
* The id of the block item instance
* This is a doctrine field, so you need to setup generation for it
* @var integer
*/
private $id;
// Add code for relation to the parent panel, configuration objects, ....
/**
* This var contains the classname of the strategy
* that is used for this blockitem. (This string (!) value will be persisted by Doctrine ORM)
*
* This is a doctrine field, so make sure that you use a
#[Column] attribute or setup your xml files correctly
* @var string
*/
protected $strategyClassName;
/**
* This var contains an instance of $this->blockStrategy. Will not be persisted by Doctrine ORM.
*
* @var BlockStrategyInterface
*/
protected $strategyInstance;
/**
* Returns the strategy that is used for this blockitem.
*
* The strategy itself defines how this block can be rendered etc.
*
* @return string
*/
public function getStrategyClassName() {
return $this->strategyClassName;
}
/**
* Returns the instantiated strategy
*
* @return BlockStrategyInterface
*/
public function getStrategyInstance() {
return $this->strategyInstance;
}
/**
* Sets the strategy this block / panel should work as. Make sure that you've used
* this method before persisting the block!
*
* @param BlockStrategyInterface $strategy
*/
public function setStrategy(BlockStrategyInterface $strategy) {
$this->strategyInstance = $strategy;
$this->strategyClassName = get_class($strategy);
$strategy->setBlockEntity($this);
}
Now, the important point is that $strategyClassName is a Doctrine ORM
field, i.e. Doctrine will persist this value. This is only the
class name of your strategy and not an instance!
Finishing your strategy pattern, we hook into the Doctrine postLoad
event and check whether a block has been loaded. If so, you will
initialize it - i.e. get the strategies classname, create an
instance of it and set it via setStrategyBlock().
This might look like this:
.. code-block:: php
<?php
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Events;
/**
* The BlockStrategyEventListener will initialize a strategy after the
* block itself was loaded.
*/
class BlockStrategyEventListener implements EventSubscriber {
protected $view;
public function __construct(\Zend_View_Interface $view) {
$this->view = $view;
}
public function getSubscribedEvents() {
return array(Events::postLoad);
}
public function postLoad(LifecycleEventArgs $args) {
$blockItem = $args->getObject();
// Both blocks and panels are instances of Block\AbstractBlock
if ($blockItem instanceof Block\AbstractBlock) {
$strategy = $blockItem->getStrategyClassName();
$strategyInstance = new $strategy();
if (null !== $blockItem->getConfig()) {
$strategyInstance->setConfig($blockItem->getConfig());
}
$strategyInstance->setView($this->view);
$blockItem->setStrategy($strategyInstance);
}
}
}
In this example, even some variables are set - like a view object
or a specific configuration object.

View File

@@ -0,0 +1,133 @@
Validation of Entities
======================
.. sectionauthor:: Benjamin Eberlei <kontakt@beberlei.de>
Doctrine ORM does not ship with any internal validators, the reason
being that we think all the frameworks out there already ship with
quite decent ones that can be integrated into your Domain easily.
What we offer are hooks to execute any kind of validation.
.. note::
You don't need to validate your entities in the lifecycle
events. Its only one of many options. Of course you can also
perform validations in value setters or any other method of your
entities that are used in your code.
Entities can register lifecycle event methods with Doctrine that
are called on different occasions. For validation we would need to
hook into the events called before persisting and updating. Even
though we don't support validation out of the box, the
implementation is even simpler than in Doctrine 1 and you will get
the additional benefit of being able to re-use your validation in
any other part of your domain.
Say we have an ``Order`` with several ``OrderLine`` instances. We
never want to allow any customer to order for a larger sum than they
are allowed to:
.. code-block:: php
<?php
class Order
{
public function assertCustomerAllowedBuying()
{
$orderLimit = $this->customer->getOrderLimit();
$amount = 0;
foreach ($this->orderLines as $line) {
$amount += $line->getAmount();
}
if ($amount > $orderLimit) {
throw new CustomerOrderLimitExceededException();
}
}
}
Now this is some pretty important piece of business logic in your
code, enforcing it at any time is important so that customers with
a unknown reputation don't owe your business too much money.
We can enforce this constraint in any of the metadata drivers.
First Attributes:
.. code-block:: php
<?php
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
use Doctrine\ORM\Mapping\PrePersist;
use Doctrine\ORM\Mapping\PreUpdate;
#[Entity]
#[HasLifecycleCallbacks]
class Order
{
#[PrePersist, PreUpdate]
public function assertCustomerAllowedBuying() {}
}
In XML Mappings:
.. code-block:: xml
<doctrine-mapping>
<entity name="Order">
<lifecycle-callbacks>
<lifecycle-callback type="prePersist" method="assertCustomerallowedBuying" />
<lifecycle-callback type="preUpdate" method="assertCustomerallowedBuying" />
</lifecycle-callbacks>
</entity>
</doctrine-mapping>
Now validation is performed whenever you call
``EntityManager#persist($order)`` or when you call
``EntityManager#flush()`` and an order is about to be updated. Any
Exception that happens in the lifecycle callbacks will be caught by
the EntityManager and the current transaction is rolled back.
Of course you can do any type of primitive checks, not null,
email-validation, string size, integer and date ranges in your
validation callbacks.
.. code-block:: php
<?php
class Order
{
#[PrePersist, PreUpdate]
public function validate()
{
if (!($this->plannedShipDate instanceof DateTime)) {
throw new ValidateException();
}
if ($this->plannedShipDate->format('U') < time()) {
throw new ValidateException();
}
if ($this->customer == null) {
throw new OrderRequiresCustomerException();
}
}
}
What is nice about lifecycle events is, you can also re-use the
methods at other places in your domain, for example in combination
with your form library. Additionally there is no limitation in the
number of methods you register on one particular event, i.e. you
can register multiple methods for validation in "PrePersist" or
"PreUpdate" or mix and share them in any combinations between those
two events.
There is no limit to what you can and can't validate in
"PrePersist" and "PreUpdate" as long as you don't create new entity
instances. This was already discussed in the previous blog post on
the Versionable extension, which requires another type of event
called "onFlush".
Further readings: :ref:`reference-events-lifecycle-events`

View File

@@ -0,0 +1,198 @@
Working with DateTime Instances
===============================
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 ORM.
DateTime changes are detected by Reference
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When calling ``EntityManager#flush()`` Doctrine computes the changesets of all the currently managed entities
and saves the differences to the database. In case of object properties (@Column(type="datetime") or @Column(type="object"))
these comparisons are always made **BY REFERENCE**. That means the following change will **NOT** be saved into the database:
.. code-block:: php
<?php
use DateTime;
#[Entity]
class Article
{
#[Column(type: 'datetime')]
private DateTime $updated;
public function setUpdated(): void
{
// will NOT be saved in the database
$this->updated->modify("now");
}
}
The way to go would be:
.. code-block:: php
<?php
use DateTime;
class Article
{
public function setUpdated(): void
{
// WILL be saved in the database
$this->updated = new DateTime("now");
}
}
Default Timezone Gotcha
~~~~~~~~~~~~~~~~~~~~~~~
By default Doctrine assumes that you are working with a default timezone. Each DateTime instance that
is created by Doctrine will be assigned the timezone that is currently the default, either through
the ``date.timezone`` ini setting or by calling ``date_default_timezone_set()``.
This is very important to handle correctly if your application runs on different servers or is moved from one to another server
(with different timezone settings). You have to make sure that the timezone is the correct one
on all this systems.
Handling different Timezones with the DateTime Type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you first come across the requirement to save different timezones you may be still optimistic about how
to manage this mess,
however let me crush your expectations fast. There is not a single database out there (supported by Doctrine ORM)
that supports timezones correctly. Correctly here means that you can cover all the use-cases that
can come up with timezones. If you don't believe me you should read up on `Storing DateTime
in Databases <https://derickrethans.nl/storing-date-time-in-database.html>`_.
The problem is simple. Not a single database vendor saves the timezone, only the differences to UTC.
However with frequent daylight saving and political timezone changes you can have a UTC offset that moves
in different offset directions depending on the real location.
The solution for this dilemma is simple. Don't use timezones with DateTime and Doctrine ORM. However there is a workaround
that even allows correct date-time handling with timezones:
1. Always convert any DateTime instance to UTC.
2. Only set Timezones for displaying purposes
3. Save the Timezone in the Entity for persistence.
Say we have an application for an international postal company and employees insert events regarding postal-package
around the world, in their current timezones. To determine the exact time an event occurred means to save both
the UTC time at the time of the booking and the timezone the event happened in.
.. code-block:: php
<?php
namespace DoctrineExtensions\DBAL\Types;
use DateTimeZone;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\DateTimeType;
class UTCDateTimeType extends DateTimeType
{
private static DateTimeZone $utc;
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value instanceof \DateTime) {
$value->setTimezone(self::getUtc());
}
return parent::convertToDatabaseValue($value, $platform);
}
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if (null === $value || $value instanceof \DateTime) {
return $value;
}
$converted = \DateTime::createFromFormat(
$platform->getDateTimeFormatString(),
$value,
self::getUtc()
);
if (! $converted) {
throw ConversionException::conversionFailedFormat(
$value,
$this->getName(),
$platform->getDateTimeFormatString()
);
}
return $converted;
}
private static function getUtc(): DateTimeZone
{
return self::$utc ??= new DateTimeZone('UTC');
}
}
This database type makes sure that every DateTime instance is always saved in UTC, relative
to the current timezone that the passed DateTime instance has.
To actually use this new type instead of the default ``datetime`` type, you need to run following
code before bootstrapping the ORM:
.. code-block:: php
<?php
use Doctrine\DBAL\Types\Type;
use DoctrineExtensions\DBAL\Types\UTCDateTimeType;
Type::overrideType('datetime', UTCDateTimeType::class);
Type::overrideType('datetimetz', UTCDateTimeType::class);
To be able to transform these values
back into their real timezone you have to save the timezone in a separate field of the entity
requiring timezoned datetimes:
.. code-block:: php
<?php
namespace Shipping;
#[Entity]
class Event
{
#[Column(type: 'datetime')]
private $created;
#[Column(type: 'string')]
private $timezone;
/**
* @var bool
*/
private $localized = false;
public function __construct(\DateTime $createDate)
{
$this->localized = true;
$this->created = $createDate;
$this->timezone = $createDate->getTimeZone()->getName();
}
public function getCreated()
{
if (!$this->localized) {
$this->created->setTimeZone(new \DateTimeZone($this->timezone));
}
return $this->created;
}
}
This snippet makes use of the previously discussed "changeset by reference only" property of
objects. That means a new DateTime will only be used during updating if the reference
changes between retrieval and flush operation. This means we can easily go and modify
the instance by setting the previous local timezone.

122
docs/en/index.rst Normal file
View File

@@ -0,0 +1,122 @@
Welcome to Doctrine ORM's documentation!
==========================================
The Doctrine documentation is comprised of tutorials, a reference section and
cookbook articles that explain different parts of the Object Relational mapper.
Doctrine DBAL and Doctrine Common both have their own documentation.
Getting Help
------------
If this documentation is not helping to answer questions you have about
Doctrine ORM don't panic. You can get help from different sources:
- There is a :doc:`FAQ <reference/faq>` with answers to frequent questions.
- The `Doctrine Mailing List <https://groups.google.com/group/doctrine-user>`_
- Slack chat room `#orm <https://www.doctrine-project.org/slack>`_
- Report a bug on `GitHub <https://github.com/doctrine/orm/issues>`_.
- On `StackOverflow <https://stackoverflow.com/questions/tagged/doctrine-orm>`_
If you need more structure over the different topics you can browse the table
of contents.
Getting Started
---------------
* **Tutorial**:
:doc:`Getting Started with Doctrine <tutorials/getting-started>`
* **Setup**:
:doc:`Installation & Configuration <reference/configuration>`
Mapping Objects onto a Database
-------------------------------
* **Mapping**:
:doc:`Objects <reference/basic-mapping>` \|
:doc:`Associations <reference/association-mapping>` \|
:doc:`Inheritance <reference/inheritance-mapping>`
* **Drivers**:
:doc:`Attributes <reference/attributes-reference>` \|
:doc:`XML <reference/xml-mapping>` \|
:doc:`PHP <reference/php-mapping>`
Working with Objects
--------------------
* **Basic Reference**:
:doc:`Entities <reference/working-with-objects>` \|
:doc:`Associations <reference/working-with-associations>` \|
:doc:`Events <reference/events>`
* **Query Reference**:
:doc:`DQL <reference/dql-doctrine-query-language>` \|
:doc:`QueryBuilder <reference/query-builder>` \|
:doc:`Native SQL <reference/native-sql>`
* **Internals**:
:doc:`Internals explained <reference/unitofwork>` \|
:doc:`Associations <reference/unitofwork-associations>`
Advanced Topics
---------------
* :doc:`Architecture <reference/architecture>`
* :doc:`Advanced Configuration <reference/advanced-configuration>`
* :doc:`Limitations and known issues <reference/limitations-and-known-issues>`
* :doc:`Commandline Tools <reference/tools>`
* :doc:`Transactions and Concurrency <reference/transactions-and-concurrency>`
* :doc:`Filters <reference/filters>`
* :doc:`NamingStrategy <reference/namingstrategy>`
* :doc:`TypedFieldMapper <reference/typedfieldmapper>`
* :doc:`Improving Performance <reference/improving-performance>`
* :doc:`Caching <reference/caching>`
* :doc:`Change Tracking Policies <reference/change-tracking-policies>`
* :doc:`Best Practices <reference/best-practices>`
* :doc:`Metadata Drivers <reference/metadata-drivers>`
* :doc:`Batch Processing <reference/batch-processing>`
* :doc:`Second Level Cache <reference/second-level-cache>`
Tutorials
---------
* :doc:`Indexed associations <tutorials/working-with-indexed-associations>`
* :doc:`Extra Lazy Associations <tutorials/extra-lazy-associations>`
* :doc:`Composite Primary Keys <tutorials/composite-primary-keys>`
* :doc:`Ordered associations <tutorials/ordered-associations>`
* :doc:`Pagination <tutorials/pagination>`
* :doc:`Override Field/Association Mappings In Subclasses <tutorials/override-field-association-mappings-in-subclasses>`
* :doc:`Embeddables <tutorials/embeddables>`
Changelogs
----------
* `Upgrade <https://github.com/doctrine/orm/blob/HEAD/UPGRADE.md>`_
Cookbook
--------
* **Patterns**:
:doc:`Aggregate Fields <cookbook/aggregate-fields>` \|
:doc:`Decorator Pattern <cookbook/decorator-pattern>` \|
:doc:`Strategy Pattern <cookbook/strategy-cookbook-introduction>`
* **DQL Extension Points**:
:doc:`DQL Custom Walkers <cookbook/dql-custom-walkers>` \|
:doc:`DQL User-Defined-Functions <cookbook/dql-user-defined-functions>`
* **Implementation**:
:doc:`Array Access <cookbook/implementing-arrayaccess-for-domain-objects>` \|
:doc:`Working with DateTime <cookbook/working-with-datetime>` \|
:doc:`Validation <cookbook/validation-of-entities>` \|
:doc:`Entities in the Session <cookbook/entities-in-session>` \|
:doc:`Keeping your Modules independent <cookbook/resolve-target-entity-listener>`
* **Hidden Gems**
:doc:`Prefixing Table Name <cookbook/sql-table-prefixes>`
* **Custom Datatypes**
:doc:`MySQL Enums <cookbook/mysql-enums>`
:doc:`Advanced Field Value Conversion <cookbook/advanced-field-value-conversion-using-custom-mapping-types>`

113
docs/en/make.bat Normal file
View File

@@ -0,0 +1,113 @@
@ECHO OFF
REM Command file for Sphinx documentation
set SPHINXBUILD=sphinx-build
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. changes to make an overview over all changed/added/deprecated items
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Doctrine2ORM.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Doctrine2ORM.ghc
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
:end

View File

@@ -0,0 +1,477 @@
Advanced Configuration
======================
The configuration of the EntityManager requires a
``Doctrine\ORM\Configuration`` instance as well as some database
connection parameters. This example shows all the potential
steps of configuration.
.. code-block:: php
<?php
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
use Doctrine\ORM\ORMSetup;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
// ...
if ($applicationMode == "development") {
$queryCache = new ArrayAdapter();
$metadataCache = new ArrayAdapter();
} else {
$queryCache = new PhpFilesAdapter('doctrine_queries');
$metadataCache = new PhpFilesAdapter('doctrine_metadata');
}
$config = new Configuration;
$config->setMetadataCache($metadataCache);
$driverImpl = new AttributeDriver(['/path/to/lib/MyProject/Entities'], true);
$config->setMetadataDriverImpl($driverImpl);
$config->setQueryCache($queryCache);
$config->setProxyDir('/path/to/myproject/lib/MyProject/Proxies');
$config->setProxyNamespace('MyProject\Proxies');
if ($applicationMode == "development") {
$config->setAutoGenerateProxyClasses(true);
} else {
$config->setAutoGenerateProxyClasses(false);
}
$connection = DriverManager::getConnection([
'driver' => 'pdo_sqlite',
'path' => 'database.sqlite',
], $config);
$em = new EntityManager($connection, $config);
Doctrine and Caching
--------------------
Doctrine is optimized for working with caches. The main parts in Doctrine
that are optimized for caching are the metadata mapping information with
the metadata cache and the DQL to SQL conversions with the query cache.
These 2 caches require only an absolute minimum of memory yet they heavily
improve the runtime performance of Doctrine.
Doctrine does not bundle its own cache implementation anymore. Instead,
the PSR-6 standard interfaces are used to access the cache. In the examples
in this documentation, Symfony Cache is used as a reference implementation.
.. note::
Do not use Doctrine without a metadata and query cache!
Configuration Options
---------------------
The following sections describe all the configuration options
available on a ``Doctrine\ORM\Configuration`` instance.
Proxy Directory (***REQUIRED***)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: php
<?php
$config->setProxyDir($dir);
$config->getProxyDir();
Gets or sets the directory where Doctrine generates any proxy
classes. For a detailed explanation on proxy classes and how they
are used in Doctrine, refer to the "Proxy Objects" section further
down.
Proxy Namespace (***REQUIRED***)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: php
<?php
$config->setProxyNamespace($namespace);
$config->getProxyNamespace();
Gets or sets the namespace to use for generated proxy classes. For
a detailed explanation on proxy classes and how they are used in
Doctrine, refer to the "Proxy Objects" section further down.
Metadata Driver (***REQUIRED***)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: php
<?php
$config->setMetadataDriverImpl($driver);
$config->getMetadataDriverImpl();
Gets or sets the metadata driver implementation that is used by
Doctrine to acquire the object-relational metadata for your
classes.
There are currently 3 available implementations:
- ``Doctrine\ORM\Mapping\Driver\AttributeDriver``
- ``Doctrine\ORM\Mapping\Driver\XmlDriver``
- ``Doctrine\ORM\Mapping\Driver\DriverChain``
Throughout the most part of this manual the AttributeDriver is
used in the examples. For information on the usage of the
XmlDriver please refer to the dedicated chapter ``XML Mapping``.
The attribute driver can be injected in the ``Doctrine\ORM\Configuration``:
.. code-block:: php
<?php
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
$driverImpl = new AttributeDriver(['/path/to/lib/MyProject/Entities'], true);
$config->setMetadataDriverImpl($driverImpl);
The path information to the entities is required for the attribute
driver, because otherwise mass-operations on all entities through
the console could not work correctly. All of metadata drivers
accept either a single directory as a string or an array of
directories. With this feature a single driver can support multiple
directories of Entities.
Metadata Cache (***RECOMMENDED***)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: php
<?php
$config->setMetadataCache($cache);
$config->getMetadataCache();
Gets or sets the cache adapter to use for caching metadata
information, that is, all the information you supply via attributes,
xml, so that they do not need to be parsed and loaded from scratch on
every single request which is a waste of resources. The cache
implementation must implement the PSR-6
``Psr\Cache\CacheItemPoolInterface`` interface.
Usage of a metadata cache is highly recommended.
For development you should use an array cache like
``Symfony\Component\Cache\Adapter\ArrayAdapter``
which only caches data on a per-request basis.
Query Cache (***RECOMMENDED***)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: php
<?php
$config->setQueryCache($cache);
$config->getQueryCache();
Gets or sets the cache implementation to use for caching DQL
queries, that is, the result of a DQL parsing process that includes
the final SQL as well as meta information about how to process the
SQL result set of a query. Note that the query cache does not
affect query results. You do not get stale data. This is a pure
optimization cache without any negative side-effects (except some
minimal memory usage in your cache).
Usage of a query cache is highly recommended.
For development you should use an array cache like
``Symfony\Component\Cache\Adapter\ArrayAdapter``
which only caches data on a per-request basis.
SQL Logger (***Optional***)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: php
<?php
$config->setSQLLogger($logger);
$config->getSQLLogger();
Gets or sets the logger to use for logging all SQL statements
executed by Doctrine. The logger class must implement the
deprecated ``Doctrine\DBAL\Logging\SQLLogger`` interface.
Auto-generating Proxy Classes (***OPTIONAL***)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Proxy classes can either be generated manually through the Doctrine
Console or automatically at runtime by Doctrine. The configuration
option that controls this behavior is:
.. code-block:: php
<?php
$config->setAutoGenerateProxyClasses($mode);
Possible values for ``$mode`` are:
- ``Doctrine\ORM\Proxy\ProxyFactory::AUTOGENERATE_NEVER``
Never autogenerate a proxy. You will need to generate the proxies
manually, for this use the Doctrine Console like so:
.. code-block:: php
$ ./doctrine orm:generate-proxies
When you do this in a development environment,
be aware that you may get class/file not found errors if certain proxies
are not yet generated. You may also get failing lazy-loads if new
methods were added to the entity class that are not yet in the proxy class.
In such a case, simply use the Doctrine Console to (re)generate the
proxy classes.
- ``Doctrine\ORM\Proxy\ProxyFactory::AUTOGENERATE_ALWAYS``
Always generates a new proxy in every request and writes it to disk.
- ``Doctrine\ORM\Proxy\ProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS``
Generate the proxy class when the proxy file does not exist.
This strategy causes a file exists call whenever any proxy is
used the first time in a request.
- ``Doctrine\ORM\Proxy\ProxyFactory::AUTOGENERATE_EVAL``
Generate the proxy classes and evaluate them on the fly via eval(),
avoiding writing the proxies to disk.
This strategy is only sane for development.
In a production environment, it is highly recommended to use
AUTOGENERATE_NEVER to allow for optimal performances. The other
options are interesting in development environment.
``setAutoGenerateProxyClasses`` can accept a boolean
value. This is still possible, ``FALSE`` being equivalent to
AUTOGENERATE_NEVER and ``TRUE`` to AUTOGENERATE_ALWAYS.
Development vs Production Configuration
---------------------------------------
You should code your Doctrine2 bootstrapping with two different
runtime models in mind. There are some serious benefits of using
APCu or Memcache in production. In development however this will
frequently give you fatal errors, when you change your entities and
the cache still keeps the outdated metadata. That is why we
recommend an array cache for development.
Furthermore you should have the Auto-generating Proxy Classes
option to true in development and to false in production. If this
option is set to ``TRUE`` it can seriously hurt your script
performance if several proxy classes are re-generated during script
execution. Filesystem calls of that magnitude can even slower than
all the database queries Doctrine issues. Additionally writing a
proxy sets an exclusive file lock which can cause serious
performance bottlenecks in systems with regular concurrent
requests.
Connection
----------
The ``$connection`` passed as the first argument to he constructor of
``EntityManager`` has to be an instance of ``Doctrine\DBAL\Connection``.
You can use the factory ``Doctrine\DBAL\DriverManager::getConnection()``
to create such a connection. The DBAL configuration is explained in the
`DBAL section <https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/configuration.html>`_.
Proxy Objects
-------------
A proxy object is an object that is put in place or used instead of
the "real" object. A proxy object can add behavior to the object
being proxied without that object being aware of it. In ORM,
proxy objects are used to realize several features but mainly for
transparent lazy-loading.
Proxy objects with their lazy-loading facilities help to keep the
subset of objects that are already in memory connected to the rest
of the objects. This is an essential property as without it there
would always be fragile partial objects at the outer edges of your
object graph.
Doctrine ORM implements a variant of the proxy pattern where it
generates classes that extend your entity classes and adds
lazy-loading capabilities to them. Doctrine can then give you an
instance of such a proxy class whenever you request an object of
the class being proxied. This happens in two situations:
Reference Proxies
~~~~~~~~~~~~~~~~~
The method ``EntityManager#getReference($entityName, $identifier)``
lets you obtain a reference to an entity for which the identifier
is known, without necessarily loading that entity from the database.
This is useful, for example, as a performance enhancement, when you
want to establish an association to an entity for which you have the
identifier.
Consider the following example:
.. code-block:: php
<?php
// $em instanceof EntityManager, $cart instanceof MyProject\Model\Cart
// $itemId comes from somewhere, probably a request parameter
$item = $em->getReference('MyProject\Model\Item', $itemId);
$cart->addItem($item);
Whether the object being returned from ``EntityManager#getReference()``
is a proxy or a direct instance of the entity class may depend on different
factors, including whether the entity has already been loaded into memory
or entity inheritance being used. But your code does not need to care
and in fact it **should not care**. Proxy objects should be transparent to your
code.
When using the ``EntityManager#getReference()`` method, you need to be aware
of a few peculiarities.
At the best case, the ORM can avoid querying the database at all. But, that
also means that this method will not throw an exception when an invalid value
for the ``$identifier`` parameter is passed. ``$identifier`` values are
not checked and there is no guarantee that the requested entity instance even
exists the method will still return a proxy object.
Its only when the proxy has to be fully initialized or associations cannot
be written to the database that invalid ``$identifier`` values may lead to
exceptions.
The ``EntityManager#getReference()`` is mostly useful when you only
need a reference to some entity to make an association, like in the example
above. In that case, it can save you from loading data from the database
that you don't need. But remember as soon as you read any property values
besides those making up the ID, a database request will be made to initialize
all fields.
Association proxies
~~~~~~~~~~~~~~~~~~~
The second most important situation where Doctrine uses proxy
objects is when querying for objects. Whenever you query for an
object that has a single-valued association to another object that
is configured LAZY, without joining that association in the same
query, Doctrine puts proxy objects in place where normally the
associated object would be. Just like other proxies it will
transparently initialize itself on first access.
.. note::
Joining an association in a DQL or native query
essentially means eager loading of that association in that query.
This will override the 'fetch' option specified in the mapping for
that association, but only for that query.
Generating Proxy classes
~~~~~~~~~~~~~~~~~~~~~~~~
In a production environment, it is highly recommended to use
``AUTOGENERATE_NEVER`` to allow for optimal performances.
However you will be required to generate the proxies manually
using the Doctrine Console:
.. code-block:: php
$ ./doctrine orm:generate-proxies
The other options are interesting in development environment:
- ``AUTOGENERATE_ALWAYS`` will require you to create and configure
a proxy directory. Proxies will be generated and written to file
on each request, so any modification to your code will be acknowledged.
- ``AUTOGENERATE_FILE_NOT_EXISTS`` will not overwrite an existing
proxy file. If your code changes, you will need to regenerate the
proxies manually.
- ``AUTOGENERATE_EVAL`` will regenerate each proxy on each request,
but without writing them to disk.
Autoloading Proxies
-------------------
When you deserialize proxy objects from the session or any other storage
it is necessary to have an autoloading mechanism in place for these classes.
For implementation reasons Proxy class names are not PSR-0 compliant. This
means that you have to register a special autoloader for these classes:
.. code-block:: php
<?php
use Doctrine\ORM\Proxy\Autoloader;
$proxyDir = "/path/to/proxies";
$proxyNamespace = "MyProxies";
Autoloader::register($proxyDir, $proxyNamespace);
If you want to execute additional logic to intercept the proxy file not found
state you can pass a closure as the third argument. It will be called with
the arguments proxydir, namespace and className when the proxy file could not
be found.
Multiple Metadata Sources
-------------------------
When using different components using Doctrine ORM you may end up
with them using two different metadata drivers, for example XML and
PHP. You can use the MappingDriverChain Metadata implementations to
aggregate these drivers based on namespaces:
.. code-block:: php
<?php
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
$chain = new MappingDriverChain();
$chain->addDriver($xmlDriver, 'Doctrine\Tests\Models\Company');
$chain->addDriver($phpDriver, 'Doctrine\Tests\ORM\Mapping');
Based on the namespace of the entity the loading of entities is
delegated to the appropriate driver. The chain semantics come from
the fact that the driver loops through all namespaces and matches
the entity class name against the namespace using a
``strpos() === 0`` call. This means you need to order the drivers
correctly if sub-namespaces use different metadata driver
implementations.
Default Repository (***OPTIONAL***)
-----------------------------------
Specifies the FQCN of a subclass of the EntityRepository.
That will be available for all entities without a custom repository class.
.. code-block:: php
<?php
$config->setDefaultRepositoryClassName($fqcn);
$config->getDefaultRepositoryClassName();
The default value is ``Doctrine\ORM\EntityRepository``.
Any repository class must be a subclass of EntityRepository otherwise you got an ORMException
Ignoring entities (***OPTIONAL***)
-----------------------------------
Specifies the Entity FQCNs to ignore.
SchemaTool will then skip these (e.g. when comparing schemas).
.. code-block:: php
<?php
$config->setSchemaIgnoreClasses([$fqcn]);
$config->getSchemaIgnoreClasses();
Setting up the Console
----------------------
Doctrine uses the Symfony Console component for generating the command
line interface. You can take a look at the
:doc:`tools chapter <../reference/tools>` for inspiration how to setup the cli.

View File

@@ -0,0 +1,207 @@
Architecture
============
This chapter gives an overview of the overall architecture,
terminology and constraints of Doctrine ORM. It is recommended to
read this chapter carefully.
Using an Object-Relational Mapper
---------------------------------
As the term ORM already hints at, Doctrine ORM aims to simplify the
translation between database rows and the PHP object model. The
primary use case for Doctrine are therefore applications that
utilize the Object-Oriented Programming Paradigm. For applications
that do not primarily work with objects Doctrine ORM is not suited very
well.
Requirements
------------
Doctrine ORM requires a minimum of PHP 7.1. For greatly improved
performance it is also recommended that you use APC with PHP.
Doctrine ORM Packages
-------------------
Doctrine ORM is divided into four main packages.
- `Collections <https://www.doctrine-project.org/projects/doctrine-collections/en/stable/index.html>`_
- `Event Manager <https://www.doctrine-project.org/projects/doctrine-event-manager/en/stable/index.html>`_
- `Persistence <https://www.doctrine-project.org/projects/doctrine-persistence/en/stable/index.html>`_
- `DBAL <https://www.doctrine-project.org/projects/doctrine-dbal/en/stable/index.html>`_
- ORM (depends on DBAL+Persistence+Collections)
This manual mainly covers the ORM package, sometimes touching parts
of the underlying DBAL and Persistence packages. The Doctrine code base
is split in to these packages for a few reasons and they are to...
- ...make things more maintainable and decoupled
- ...allow you to use the code in Doctrine Persistence and Collections
without the ORM or DBAL
- ...allow you to use the DBAL without the ORM
Collection, Event Manager and Persistence
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Collection, Event Manager and Persistence packages contain highly
reusable components that have no dependencies beyond the packages
themselves (and PHP, of course). The root namespace of the Persistence
package is ``Doctrine\Persistence``. The root namespace of the
Collection package is ``Doctrine\Common\Collections``, for historical
reasons. The root namespace of the Event Manager package is just
``Doctrine\Common``, also for historical reasons.
The DBAL Package
~~~~~~~~~~~~~~~~
The DBAL package contains an enhanced database abstraction layer on
top of PDO but is not strongly bound to PDO. The purpose of this
layer is to provide a single API that bridges most of the
differences between the different RDBMS vendors. The root namespace
of the DBAL package is ``Doctrine\DBAL``.
The ORM Package
~~~~~~~~~~~~~~~
The ORM package contains the object-relational mapping toolkit that
provides transparent relational persistence for plain PHP objects.
The root namespace of the ORM package is ``Doctrine\ORM``.
Terminology
-----------
.. _terminology_entities:
Entities
~~~~~~~~
An entity is a lightweight, persistent domain object. An entity can
be any regular PHP class observing the following restrictions:
- An entity class must not be final nor read-only but
it may contain final methods or read-only properties.
- Any two entity classes in a class hierarchy that inherit
directly or indirectly from one another must not have a mapped
property with the same name. That is, if B inherits from A then B
must not have a mapped field with the same name as an already
mapped field that is inherited from A.
Entities support inheritance, polymorphic associations, and
polymorphic queries. Both abstract and concrete classes can be
entities. Entities may extend non-entity classes as well as entity
classes, and non-entity classes may extend entity classes.
.. note::
The constructor of an entity is only ever invoked when
*you* construct a new instance with the *new* keyword. Doctrine
never calls entity constructors, thus you are free to use them as
you wish and even have it require arguments of any type.
Mapped Superclasses
~~~~~~~~~~~~~~~~~~~
A mapped superclass is an abstract or concrete class that provides
persistent entity state and mapping information for its subclasses,
but which is not itself an entity.
Mapped superclasses are explained in greater detail in the chapter
on :doc:`inheritance mapping </reference/inheritance-mapping>`.
Transient Classes
~~~~~~~~~~~~~~~~~
The term "transient class" appears in some places in the mapping
drivers as well as the code dealing with metadata handling.
A transient class is a class that is neither an entity nor a mapped
superclass. From the ORM's point of view, these classes can be
completely ignored, and no class metadata is loaded for them at all.
Entity states
~~~~~~~~~~~~~
An entity instance can be characterized as being NEW, MANAGED,
DETACHED or REMOVED.
- A NEW entity instance has no persistent identity, and is not yet
associated with an EntityManager and a UnitOfWork (i.e. those just
created with the "new" operator).
- A MANAGED entity instance is an instance with a persistent
identity that is associated with an EntityManager and whose
persistence is thus managed.
- A DETACHED entity instance is an instance with a persistent
identity that is not (or no longer) associated with an
EntityManager and a UnitOfWork.
- A REMOVED entity instance is an instance with a persistent
identity, associated with an EntityManager, that will be removed
from the database upon transaction commit.
.. _architecture_persistent_fields:
Persistent fields
~~~~~~~~~~~~~~~~~
The persistent state of an entity is represented by instance
variables. An instance variable must be directly accessed only from
within the methods of the entity by the entity instance itself.
Instance variables must not be accessed by clients of the entity.
The state of the entity is available to clients only through the
entitys methods, i.e. accessor methods (getter/setter methods) or
other business methods.
Collection-valued persistent fields and properties must be defined
in terms of the ``Doctrine\Common\Collections\Collection``
interface. The collection implementation type may be used by the
application to initialize fields or properties before the entity is
made persistent. Once the entity becomes managed (or detached),
subsequent access must be through the interface type.
Serializing entities
~~~~~~~~~~~~~~~~~~~~
Serializing entities can be problematic and is not really
recommended, at least not as long as an entity instance still holds
references to proxy objects or is still managed by an EntityManager.
By default, serializing proxy objects does not initialize them. On
unserialization, resulting objects are detached from the entity
manager and cannot be initialiazed anymore. You can implement the
``__serialize()`` method if you want to change that behavior, but
then you need to ensure that you won't generate large serialized
object graphs and take care of circular associations.
The EntityManager
~~~~~~~~~~~~~~~~~
The ``EntityManager`` class is a central access point to the
functionality provided by Doctrine ORM. The ``EntityManager`` API is
used to manage the persistence of your objects and to query for
persistent objects.
Transactional write-behind
~~~~~~~~~~~~~~~~~~~~~~~~~~
An ``EntityManager`` and the underlying ``UnitOfWork`` employ a
strategy called "transactional write-behind" that delays the
execution of SQL statements in order to execute them in the most
efficient way and to execute them at the end of a transaction so
that all write locks are quickly released. You should see Doctrine
as a tool to synchronize your in-memory objects with the database
in well defined units of work. Work with your objects and modify
them as usual and when you're done call ``EntityManager#flush()``
to make your changes persistent.
.. _unit-of-work:
The Unit of Work
~~~~~~~~~~~~~~~~
Internally an ``EntityManager`` uses a ``UnitOfWork``, which is a
typical implementation of the
`Unit of Work pattern <https://martinfowler.com/eaaCatalog/unitOfWork.html>`_,
to keep track of all the things that need to be done the next time
``flush`` is invoked. You usually do not directly interact with a
``UnitOfWork`` but with the ``EntityManager`` instead.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,496 @@
Basic Mapping
=============
This guide explains the basic mapping of entities and properties.
After working through this guide you should know:
- How to create PHP objects that can be saved to the database with Doctrine;
- How to configure the mapping between columns on tables and properties on
entities;
- What Doctrine mapping types are;
- Defining primary keys and how identifiers are generated by Doctrine;
- How quoting of reserved symbols works in Doctrine.
Mapping of associations will be covered in the next chapter on
:doc:`Association Mapping <association-mapping>`.
Creating Classes for the Database
---------------------------------
Every PHP object that you want to save in the database using Doctrine
is called an *Entity*. The term "Entity" describes objects
that have an identity over many independent requests. This identity is
usually achieved by assigning a unique identifier to an entity.
In this tutorial the following ``Message`` PHP class will serve as the
example Entity:
.. code-block:: php
<?php
class Message
{
private $id;
private $text;
private $postedAt;
}
Because Doctrine is a generic library, it only knows about your
entities because you will describe their existence and structure using
mapping metadata, which is configuration that tells Doctrine how your
entity should be stored in the database. The documentation will often
speak of "mapping something", which means writing the mapping metadata
that describes your entity.
Doctrine provides several different ways to specify object-relational
mapping metadata:
- :doc:`Attributes <attributes-reference>`
- :doc:`XML <xml-mapping>`
- :doc:`PHP code <php-mapping>`
This manual will usually show mapping metadata via attributes, though
many examples also show the equivalent configuration in XML.
.. note::
All metadata drivers perform equally. Once the metadata of a class has been
read from the source (attributes, XML, etc.) it is stored in an instance
of the ``Doctrine\ORM\Mapping\ClassMetadata`` class which are
stored in the metadata cache. If you're not using a metadata cache (not
recommended!) then the XML driver is the fastest.
Marking our ``Message`` class as an entity for Doctrine is straightforward:
.. configuration-block::
.. code-block:: attribute
<?php
use Doctrine\ORM\Mapping\Entity;
#[Entity]
class Message
{
// ...
}
.. code-block:: xml
<doctrine-mapping>
<entity name="Message">
<!-- ... -->
</entity>
</doctrine-mapping>
With no additional information, Doctrine expects the entity to be saved
into a table with the same name as the class in our case ``Message``.
You can change this by configuring information about the table:
.. configuration-block::
.. code-block:: attribute
<?php
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
#[Entity]
#[Table(name: 'message')]
class Message
{
// ...
}
.. code-block:: xml
<doctrine-mapping>
<entity name="Message" table="message">
<!-- ... -->
</entity>
</doctrine-mapping>
Now the class ``Message`` will be saved and fetched from the table ``message``.
Property Mapping
----------------
The next step is mapping its properties to columns in the table.
To configure a property use the ``Column`` attribute. The ``type``
argument specifies the :ref:`Doctrine Mapping Type
<reference-mapping-types>` to use for the field. If the type is not
specified, ``string`` is used as the default.
.. configuration-block::
.. code-block:: attribute
<?php
use Doctrine\ORM\Mapping\Column;
use Doctrine\DBAL\Types\Types;
#[Entity]
class Message
{
#[Column(type: Types::INTEGER)]
private $id;
#[Column(length: 140)]
private $text;
#[Column(name: 'posted_at', type: Types::DATETIME)]
private $postedAt;
}
.. code-block:: xml
<doctrine-mapping>
<entity name="Message">
<field name="id" type="integer" />
<field name="text" length="140" />
<field name="postedAt" column="posted_at" type="datetime" />
</entity>
</doctrine-mapping>
When we don't explicitly specify a column name via the ``name`` option, Doctrine
assumes the field name is also the column name. So in this example:
* the ``id`` property will map to the column ``id`` using the type ``integer``;
* the ``text`` property will map to the column ``text`` with the default mapping type ``string``;
* the ``postedAt`` property will map to the ``posted_at`` column with the ``datetime`` type.
Here is a complete list of ``Column``s attributes (all optional):
- ``type`` (default: 'string'): The mapping type to use for the column.
- ``name`` (default: name of property): The name of the column in the database.
- ``length`` (default: 255): The length of the column in the database.
Applies only if a string-valued column is used.
- ``unique`` (default: ``false``): Whether the column is a unique key.
- ``nullable`` (default: ``false``): Whether the column is nullable.
- ``insertable`` (default: ``true``): Whether the column should be inserted.
- ``updatable`` (default: ``true``): Whether the column should be updated.
- ``enumType`` (requires PHP 8.1 and ``doctrine/orm`` 2.11): The PHP enum class name to convert the database value into.
- ``precision`` (default: 0): The precision for a decimal (exact numeric) column
(applies only for decimal column),
which is the maximum number of digits that are stored for the values.
- ``scale`` (default: 0): The scale for a decimal (exact
numeric) column (applies only for decimal column), which represents
the number of digits to the right of the decimal point and must
not be greater than ``precision``.
- ``columnDefinition``: Allows to define a custom
DDL snippet that is used to create the column. Warning: This normally
confuses the :doc:`SchemaTool <tools>` to always detect the column as changed.
- ``options``: Key-value pairs of options that get passed
to the underlying database platform when generating DDL statements.
.. _reference-php-mapping-types:
PHP Types Mapping
_________________
.. versionadded:: 2.9
The column types can be inferred automatically from PHP's property types.
However, when the property type is nullable this has no effect on the ``nullable`` Column attribute.
These are the "automatic" mapping rules:
+-----------------------+-------------------------------+
| PHP property type | Doctrine column type |
+=======================+===============================+
| ``DateInterval`` | ``Types::DATEINTERVAL`` |
+-----------------------+-------------------------------+
| ``DateTime`` | ``Types::DATETIME_MUTABLE`` |
+-----------------------+-------------------------------+
| ``DateTimeImmutable`` | ``Types::DATETIME_IMMUTABLE`` |
+-----------------------+-------------------------------+
| ``array`` | ``Types::JSON`` |
+-----------------------+-------------------------------+
| ``bool`` | ``Types::BOOLEAN`` |
+-----------------------+-------------------------------+
| ``float`` | ``Types::FLOAT`` |
+-----------------------+-------------------------------+
| ``int`` | ``Types::INTEGER`` |
+-----------------------+-------------------------------+
| Any other type | ``Types::STRING`` |
+-----------------------+-------------------------------+
As of version 2.11 Doctrine can also automatically map typed properties using a
PHP 8.1 enum to set the right ``type`` and ``enumType``.
.. versionadded:: 2.14
Since version 2.14 you can specify custom typed field mapping between PHP type and DBAL type using ``Configuration``
and a custom ``Doctrine\ORM\Mapping\TypedFieldMapper`` implementation.
:doc:`Read more about TypedFieldMapper <typedfieldmapper>`.
.. _reference-mapping-types:
Doctrine Mapping Types
----------------------
The ``type`` option used in the ``@Column`` accepts any of the existing
Doctrine types or even your own custom types. A Doctrine type defines
the conversion between PHP and SQL types, independent from the database vendor
you are using. All Mapping Types that ship with Doctrine are fully portable
between the supported database systems.
As an example, the Doctrine Mapping Type ``string`` defines the
mapping from a PHP string to a SQL VARCHAR (or VARCHAR2 etc.
depending on the RDBMS brand). Here is a quick overview of the
built-in mapping types:
- ``string``: Type that maps a SQL VARCHAR to a PHP string.
- ``integer``: Type that maps a SQL INT to a PHP integer.
- ``smallint``: Type that maps a database SMALLINT to a PHP
integer.
- ``bigint``: Type that maps a database BIGINT to a PHP string.
- ``boolean``: Type that maps a SQL boolean or equivalent (TINYINT) to a PHP boolean.
- ``decimal``: Type that maps a SQL DECIMAL to a PHP string.
- ``date``: Type that maps a SQL DATETIME to a PHP DateTime
object.
- ``time``: Type that maps a SQL TIME to a PHP DateTime object.
- ``datetime``: Type that maps a SQL DATETIME/TIMESTAMP to a PHP
DateTime object.
- ``datetimetz``: Type that maps a SQL DATETIME/TIMESTAMP to a PHP
DateTime object with timezone.
- ``text``: Type that maps a SQL CLOB to a PHP string.
- ``object``: Type that maps a SQL CLOB to a PHP object using
``serialize()`` and ``unserialize()``
- ``array``: Type that maps a SQL CLOB to a PHP array using
``serialize()`` and ``unserialize()``
- ``simple_array``: Type that maps a SQL CLOB to a PHP array using
``implode()`` and ``explode()``, with a comma as delimiter. *IMPORTANT*
Only use this type if you are sure that your values cannot contain a ",".
- ``json_array``: Type that maps a SQL CLOB to a PHP array using
``json_encode()`` and ``json_decode()``
- ``float``: Type that maps a SQL Float (Double Precision) to a
PHP double. *IMPORTANT*: Works only with locale settings that use
decimal points as separator.
- ``guid``: Type that maps a database GUID/UUID to a PHP string. Defaults to
varchar but uses a specific type if the platform supports it.
- ``blob``: Type that maps a SQL BLOB to a PHP resource stream
A cookbook article shows how to define :doc:`your own custom mapping types
<../cookbook/custom-mapping-types>`.
.. note::
DateTime and Object types are compared by reference, not by value. Doctrine
updates this values if the reference changes and therefore behaves as if
these objects are immutable value objects.
.. warning::
All Date types assume that you are exclusively using the default timezone
set by `date_default_timezone_set() <https://php.net/manual/en/function.date-default-timezone-set.php>`_
or by the php.ini configuration ``date.timezone``. Working with
different timezones will cause troubles and unexpected behavior.
If you need specific timezone handling you have to handle this
in your domain, converting all the values back and forth from UTC.
There is also a :doc:`cookbook entry <../cookbook/working-with-datetime>`
on working with datetimes that gives hints for implementing
multi timezone applications.
Identifiers / Primary Keys
--------------------------
Every entity class must have an identifier/primary key. You can select
the field that serves as the identifier with the ``#[Id]`` attribute.
.. configuration-block::
.. code-block:: attribute
<?php
class Message
{
#[Id]
#[Column(type: 'integer')]
#[GeneratedValue]
private int|null $id = null;
// ...
}
.. code-block:: xml
<doctrine-mapping>
<entity name="Message">
<id name="id" type="integer">
<generator strategy="AUTO" />
</id>
<!-- -->
</entity>
</doctrine-mapping>
In most cases using the automatic generator strategy (``#[GeneratedValue]``) is
what you want, but for backwards-compatibility reasons it might not. It
defaults to the identifier generation mechanism your current database
vendor preferred at the time that strategy was introduced:
``AUTO_INCREMENT`` with MySQL, sequences with PostgreSQL and Oracle and
so on.
If you are using `doctrine/dbal` 4, we now recommend using ``IDENTITY``
for PostgreSQL, and ``AUTO`` resolves to it because of that.
You can stick with ``SEQUENCE`` while still using the ``AUTO``
strategy, by configuring what it defaults to.
.. code-block:: php
<?php
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\ORM\Configuration;
$config = new Configuration();
$config->setIdentityGenerationPreferences([
PostgreSQLPlatform::class => ClassMetadata::GENERATOR_TYPE_SEQUENCE,
]);
.. _identifier-generation-strategies:
Identifier Generation Strategies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The previous example showed how to use the default identifier
generation strategy without knowing the underlying database with
the AUTO-detection strategy. It is also possible to specify the
identifier generation strategy more explicitly, which allows you to
make use of some additional features.
Here is the list of possible generation strategies:
- ``AUTO`` (default): Tells Doctrine to pick the strategy that is
preferred by the used database platform. The preferred strategies
are ``IDENTITY`` for MySQL, SQLite, MsSQL and SQL Anywhere and, for
historical reasons, ``SEQUENCE`` for Oracle and PostgreSQL. This
strategy provides full portability.
- ``IDENTITY``: Tells Doctrine to use special identity columns in
the database that generate a value on insertion of a row. This
strategy does currently not provide full portability and is
supported by the following platforms: MySQL/SQLite/SQL Anywhere
(``AUTO_INCREMENT``), MSSQL (``IDENTITY``) and PostgreSQL (``SERIAL``).
- ``SEQUENCE``: Tells Doctrine to use a database sequence for ID
generation. This strategy does currently not provide full
portability. Sequences are supported by Oracle, PostgreSql and
SQL Anywhere.
- ``NONE``: Tells Doctrine that the identifiers are assigned (and
thus generated) by your code. The assignment must take place before
a new entity is passed to ``EntityManager#persist``. NONE is the
same as leaving off the ``#[GeneratedValue]`` entirely.
- ``CUSTOM``: With this option, you can use the ``#[CustomIdGenerator]`` attribute.
It will allow you to pass a :ref:`class of your own to generate the identifiers. <attrref_customidgenerator>`
Sequence Generator
^^^^^^^^^^^^^^^^^^
The Sequence Generator can currently be used in conjunction with
Oracle or Postgres and allows some additional configuration options
besides specifying the sequence's name:
.. configuration-block::
.. code-block:: attribute
<?php
class Message
{
#[Id]
#[GeneratedValue(strategy: 'SEQUENCE')]
#[SequenceGenerator(sequenceName: 'message_seq', initialValue: 1, allocationSize: 100)]
protected int|null $id = null;
// ...
}
.. code-block:: xml
<doctrine-mapping>
<entity name="Message">
<id name="id" type="integer">
<generator strategy="SEQUENCE" />
<sequence-generator sequence-name="message_seq" allocation-size="100" initial-value="1" />
</id>
</entity>
</doctrine-mapping>
The initial value specifies at which value the sequence should
start.
The allocationSize is a powerful feature to optimize INSERT
performance of Doctrine. The allocationSize specifies by how much
values the sequence is incremented whenever the next value is
retrieved. If this is larger than 1 (one) Doctrine can generate
identifier values for the allocationSizes amount of entities. In
the above example with ``allocationSize=100`` Doctrine ORM would only
need to access the sequence once to generate the identifiers for
100 new entities.
.. caution::
The allocationSize is detected by SchemaTool and
transformed into an "INCREMENT BY " clause in the CREATE SEQUENCE
statement. For a database schema created manually (and not
SchemaTool) you have to make sure that the allocationSize
configuration option is never larger than the actual sequences
INCREMENT BY value, otherwise you may get duplicate keys.
.. note::
It is possible to use strategy="AUTO" and at the same time
specifying a @SequenceGenerator. In such a case, your custom
sequence settings are used in the case where the preferred strategy
of the underlying platform is SEQUENCE, such as for Oracle and
PostgreSQL.
Composite Keys
~~~~~~~~~~~~~~
With Doctrine ORM you can use composite primary keys, using ``#[Id]`` on
more than one column. Some restrictions exist opposed to using a single
identifier in this case: The use of the ``#[GeneratedValue]`` attribute
is not supported, which means you can only use composite keys if you
generate the primary key values yourself before calling
``EntityManager#persist()`` on the entity.
More details on composite primary keys are discussed in a :doc:`dedicated tutorial
<../tutorials/composite-primary-keys>`.
Quoting Reserved Words
----------------------
Sometimes it is necessary to quote a column or table name because of reserved
word conflicts. Doctrine does not quote identifiers automatically, because it
leads to more problems than it would solve. Quoting tables and column names
needs to be done explicitly using ticks in the definition.
.. code-block:: php
<?php
#[Column(name: '`number`', type: 'integer')]
private $number;
Doctrine will then quote this column name in all SQL statements
according to the used database platform.
.. warning::
Identifier Quoting does not work for join column names or discriminator
column names unless you are using a custom ``QuoteStrategy``.
.. _reference-basic-mapping-custom-mapping-types:
For more control over column quoting the ``Doctrine\ORM\Mapping\QuoteStrategy`` interface
was introduced in ORM. It is invoked for every column, table, alias and other
SQL names. You can implement the QuoteStrategy and set it by calling
``Doctrine\ORM\Configuration#setQuoteStrategy()``.
The ANSI Quote Strategy was added, which assumes quoting is not necessary for any SQL name.
You can use it with the following code:
.. code-block:: php
<?php
use Doctrine\ORM\Mapping\AnsiQuoteStrategy;
$configuration->setQuoteStrategy(new AnsiQuoteStrategy());

View File

@@ -0,0 +1,196 @@
Batch Processing
================
This chapter shows you how to accomplish bulk inserts, updates and
deletes with Doctrine in an efficient way. The main problem with
bulk operations is usually not to run out of memory and this is
especially what the strategies presented here provide help with.
.. warning::
An ORM tool is not primarily well-suited for mass
inserts, updates or deletions. Every RDBMS has its own, most
effective way of dealing with such operations and if the options
outlined below are not sufficient for your purposes we recommend
you use the tools for your particular RDBMS for these bulk
operations.
.. note::
Having an SQL logger enabled when processing batches can have a
serious impact on performance and resource usage.
To avoid that, you should use a PSR logger implementation that can be
disabled at runtime.
For example, with Monolog, you can use ``Logger::pushHandler()``
to push a ``NullHandler`` to the logger instance, and then pop it
when you need to enable logging again.
With DBAL 2, you can disable the SQL logger like below:
.. code-block:: php
<?php
$em->getConnection()->getConfiguration()->setSQLLogger(null);
Bulk Inserts
------------
Bulk inserts in Doctrine are best performed in batches, taking
advantage of the transactional write-behind behavior of an
``EntityManager``. The following code shows an example for
inserting 10000 objects with a batch size of 20. You may need to
experiment with the batch size to find the size that works best for
you. Larger batch sizes mean more prepared statement reuse
internally but also mean more work during ``flush``.
.. code-block:: php
<?php
$batchSize = 20;
for ($i = 1; $i <= 10000; ++$i) {
$user = new CmsUser;
$user->setStatus('user');
$user->setUsername('user' . $i);
$user->setName('Mr.Smith-' . $i);
$em->persist($user);
if (($i % $batchSize) === 0) {
$em->flush();
$em->clear(); // Detaches all objects from Doctrine!
}
}
$em->flush(); // Persist objects that did not make up an entire batch
$em->clear();
Bulk Updates
------------
There are 2 possibilities for bulk updates with Doctrine.
DQL UPDATE
~~~~~~~~~~
The by far most efficient way for bulk updates is to use a DQL
UPDATE query. Example:
.. code-block:: php
<?php
$q = $em->createQuery('update MyProject\Model\Manager m set m.salary = m.salary * 0.9');
$numUpdated = $q->execute();
Iterating results
~~~~~~~~~~~~~~~~~
An alternative solution for bulk updates is to use the
``Query#toIterable()`` facility to iterate over the query results step
by step instead of loading the whole result into memory at once.
The following example shows how to do this, combining the iteration
with the batching strategy that was already used for bulk inserts:
.. code-block:: php
<?php
$batchSize = 20;
$i = 0;
$q = $em->createQuery('select u from MyProject\Model\User u');
foreach ($q->toIterable() as $user) {
$user->increaseCredit();
$user->calculateNewBonuses();
++$i;
if (($i % $batchSize) === 0) {
$em->flush(); // Executes all updates.
$em->clear(); // Detaches all objects from Doctrine!
}
}
$em->flush();
.. note::
Iterating results is not possible with queries that
fetch-join a collection-valued association. The nature of such SQL
result sets is not suitable for incremental hydration.
.. note::
Results may be fully buffered by the database client/ connection allocating
additional memory not visible to the PHP process. For large sets this
may easily kill the process for no apparent reason.
Bulk Deletes
------------
There are two possibilities for bulk deletes with Doctrine. You can
either issue a single DQL DELETE query or you can iterate over
results removing them one at a time.
DQL DELETE
~~~~~~~~~~
The by far most efficient way for bulk deletes is to use a DQL
DELETE query.
Example:
.. code-block:: php
<?php
$q = $em->createQuery('delete from MyProject\Model\Manager m where m.salary > 100000');
$numDeleted = $q->execute();
Iterating results
~~~~~~~~~~~~~~~~~
An alternative solution for bulk deletes is to use the
``Query#toIterable()`` facility to iterate over the query results step
by step instead of loading the whole result into memory at once.
The following example shows how to do this:
.. code-block:: php
<?php
$batchSize = 20;
$i = 0;
$q = $em->createQuery('select u from MyProject\Model\User u');
foreach($q->toIterable() as $row) {
$em->remove($row);
++$i;
if (($i % $batchSize) === 0) {
$em->flush(); // Executes all deletions.
$em->clear(); // Detaches all objects from Doctrine!
}
}
$em->flush();
.. note::
Iterating results is not possible with queries that
fetch-join a collection-valued association. The nature of such SQL
result sets is not suitable for incremental hydration.
Iterating Large Results for Data-Processing
-------------------------------------------
You can use the ``toIterable()`` method just to iterate over a large
result and no UPDATE or DELETE intention. ``$query->toIterable()`` returns ``iterable``
so you can process a large result without memory
problems using the following approach:
.. code-block:: php
<?php
$q = $this->_em->createQuery('select u from MyProject\Model\User u');
foreach ($q->toIterable() as $row) {
// do stuff with the data in the row
// detach from Doctrine, so that it can be Garbage-Collected immediately
$this->_em->detach($row[0]);
}
.. note::
Iterating results is not possible with queries that
fetch-join a collection-valued association. The nature of such SQL
result sets is not suitable for incremental hydration.

View File

@@ -0,0 +1,113 @@
Best Practices
==============
The best practices mentioned here that affect database
design generally refer to best practices when working with Doctrine
and do not necessarily reflect best practices for database design
in general.
Constrain relationships as much as possible
-------------------------------------------
It is important to constrain relationships as much as possible.
This means:
- Impose a traversal direction (avoid bidirectional associations
if possible)
- Eliminate nonessential associations
This has several benefits:
- Reduced coupling in your domain model
- Simpler code in your domain model (no need to maintain
bidirectionality properly)
- Less work for Doctrine
Avoid composite keys
--------------------
Even though Doctrine fully supports composite keys it is best not
to use them if possible. Composite keys require additional work by
Doctrine and thus have a higher probability of errors.
Use events judiciously
----------------------
The event system of Doctrine is great and fast. Even though making
heavy use of events, especially lifecycle events, can have a
negative impact on the performance of your application. Thus you
should use events judiciously.
Use cascades judiciously
------------------------
Automatic cascades of the persist/remove/etc. operations are
very handy but should be used wisely. Do NOT simply add all
cascades to all associations. Think about which cascades actually
do make sense for you for a particular association, given the
scenarios it is most likely used in.
Don't use special characters
----------------------------
Avoid using any non-ASCII characters in class, field, table or
column names. Doctrine itself is not unicode-safe in many places
and will not be until PHP itself is fully unicode-aware.
Don't use identifier quoting
----------------------------
Identifier quoting is a workaround for using reserved words that
often causes problems in edge cases. Do not use identifier quoting
and avoid using reserved words as table or column names.
Initialize collections in the constructor
-----------------------------------------
It is recommended best practice to initialize any business
collections in entities in the constructor. Example:
.. code-block:: php
<?php
namespace MyProject\Model;
use Doctrine\Common\Collections\ArrayCollection;
class User {
/** @var Collection<int, Address> */
private Collection $addresses;
/** @var Collection<int, Article> */
private Collection $articles;
public function __construct() {
$this->addresses = new ArrayCollection;
$this->articles = new ArrayCollection;
}
}
Don't map foreign keys to fields in an entity
---------------------------------------------
Foreign keys have no meaning whatsoever in an object model. Foreign
keys are how a relational database establishes relationships. Your
object model establishes relationships through object references.
Thus mapping foreign keys to object fields heavily leaks details of
the relational model into the object model, something you really
should not do.
Use explicit transaction demarcation
------------------------------------
While Doctrine will automatically wrap all DML operations in a
transaction on flush(), it is considered best practice to
explicitly set the transaction boundaries yourself. Otherwise every
single query is wrapped in a small transaction (Yes, SELECT
queries, too) since you can not talk to your database outside of a
transaction. While such short transactions for read-only (SELECT)
queries generally don't have any noticeable performance impact, it
is still preferable to use fewer, well-defined transactions that
are established through explicit transaction boundaries.

View File

@@ -0,0 +1,202 @@
Caching
=======
The Doctrine ORM package can leverage cache adapters implementing the PSR-6
standard to allow you to improve the performance of various aspects of
Doctrine by simply making some additional configurations and method calls.
.. _types-of-caches:
Types of Caches
---------------
Query Cache
~~~~~~~~~~~
It is highly recommended that in a production environment you cache
the transformation of a DQL query to its SQL counterpart. It
doesn't make sense to do this parsing multiple times as it doesn't
change unless you alter the DQL query.
This can be done by configuring the query cache implementation to
use on your ORM configuration.
.. code-block:: php
<?php
$cache = new \Symfony\Component\Cache\Adapter\PhpFilesAdapter('doctrine_queries');
$config = new \Doctrine\ORM\Configuration();
$config->setQueryCache($cache);
Result Cache
~~~~~~~~~~~~
The result cache can be used to cache the results of your queries
so that we don't have to query the database again after the first time.
You just need to configure the result cache implementation.
.. code-block:: php
<?php
$cache = new \Symfony\Component\Cache\Adapter\PhpFilesAdapter(
'doctrine_results',
0,
'/path/to/writable/directory'
);
$config = new \Doctrine\ORM\Configuration();
$config->setResultCache($cache);
Now when you're executing DQL queries you can configure them to use
the result cache.
.. code-block:: php
<?php
$query = $em->createQuery('select u from \Entities\User u');
$query->enableResultCache();
You can also configure an individual query to use a different
result cache driver.
.. code-block:: php
<?php
$cache = new \Symfony\Component\Cache\Adapter\PhpFilesAdapter(
'doctrine_results',
0,
'/path/to/writable/directory'
);
$query->setResultCache($cache);
.. note::
Setting the result cache driver on the query will
automatically enable the result cache for the query. If you want to
disable it use ``disableResultCache()``.
::
<?php
$query->disableResultCache();
If you want to set the time the cache has to live you can use the
``setResultCacheLifetime()`` method.
.. code-block:: php
<?php
$query->setResultCacheLifetime(3600);
The ID used to store the result set cache is a hash which is
automatically generated for you if you don't set a custom ID
yourself with the ``setResultCacheId()`` method.
.. code-block:: php
<?php
$query->setResultCacheId('my_custom_id');
You can also set the lifetime and cache ID by passing the values as
the first and second argument to ``enableResultCache()``.
.. code-block:: php
<?php
$query->enableResultCache(3600, 'my_custom_id');
Metadata Cache
~~~~~~~~~~~~~~
Your class metadata can be parsed from a few different sources like
XML, Attributes, etc. Instead of parsing this
information on each request we should cache it using one of the cache
drivers.
Just like the query and result cache we need to configure it
first.
.. code-block:: php
<?php
$cache = \Symfony\Component\Cache\Adapter\PhpFilesAdapter(
'doctrine_metadata',
0,
'/path/to/writable/directory'
);
$config = new \Doctrine\ORM\Configuration();
$config->setMetadataCache($cache);
Now the metadata information will only be parsed once and stored in
the cache driver.
Clearing the Cache
------------------
We've already shown you how you can use the API of the
cache drivers to manually delete cache entries. For your
convenience we offer command line tasks to help you with
clearing the query, result and metadata cache.
From the Doctrine command line you can run the following commands:
To clear the query cache use the ``orm:clear-cache:query`` task.
.. code-block:: php
$ ./doctrine orm:clear-cache:query
To clear the metadata cache use the ``orm:clear-cache:metadata`` task.
.. code-block:: php
$ ./doctrine orm:clear-cache:metadata
To clear the result cache use the ``orm:clear-cache:result`` task.
.. code-block:: php
$ ./doctrine orm:clear-cache:result
All these tasks accept a ``--flush`` option to flush the entire
contents of the cache instead of invalidating the entries.
.. note::
None of these tasks will work with APC, APCu, or XCache drivers
because the memory that the cache is stored in is only accessible
to the webserver.
Cache Chaining
--------------
A common pattern is to use a static cache to store data that is
requested many times in a single PHP request. Even though this data
may be stored in a fast memory cache, often that cache is over a
network link leading to sizable network traffic.
A chain cache class allows multiple caches to be registered at once.
For example, a per-request array cache can be used first, followed by
a (relatively) slower Memcached cache if the array cache misses.
The chain cache automatically handles pushing data up to faster caches in
the chain and clearing data in the entire stack when it is deleted.
Symfony Cache provides such a chain cache. To find out how to use it,
please have a look at the
`Symfony Documentation <https://symfony.com/doc/current/components/cache/adapters/chain_adapter.html>`_.
Cache Slams
-----------
Something to be careful of when using the cache drivers is
"cache slams". Imagine you have a heavily trafficked website with some
code that checks for the existence of a cache record and if it does
not exist it generates the information and saves it to the cache.
Now, if 100 requests were issued all at the same time and each one
sees the cache does not exist and they all try to insert the same
cache entry it could lock up APC, Xcache, etc. and cause problems.
Ways exist to work around this, like pre-populating your cache and
not letting your users' requests populate the cache.
You can read more about cache slams
`in this blog post <http://notmysock.org/blog/php/user-cache-timebomb.html>`_.

View File

@@ -0,0 +1,58 @@
Change Tracking Policies
========================
Change tracking is the process of determining what has changed in
managed entities since the last time they were synchronized with
the database.
Doctrine provides 2 different change tracking policies, each having
its particular advantages and disadvantages. The change tracking
policy can be defined on a per-class basis (or more precisely,
per-hierarchy).
Deferred Implicit
~~~~~~~~~~~~~~~~~
The deferred implicit policy is the default change tracking policy
and the most convenient one. With this policy, Doctrine detects the
changes by a property-by-property comparison at commit time and
also detects changes to entities or new entities that are
referenced by other managed entities ("persistence by
reachability"). Although the most convenient policy, it can have
negative effects on performance if you are dealing with large units
of work (see "Understanding the Unit of Work"). Since Doctrine
can't know what has changed, it needs to check all managed entities
for changes every time you invoke EntityManager#flush(), making
this operation rather costly.
Deferred Explicit
~~~~~~~~~~~~~~~~~
The deferred explicit policy is similar to the deferred implicit
policy in that it detects changes through a property-by-property
comparison at commit time. The difference is that Doctrine ORM only
considers entities that have been explicitly marked for change detection
through a call to EntityManager#persist(entity) or through a save
cascade. All other entities are skipped. This policy therefore
gives improved performance for larger units of work while
sacrificing the behavior of "automatic dirty checking".
Therefore, flush() operations are potentially cheaper with this
policy. The negative aspect this has is that if you have a rather
large application and you pass your objects through several layers
for processing purposes and business tasks you may need to track
yourself which entities have changed on the way so you can pass
them to EntityManager#persist().
This policy can be configured as follows:
.. code-block:: php
<?php
#[Entity]
#[ChangeTrackingPolicy('DEFERRED_EXPLICIT')]
class User
{
// ...
}

View File

@@ -0,0 +1,98 @@
Installation and Configuration
==============================
Doctrine can be installed with `Composer <https://getcomposer.org>`_.
Define the following requirement in your ``composer.json`` file:
::
{
"require": {
"doctrine/orm": "*"
}
}
Then call ``composer install`` from your command line. If you don't know
how Composer works, check out their `Getting Started <https://getcomposer.org/doc/00-intro.md>`_ to set up.
Class loading
-------------
Autoloading is taken care of by Composer. You just have to include the composer autoload file in your project:
.. code-block:: php
<?php
// bootstrap.php
// Include Composer Autoload (relative to project root).
require_once "vendor/autoload.php";
Obtaining an EntityManager
--------------------------
Once you have prepared the class loading, you acquire an
*EntityManager* instance. The EntityManager class is the primary
access point to ORM functionality provided by Doctrine.
.. code-block:: php
<?php
// bootstrap.php
require_once "vendor/autoload.php";
use Doctrine\DBAL\DriverManager;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\ORMSetup;
$paths = ['/path/to/entity-files'];
$isDevMode = false;
// the connection configuration
$dbParams = [
'driver' => 'pdo_mysql',
'user' => 'root',
'password' => '',
'dbname' => 'foo',
];
$config = ORMSetup::createAttributeMetadataConfiguration($paths, $isDevMode);
$connection = DriverManager::getConnection($dbParams, $config);
$entityManager = new EntityManager($connection, $config);
Or if you prefer XML:
.. code-block:: php
<?php
$paths = ['/path/to/xml-mappings'];
$config = ORMSetup::createXMLMetadataConfiguration($paths, $isDevMode);
$connection = DriverManager::getConnection($dbParams, $config);
$entityManager = new EntityManager($connection, $config);
Inside the ``ORMSetup`` methods several assumptions are made:
- If ``$isDevMode`` is true caching is done in memory with the ``ArrayAdapter``. Proxy objects are recreated on every request.
- If ``$isDevMode`` is false, check for Caches in the order APCu, Redis (127.0.0.1:6379), Memcache (127.0.0.1:11211) unless `$cache` is passed as fourth argument.
- If ``$isDevMode`` is false, set then proxy classes have to be explicitly created through the command line.
- If third argument `$proxyDir` is not set, use the systems temporary directory.
.. note::
In order to have ``ORMSetup`` configure the cache automatically, the library ``symfony/cache``
has to be installed as a dependency.
If you want to configure Doctrine in more detail, take a look at the :doc:`Advanced Configuration </reference/advanced-configuration>` section.
.. note::
You can learn more about the database connection configuration in the
`Doctrine DBAL connection configuration reference <https://docs.doctrine-project.org/projects/doctrine-dbal/en/stable/reference/configuration.html>`_.
Setting up the Commandline Tool
-------------------------------
Doctrine ships with a number of command line tools that are very helpful
during development. In order to make use of them, create an executable PHP
script in your project as described in the
:doc:`tools chapter <../reference/tools>`.

File diff suppressed because it is too large Load Diff

1040
docs/en/reference/events.rst Normal file

File diff suppressed because it is too large Load Diff

234
docs/en/reference/faq.rst Normal file
View File

@@ -0,0 +1,234 @@
Frequently Asked Questions
==========================
.. note::
This FAQ is a work in progress. We will add lots of questions and not answer them right away just to remember
what is often asked. If you stumble across an unanswered question please write a mail to the mailing-list or
join the #doctrine channel on Freenode IRC.
Database Schema
---------------
How do I set the charset and collation for MySQL tables?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In your mapping configuration, the column definition (for example, the
``#[Column]`` attribute) has an ``options`` parameter where you can specify
the ``charset`` and ``collation``. The default values are ``utf8`` and
``utf8_unicode_ci``, respectively.
Entity Classes
--------------
How can I add default values to a column?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Doctrine does not support to set the default values in columns through the "DEFAULT" keyword in SQL.
This is not necessary however, you can just use your class properties as default values. These are then used
upon insert:
.. code-block:: php
class User
{
private const STATUS_DISABLED = 0;
private const STATUS_ENABLED = 1;
private string $algorithm = "sha1";
/** @var self::STATUS_* */
private int $status = self::STATUS_DISABLED;
}
.
Mapping
-------
Why do I get exceptions about unique constraint failures during ``$em->flush()``?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Doctrine does not check if you are re-adding entities with a primary key that already exists
or adding entities to a collection twice. You have to check for both conditions yourself
in the code before calling ``$em->flush()`` if you know that unique constraint failures
can occur.
In `Symfony2 <https://www.symfony.com>`_ for example there is a Unique Entity Validator
to achieve this task.
For collections you can check with ``$collection->contains($entity)`` if an entity is already
part of this collection. For a FETCH=LAZY collection this will initialize the collection,
however for FETCH=EXTRA_LAZY this method will use SQL to determine if this entity is already
part of the collection.
Associations
------------
What is wrong when I get an InvalidArgumentException "A new entity was found through the relationship.."?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This exception is thrown during ``EntityManager#flush()`` when there exists an object in the identity map
that contains a reference to an object that Doctrine does not know about. Say for example you grab
a "User"-entity from the database with a specific id and set a completely new object into one of the associations
of the User object. If you then call ``EntityManager#flush()`` without letting Doctrine know about
this new object using ``EntityManager#persist($newObject)`` you will see this exception.
You can solve this exception by:
* Calling ``EntityManager#persist($newObject)`` on the new object
* Using cascade=persist on the association that contains the new object
How can I filter an association?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You should use DQL queries to query for the filtered set of entities.
I call clear() on a One-To-Many collection but the entities are not deleted
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is an expected behavior that has to do with the inverse/owning side handling of Doctrine.
By definition a One-To-Many association is on the inverse side, that means changes to it
will not be recognized by Doctrine.
If you want to perform the equivalent of the clear operation you have to iterate the
collection and set the owning side many-to-one reference to NULL as well to detach all entities
from the collection. This will trigger the appropriate UPDATE statements on the database.
How can I add columns to a many-to-many table?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The many-to-many association is only supporting foreign keys in the table definition
To work with many-to-many tables containing extra columns you have to use the
foreign keys as primary keys feature of Doctrine ORM.
See :doc:`the tutorial on composite primary keys for more information <../tutorials/composite-primary-keys>`.
How can i paginate fetch-joined collections?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you are issuing a DQL statement that fetches a collection as well you cannot easily iterate
over this collection using a LIMIT statement (or vendor equivalent).
Doctrine does not offer a solution for this out of the box but there are several extensions
that do:
* `DoctrineExtensions <https://github.com/beberlei/DoctrineExtensions>`_
* `Pagerfanta <https://github.com/whiteoctober/pagerfanta>`_
Why does pagination not work correctly with fetch joins?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pagination in Doctrine uses a LIMIT clause (or vendor equivalent) to restrict the results.
However when fetch-joining this is not returning the correct number of results since joining
with a one-to-many or many-to-many association multiplies the number of rows by the number
of associated entities.
See the previous question for a solution to this task.
Inheritance
-----------
Can I use Inheritance with Doctrine ORM?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Yes, you can use Single- or Joined-Table Inheritance in ORM.
See the documentation chapter on :doc:`inheritance mapping <inheritance-mapping>` for
the details.
Why does Doctrine not create proxy objects for my inheritance hierarchy?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you set a many-to-one or one-to-one association target-entity to any parent class of
an inheritance hierarchy Doctrine does not know what PHP class the foreign is actually of.
To find this out it has to execute a SQL query to look this information up in the database.
EntityGenerator
---------------
Why does the EntityGenerator not do X?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The EntityGenerator is not a full fledged code-generator that solves all tasks. Code-Generation
is not a first-class priority in Doctrine 2 anymore (compared to Doctrine 1). The EntityGenerator
is supposed to kick-start you, but not towards 100%.
Why does the EntityGenerator not generate inheritance correctly?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Just from the details of the discriminator map the EntityGenerator cannot guess the inheritance hierarchy.
This is why the generation of inherited entities does not fully work. You have to adjust some additional
code to get this one working correctly.
Performance
-----------
Why is an extra SQL query executed every time I fetch an entity with a one-to-one relation?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If Doctrine detects that you are fetching an inverse side one-to-one association
it has to execute an additional query to load this object, because it cannot know
if there is no such object (setting null) or if it should set a proxy and which id this proxy has.
To solve this problem currently a query has to be executed to find out this information.
Doctrine Query Language
-----------------------
What is DQL?
~~~~~~~~~~~~
DQL stands for Doctrine Query Language, a query language that very much looks like SQL
but has some important benefits when using Doctrine:
- It uses class names and fields instead of tables and columns, separating concerns between backend and your object model.
- It utilizes the metadata defined to offer a range of shortcuts when writing. For example you do not have to specify the ON clause of joins, since Doctrine already knows about them.
- It adds some functionality that is related to object management and transforms them into SQL.
It also has some drawbacks of course:
- The syntax is slightly different to SQL so you have to learn and remember the differences.
- To be vendor independent it can only implement a subset of all the existing SQL dialects. Vendor specific functionality and optimizations cannot be used through DQL unless implemented by you explicitly.
- For some DQL constructs subselects are used which are known to be slow in MySQL.
Can I sort by a function (for example ORDER BY RAND()) in DQL?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
No, it is not supported to sort by function in DQL. If you need this functionality you should either
use a native-query or come up with another solution. As a side note: Sorting with ORDER BY RAND() is painfully slow
starting with 1000 rows.
Is it better to write DQL or to generate it with the query builder?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The purpose of the ``QueryBuilder`` is to generate DQL dynamically,
which is useful when you have optional filters, conditional joins, etc.
But the ``QueryBuilder`` is not an alternative to DQL, it actually generates DQL
queries at runtime, which are then interpreted by Doctrine. This means that
using the ``QueryBuilder`` to build and run a query is actually always slower
than only running the corresponding DQL query.
So if you only need to generate a query and bind parameters to it,
you should use plain DQL, as this is a simpler and much more readable solution.
You should only use the ``QueryBuilder`` when you can't achieve what you want to do with a DQL query.
A Query fails, how can I debug it?
----------------------------------
First, if you are using the QueryBuilder you can use
``$queryBuilder->getDQL()`` to get the DQL string of this query. The
corresponding SQL you can get from the Query instance by calling
``$query->getSQL()``.
.. code-block:: php
<?php
$dql = "SELECT u FROM User u";
$query = $entityManager->createQuery($dql);
var_dump($query->getSQL());
$qb = $entityManager->createQueryBuilder();
$qb->select('u')->from('User', 'u');
var_dump($qb->getDQL());

View File

@@ -0,0 +1,126 @@
Filters
=======
Doctrine ORM features a filter system that allows the developer to add SQL to
the conditional clauses of queries, regardless the place where the SQL is
generated (e.g. from a DQL query, or by loading associated entities).
The filter functionality works on SQL level. Whether a SQL query is generated
in a Persister, during lazy loading, in extra lazy collections or from DQL.
Each time the system iterates over all the enabled filters, adding a new SQL
part as a filter returns.
By adding SQL to the conditional clauses of queries, the filter system filters
out rows belonging to the entities at the level of the SQL result set. This
means that the filtered entities are never hydrated (which can be expensive).
Example filter class
--------------------
Throughout this document the example ``MyLocaleFilter`` class will be used to
illustrate how the filter feature works. A filter class must extend the base
``Doctrine\ORM\Query\Filter\SQLFilter`` class and implement the ``addFilterConstraint``
method. The method receives the ``ClassMetadata`` of the filtered entity and the
table alias of the SQL table of the entity.
.. note::
In the case of joined or single table inheritance, you always get passed the ClassMetadata of the
inheritance root. This is necessary to avoid edge cases that would break the SQL when applying the filters.
For the filter to correctly function, the following rules must be followed. Failure to do so will lead to unexpected results from the query cache.
1. Parameters for the query should be set on the filter object by ``SQLFilter#setParameter()`` before the filter is used by the ORM ( i.e. do not set parameters inside ``SQLFilter#addFilterConstraint()`` function ).
2. The filter must be deterministic. Don't change the values base on external inputs.
The ``SQLFilter#getParameter()`` function takes care of the proper quoting of parameters.
.. code-block:: php
<?php
namespace Example;
use Doctrine\ORM\Mapping\ClassMetadata,
Doctrine\ORM\Query\Filter\SQLFilter;
class MyLocaleFilter extends SQLFilter
{
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias): string
{
// Check if the entity implements the LocalAware interface
if (!$targetEntity->reflClass->implementsInterface('LocaleAware')) {
return "";
}
return $targetTableAlias.'.locale = ' . $this->getParameter('locale'); // getParameter applies quoting automatically
}
}
If the parameter is an array and should be quoted as a list of values for an IN query
this is possible with the alternative ``SQLFilter#setParameterList()`` and
``SQLFilter#getParameterList()`` functions.
Configuration
-------------
Filter classes are added to the configuration as following:
.. code-block:: php
<?php
$config->addFilter("locale", "\Doctrine\Tests\ORM\Functional\MyLocaleFilter");
The ``Configuration#addFilter()`` method takes a name for the filter and the name of the
class responsible for the actual filtering.
Disabling/Enabling Filters and Setting Parameters
---------------------------------------------------
Filters can be disabled and enabled via the ``FilterCollection`` which is
stored in the ``EntityManager``. The ``FilterCollection#enable($name)`` method
will retrieve the filter object. You can set the filter parameters on that
object.
.. code-block:: php
<?php
$filter = $em->getFilters()->enable("locale");
$filter->setParameter('locale', 'en');
// Disable it
$filter = $em->getFilters()->disable("locale");
.. warning::
Disabling and enabling filters has no effect on managed entities. If you
want to refresh or reload an object after having modified a filter or the
FilterCollection, then you should clear the EntityManager and re-fetch your
entities, having the new rules for filtering applied.
Suspending/Restoring Filters
----------------------------
When a filter is disabled, the instance is fully deleted and all the filter
parameters previously set are lost. Then, if you enable it again, a new filter
is created without the previous filter parameters. If you want to keep a filter
(in order to use it later) but temporary disable it, you'll need to use the
``FilterCollection#suspend($name)`` and ``FilterCollection#restore($name)``
methods instead.
.. code-block:: php
<?php
$filter = $em->getFilters()->enable("locale");
$filter->setParameter('locale', 'en');
// Temporary suspend the filter
$filter = $em->getFilters()->suspend("locale");
// Do things
// Then restore it, the locale parameter will still be set
$filter = $em->getFilters()->restore("locale");
.. warning::
If you enable a previously disabled filter, doctrine will create a new
one without keeping any of the previously parameter set with
``SQLFilter#setParameter()`` or ``SQLFilter#getParameterList()``. If you
want to restore the previously disabled filter instead, you must use the
``FilterCollection#restore($name)`` method.

View File

@@ -0,0 +1,99 @@
Improving Performance
=====================
Bytecode Cache
--------------
It is highly recommended to make use of a bytecode cache like OPcache.
A bytecode cache removes the need for parsing PHP code on every
request and can greatly improve performance.
"If you care about performance and don't use a bytecode
cache then you don't really care about performance. Please get one
and start using it."
*Stas Malyshev, Core Contributor to PHP and Zend Employee*
Metadata and Query caches
-------------------------
As already mentioned earlier in the chapter about configuring
Doctrine, it is strongly discouraged to use Doctrine without a
Metadata and Query cache.
Operating Doctrine without these caches means
Doctrine will need to load your mapping information on every single
request and has to parse each DQL query on every single request.
This is a waste of resources.
The preferred cache adapter for metadata and query caches is a PHP file
cache like Symfony's
`PHP files adapter <https://symfony.com/doc/current/components/cache/adapters/php_files_adapter.html>`_.
This kind of cache serializes cache items and writes them to a file.
This allows for opcode caching to be used and provides high performance in most scenarios.
See :ref:`types-of-caches`
Alternative Query Result Formats
--------------------------------
Make effective use of the available alternative query result
formats like nested array graphs or pure scalar results, especially
in scenarios where data is loaded for read-only purposes.
Read-Only Entities
------------------
You can mark entities as read only. For details, see :ref:`attrref_entity`
This means that the entity marked as read only is never considered for updates.
During flush on the EntityManager these entities are skipped even if properties
changed.
Read-Only allows to persist new entities of a kind and remove existing ones,
they are just not considered for updates.
You can also explicitly mark individual entities read only directly on the
UnitOfWork via a call to ``markReadOnly()``:
.. code-block:: php
$user = $entityManager->find(User::class, $id);
$entityManager->getUnitOfWork()->markReadOnly($user);
Or you can set all objects that are the result of a query hydration to be
marked as read only with the following query hint:
.. code-block:: php
$query = $entityManager->createQuery('SELECT u FROM App\\Entity\\User u');
$query->setHint(Query::HINT_READ_ONLY, true);
$users = $query->getResult();
Extra-Lazy Collections
----------------------
If entities hold references to large collections you will get performance and memory problems initializing them.
To solve this issue you can use the EXTRA_LAZY fetch-mode feature for collections. See the :doc:`tutorial <../tutorials/extra-lazy-associations>`
for more information on how this fetch mode works.
Temporarily change fetch mode in DQL
------------------------------------
See :ref:`dql-temporarily-change-fetch-mode`
Apply Best Practices
--------------------
A lot of the points mentioned in the Best Practices chapter will
also positively affect the performance of Doctrine.
See :doc:`Best Practices </reference/best-practices>`
Change Tracking policies
------------------------
See: :doc:`Change Tracking Policies <change-tracking-policies>`

View File

@@ -0,0 +1,568 @@
Inheritance Mapping
===================
This chapter explains the available options for mapping class
hierarchies.
Mapped Superclasses
-------------------
A mapped superclass is an abstract or concrete class that provides
persistent entity state and mapping information for its subclasses,
but which is not itself an entity. Typically, the purpose of such a
mapped superclass is to define state and mapping information that
is common to multiple entity classes.
Mapped superclasses, just as regular, non-mapped classes, can
appear in the middle of an otherwise mapped inheritance hierarchy
(through Single Table Inheritance or Class Table Inheritance). They
are not query-able, and need not have an ``#[Id]`` property.
No database table will be created for a mapped superclass itself,
only for entity classes inheriting from it. That implies that a
mapped superclass cannot be the ``targetEntity`` in associations.
In other words, a mapped superclass can use unidirectional One-To-One
and Many-To-One associations where it is the owning side.
Many-To-Many associations are only possible if the mapped
superclass is only used in exactly one entity at the moment. For further
support of inheritance, the single or joined table inheritance features
have to be used.
.. note::
One-To-Many associations are not generally possible on a mapped
superclass, since they require the "many" side to hold the foreign
key.
It is, however, possible to use the :doc:`ResolveTargetEntityListener </cookbook/resolve-target-entity-listener>`
to replace references to a mapped superclass with an entity class at runtime.
As long as there is only one entity subclass inheriting from the mapped
superclass and all references to the mapped superclass are resolved to that
entity class at runtime, the mapped superclass *can* use One-To-Many associations
and be named as the ``targetEntity`` on the owning sides.
.. warning::
At least when using attributes or annotations to specify your mapping,
it *seems* as if you could inherit from a base class that is neither
an entity nor a mapped superclass, but has properties with mapping configuration
on them that would also be used in the inheriting class.
This, however, is due to how the corresponding mapping
drivers work and what the PHP reflection API reports for inherited fields.
Such a configuration is explicitly not supported. To give just one example,
it will break for ``private`` properties.
.. note::
You may be tempted to use traits to mix mapped fields or relationships
into your entity classes to circumvent some of the limitations of
mapped superclasses. Before doing that, please read the section on traits
in the :doc:`Limitations and Known Issues </reference/limitations-and-known-issues>` chapter.
Example:
.. code-block:: php
<?php
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\OneToOne;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\MappedSuperclass;
use Doctrine\ORM\Mapping\Entity;
#[MappedSuperclass]
class Person
{
#[Column(type: 'integer')]
protected int $mapped1;
#[Column(type: 'string')]
protected string $mapped2;
#[OneToOne(targetEntity: Toothbrush::class)]
#[JoinColumn(name: 'toothbrush_id', referencedColumnName: 'id')]
protected Toothbrush|null $toothbrush = null;
// ... more fields and methods
}
#[Entity]
class Employee extends Person
{
#[Id, Column(type: 'integer')]
private int|null $id = null;
#[Column(type: 'string')]
private string $name;
// ... more fields and methods
}
#[Entity]
class Toothbrush
{
#[Id, Column(type: 'integer')]
private int|null $id = null;
// ... more fields and methods
}
The DDL for the corresponding database schema would look something
like this (this is for SQLite):
.. code-block:: sql
CREATE TABLE Employee (mapped1 INTEGER NOT NULL, mapped2 TEXT NOT NULL, id INTEGER NOT NULL, name TEXT NOT NULL, toothbrush_id INTEGER DEFAULT NULL, PRIMARY KEY(id))
As you can see from this DDL snippet, there is only a single table
for the entity subclass. All the mappings from the mapped
superclass were inherited to the subclass as if they had been
defined on that class directly.
Entity Inheritance
------------------
As soon as one entity class inherits from another entity class, either
directly, with a mapped superclass or other unmapped (also called
"transient") classes in between, these entities form an inheritance
hierarchy. The topmost entity class in this hierarchy is called the
root entity, and the hierarchy includes all entities that are
descendants of this root entity.
On the root entity class, ``#[InheritanceType]``,
``#[DiscriminatorColumn]`` and ``#[DiscriminatorMap]`` must be specified.
``#[InheritanceType]`` specifies one of the two available inheritance
mapping strategies that are explained in the following sections.
``#[DiscriminatorColumn]`` designates the so-called discriminator column.
This is an extra column in the table that keeps information about which
type from the hierarchy applies for a particular database row.
``#[DiscriminatorMap]`` declares the possible values for the discriminator
column and maps them to class names in the hierarchy. This discriminator map
has to declare all non-abstract entity classes that exist in that particular
inheritance hierarchy. That includes the root as well as any intermediate
entity classes, given they are not abstract.
The names of the classes in the discriminator map do not need to be fully
qualified if the classes are contained in the same namespace as the entity
class on which the discriminator map is applied.
If no discriminator map is provided, then the map is generated
automatically. The automatically generated discriminator map contains the
lowercase short name of each class as key.
.. note::
Automatically generating the discriminator map is very expensive
computation-wise. The mapping driver has to provide all classes
for which mapping configuration exists, and those have to be
loaded and checked against the current inheritance hierarchy
to see if they are part of it. The resulting map, however, can be kept
in the metadata cache.
Performance impact on to-one associations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There is a general performance consideration when using entity inheritance:
If the target-entity of a many-to-one or one-to-one association is part of
an inheritance hierarchy, it is preferable for performance reasons that it
be a leaf entity (ie. have no subclasses).
Otherwise, the ORM is currently unable to tell beforehand which entity class
will have to be used, and so no appropriate proxy instance can be created.
That means the referred-to entities will *always* be loaded eagerly, which
might even propagate to relationships of these entities (in the case of
self-referencing associations).
Single Table Inheritance
------------------------
`Single Table Inheritance <https://martinfowler.com/eaaCatalog/singleTableInheritance.html>`_
is an inheritance mapping strategy where all classes of a hierarchy are
mapped to a single database table.
Example:
.. configuration-block::
.. code-block:: attribute
<?php
namespace MyProject\Model;
#[Entity]
#[InheritanceType('SINGLE_TABLE')]
#[DiscriminatorColumn(name: 'discr', type: 'string')]
#[DiscriminatorMap(['person' => Person::class, 'employee' => Employee::class])]
class Person
{
// ...
}
#[Entity]
class Employee extends Person
{
// ...
}
In this example, the ``#[DiscriminatorMap]`` specifies that in the
discriminator column, a value of "person" identifies a row as being of type
``Person`` and employee" identifies a row as being of type ``Employee``.
Design-time considerations
~~~~~~~~~~~~~~~~~~~~~~~~~~
This mapping approach works well when the type hierarchy is fairly
simple and stable. Adding a new type to the hierarchy and adding
fields to existing supertypes simply involves adding new columns to
the table, though in large deployments this may have an adverse
impact on the index and column layout inside the database.
Performance impact
~~~~~~~~~~~~~~~~~~
This strategy is very efficient for querying across all types in
the hierarchy or for specific types. No table joins are required,
only a ``WHERE`` clause listing the type identifiers. In particular,
relationships involving types that employ this mapping strategy are
very performing.
SQL Schema considerations
~~~~~~~~~~~~~~~~~~~~~~~~~
For Single-Table-Inheritance to work in scenarios where you are
using either a legacy database schema or a self-written database
schema you have to make sure that all columns that are not in the
root entity but in any of the different sub-entities has to allow
null values. Columns that have ``NOT NULL`` constraints have to be on
the root entity of the single-table inheritance hierarchy.
Class Table Inheritance
-----------------------
`Class Table Inheritance <https://martinfowler.com/eaaCatalog/classTableInheritance.html>`_
is an inheritance mapping strategy where each class in a hierarchy
is mapped to several tables: its own table and the tables of all
parent classes. The table of a child class is linked to the table
of a parent class through a foreign key constraint.
The discriminator column is placed in the topmost table of the hierarchy,
because this is the easiest way to achieve polymorphic queries with Class
Table Inheritance.
Example:
.. code-block:: php
<?php
namespace MyProject\Model;
#[Entity]
#[InheritanceType('JOINED')]
#[DiscriminatorColumn(name: 'discr', type: 'string')]
#[DiscriminatorMap(['person' => Person::class, 'employee' => Employee::class])]
class Person
{
// ...
}
#[Entity]
class Employee extends Person
{
// ...
}
As before, the ``#[DiscriminatorMap]`` specifies that in the
discriminator column, a value of "person" identifies a row as being of type
``Person`` and "employee" identifies a row as being of type ``Employee``.
.. note::
When you do not use the SchemaTool to generate the
required SQL you should know that deleting a class table
inheritance makes use of the foreign key property
``ON DELETE CASCADE`` in all database implementations. A failure to
implement this yourself will lead to dead rows in the database.
Design-time considerations
~~~~~~~~~~~~~~~~~~~~~~~~~~
Introducing a new type to the hierarchy, at any level, simply
involves interjecting a new table into the schema. Subtypes of that
type will automatically join with that new type at runtime.
Similarly, modifying any entity type in the hierarchy by adding,
modifying or removing fields affects only the immediate table
mapped to that type. This mapping strategy provides the greatest
flexibility at design time, since changes to any type are always
limited to that type's dedicated table.
Performance impact
~~~~~~~~~~~~~~~~~~
This strategy inherently requires multiple JOIN operations to
perform just about any query which can have a negative impact on
performance, especially with large tables and/or large hierarchies.
When partial objects are allowed, either globally or on the
specific query, then querying for any type will not cause the
tables of subtypes to be ``OUTER JOIN``ed which can increase
performance but the resulting partial objects will not fully load
themselves on access of any subtype fields, so accessing fields of
subtypes after such a query is not safe.
There is also another important performance consideration that it is *not possible*
to query for the base entity without any ``LEFT JOIN``s to the sub-types.
SQL Schema considerations
~~~~~~~~~~~~~~~~~~~~~~~~~
For each entity in the Class-Table Inheritance hierarchy all the
mapped fields have to be columns on the table of this entity.
Additionally each child table has to have an id column that matches
the id column definition on the root table (except for any sequence
or auto-increment details). Furthermore each child table has to
have a foreign key pointing from the id column to the root table id
column and cascading on delete.
.. _inheritence_mapping_overrides:
Overrides
---------
Overrides can only be applied to entities that extend a mapped superclass or
use traits. They are used to override a mapping for an entity field or
relationship defined in that mapped superclass or trait.
It is not supported to use overrides in entity inheritance scenarios.
.. note::
When using traits, make sure not to miss the warnings given in the
:doc:`Limitations and Known Issues </reference/limitations-and-known-issues>` chapter.
Association Override
~~~~~~~~~~~~~~~~~~~~
Override a mapping for an entity relationship.
Could be used by an entity that extends a mapped superclass
to override a relationship mapping defined by the mapped superclass.
Example:
.. configuration-block::
.. code-block:: attribute
<?php
// user mapping
namespace MyProject\Model;
#[MappedSuperclass]
class User
{
// other fields mapping
/** @var Collection<int, Group> */
#[JoinTable(name: 'users_groups')]
#[JoinColumn(name: 'user_id', referencedColumnName: 'id')]
#[InverseJoinColumn(name: 'group_id', referencedColumnName: 'id')]
#[ManyToMany(targetEntity: 'Group', inversedBy: 'users')]
protected Collection $groups;
#[ManyToOne(targetEntity: 'Address')]
#[JoinColumn(name: 'address_id', referencedColumnName: 'id')]
protected Address|null $address = null;
}
// admin mapping
namespace MyProject\Model;
#[Entity]
#[AssociationOverrides([
new AssociationOverride(
name: 'groups',
joinTable: new JoinTable(
name: 'users_admingroups',
),
joinColumns: [new JoinColumn(name: 'adminuser_id')],
inverseJoinColumns: [new JoinColumn(name: 'admingroup_id')]
),
new AssociationOverride(
name: 'address',
joinColumns: [new JoinColumn(name: 'adminaddress_id', referencedColumnName: 'id')]
)
])]
class Admin extends User
{
}
.. code-block:: xml
<!-- user mapping -->
<doctrine-mapping>
<mapped-superclass name="MyProject\Model\User">
<!-- other fields mapping -->
<many-to-many field="groups" target-entity="Group" inversed-by="users">
<cascade>
<cascade-persist/>
<cascade-detach/>
</cascade>
<join-table name="users_groups">
<join-columns>
<join-column name="user_id" referenced-column-name="id" />
</join-columns>
<inverse-join-columns>
<join-column name="group_id" referenced-column-name="id" />
</inverse-join-columns>
</join-table>
</many-to-many>
</mapped-superclass>
</doctrine-mapping>
<!-- admin mapping -->
<doctrine-mapping>
<entity name="MyProject\Model\Admin">
<association-overrides>
<association-override name="groups">
<join-table name="users_admingroups">
<join-columns>
<join-column name="adminuser_id"/>
</join-columns>
<inverse-join-columns>
<join-column name="admingroup_id"/>
</inverse-join-columns>
</join-table>
</association-override>
<association-override name="address">
<join-columns>
<join-column name="adminaddress_id" referenced-column-name="id"/>
</join-columns>
</association-override>
</association-overrides>
</entity>
</doctrine-mapping>
Things to note:
- The "association override" specifies the overrides based on the property
name.
- This feature is available for all kind of associations (OneToOne, OneToMany, ManyToOne, ManyToMany).
- The association type *cannot* be changed.
- The override could redefine the ``joinTables`` or ``joinColumns`` depending on the association type.
- The override could redefine ``inversedBy`` to reference more than one extended entity.
- The override could redefine fetch to modify the fetch strategy of the extended entity.
Attribute Override
~~~~~~~~~~~~~~~~~~~~
Override the mapping of a field.
Could be used by an entity that extends a mapped superclass to override a field mapping defined by the mapped superclass.
.. configuration-block::
.. code-block:: attribute
<?php
// user mapping
namespace MyProject\Model;
#[MappedSuperclass]
class User
{
#[Id, GeneratedValue, Column(type: 'integer', name: 'user_id', length: 150)]
protected int|null $id = null;
#[Column(name: 'user_name', nullable: true, unique: false, length: 250)]
protected string $name;
// other fields mapping
}
// guest mapping
namespace MyProject\Model;
#[Entity]
#[AttributeOverrides([
new AttributeOverride(
name: 'id',
column: new Column(
name: 'guest_id',
type: 'integer',
length: 140
)
),
new AttributeOverride(
name: 'name',
column: new Column(
name: 'guest_name',
nullable: false,
unique: true,
length: 240
)
)
])]
class Guest extends User
{
}
.. code-block:: xml
<!-- user mapping -->
<doctrine-mapping>
<mapped-superclass name="MyProject\Model\User">
<id name="id" type="integer" column="user_id" length="150">
<generator strategy="AUTO"/>
</id>
<field name="name" column="user_name" type="string" length="250" nullable="true" unique="false" />
<many-to-one field="address" target-entity="Address">
<cascade>
<cascade-persist/>
</cascade>
<join-column name="address_id" referenced-column-name="id"/>
</many-to-one>
<!-- other fields mapping -->
</mapped-superclass>
</doctrine-mapping>
<!-- admin mapping -->
<doctrine-mapping>
<entity name="MyProject\Model\Guest">
<attribute-overrides>
<attribute-override name="id">
<field column="guest_id" length="140"/>
</attribute-override>
<attribute-override name="name">
<field column="guest_name" type="string" length="240" nullable="false" unique="true" />
</attribute-override>
</attribute-overrides>
</entity>
</doctrine-mapping>
Things to note:
- The "attribute override" specifies the overrides based on the property name.
- The column type *cannot* be changed. If the column type is not equal, you get a ``MappingException``.
- The override can redefine all the attributes except the type.
Query the Type
--------------
It may happen that the entities of a special type should be queried. Because there
is no direct access to the discriminator column, Doctrine provides the
``INSTANCE OF`` construct.
The following example shows how to use ``INSTANCE OF``. There is a three level hierarchy
with a base entity ``NaturalPerson`` which is extended by ``Staff`` which in turn
is extended by ``Technician``.
Querying for the staffs without getting any technicians can be achieved by this DQL:
.. code-block:: php
<?php
$query = $em->createQuery("SELECT staff FROM MyProject\Model\Staff staff WHERE staff NOT INSTANCE OF MyProject\Model\Technician");
$staffs = $query->getResult();

View File

@@ -0,0 +1,6 @@
:orphan:
Installation
============
The installation chapter has moved to :doc:`Installation and Configuration </reference/configuration>`.

View File

@@ -0,0 +1,223 @@
Limitations and Known Issues
============================
We try to make using Doctrine ORM a very pleasant experience.
Therefore we think it is very important to be honest about the
current limitations to our users. Much like every other piece of
software the ORM is not perfect and far from feature complete.
This section should give you an overview of current limitations of
Doctrine ORM as well as critical known issues that you should know
about.
Current Limitations
-------------------
There is a set of limitations that exist currently which might be
solved in the future. Any of this limitations now stated has at
least one ticket in the Tracker and is discussed for future
releases.
Join-Columns with non-primary keys
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is not possible to use join columns pointing to non-primary keys. Doctrine will think these are the primary
keys and create lazy-loading proxies with the data, which can lead to unexpected results. Doctrine can for performance
reasons not validate the correctness of this settings at runtime but only through the Validate Schema command.
Mapping Arrays to a Join Table
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Related to the previous limitation with "Foreign Keys as
Identifier" you might be interested in mapping the same table
structure as given above to an array. However this is not yet
possible either. See the following example:
.. code-block:: sql
CREATE TABLE product (
id INTEGER,
name VARCHAR,
PRIMARY KEY(id)
);
CREATE TABLE product_attributes (
product_id INTEGER,
attribute_name VARCHAR,
attribute_value VARCHAR,
PRIMARY KEY (product_id, attribute_name)
);
This schema should be mapped to a Product Entity as follows:
.. code-block:: php
class Product
{
private $id;
private $name;
private $attributes = array();
}
Where the ``attribute_name`` column contains the key and
``attribute_value`` contains the value of each array element in
``$attributes``.
The feature request for persistence of primitive value arrays
`is described in the DDC-298 ticket <https://github.com/doctrine/orm/issues/3743>`_.
Custom Persisters
~~~~~~~~~~~~~~~~~
A Persister in Doctrine is an object that is responsible for the
hydration and write operations of an entity against the database.
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 <https://github.com/doctrine/orm/issues/5178>`_
- `Evaluate possible ways in which stored-procedures can be used <https://github.com/doctrine/orm/issues/4946>`_
Persist Keys of Collections
~~~~~~~~~~~~~~~~~~~~~~~~~~~
PHP Arrays are ordered hash-maps and so should be the
``Doctrine\Common\Collections\Collection`` interface. We plan to
evaluate a feature that optionally persists and hydrates the keys
of a Collection instance.
`Ticket DDC-213 <https://github.com/doctrine/orm/issues/2817>`_
Mapping many tables to one entity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is not possible to map several equally looking tables onto one
entity. For example if you have a production and an archive table
of a certain business concept then you cannot have both tables map
to the same entity.
Behaviors
~~~~~~~~~
Doctrine ORM will **never** include a behavior system like Doctrine 1
in the core library. We don't think behaviors add more value than
they cost pain and debugging hell. Please see the many different
blog posts we have written on this topics:
- `Doctrine2 "Behaviors" in a Nutshell <https://www.doctrine-project.org/2010/02/17/doctrine2-behaviours-nutshell.html>`_
- `A re-usable Versionable behavior for Doctrine2 <https://www.doctrine-project.org/2010/02/24/doctrine2-versionable.html>`_
- `Write your own ORM on top of Doctrine2 <https://www.doctrine-project.org/2010/07/19/your-own-orm-doctrine2.html>`_
- `Doctrine ORM Behavioral Extensions <https://www.doctrine-project.org/2010/11/18/doctrine2-behavioral-extensions.html>`_
Doctrine ORM has enough hooks and extension points so that **you** can
add whatever you want on top of it. None of this will ever become
core functionality of Doctrine2 however, you will have to rely on
third party extensions for magical behaviors.
Nested Set
~~~~~~~~~~
NestedSet was offered as a behavior in Doctrine 1 and will not be
included in the core of Doctrine ORM. However there are already two
extensions out there that offer support for Nested Set with
ORM:
- `Doctrine2 Hierarchical-Structural Behavior <https://github.com/guilhermeblanco/Doctrine2-Hierarchical-Structural-Behavior>`_
- `Doctrine2 NestedSet <https://github.com/blt04/doctrine2-nestedset>`_
Using Traits in Entity Classes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The use of traits in entity or mapped superclasses, at least when they
include mapping configuration or mapped fields, is currently not
endorsed by the Doctrine project. The reasons for this are as follows.
Traits were added in PHP 5.4 more than 10 years ago, but at the same time
more than two years after the initial Doctrine 2 release and the time where
core components were designed.
In fact, this documentation mentions traits only in the context of
:doc:`overriding field association mappings in subclasses </tutorials/override-field-association-mappings-in-subclasses>`.
Coverage of traits in test cases is practically nonexistent.
Thus, you should at least be aware that when using traits in your entity and
mapped superclasses, you will be in uncharted terrain.
.. warning::
There be dragons.
From a more technical point of view, traits basically work at the language level
as if the code contained in them had been copied into the class where the trait
is used, and even private fields are accessible by the using class. In addition to
that, some precedence and conflict resolution rules apply.
When it comes to loading mapping configuration, the annotation and attribute drivers
rely on PHP reflection to inspect class properties including their docblocks.
As long as the results are consistent with what a solution *without* traits would
have produced, this is probably fine.
However, to mention known limitations, it is currently not possible to use "class"
level `annotations <https://github.com/doctrine/orm/pull/1517>`_ or
`attributes <https://github.com/doctrine/orm/issues/8868>`_ on traits, and attempts to
improve parser support for traits as `here <https://github.com/doctrine/annotations/pull/102>`_
or `there <https://github.com/doctrine/annotations/pull/63>`_ have been abandoned
due to complexity.
XML mapping configuration probably needs to completely re-configure or otherwise
copy-and-paste configuration for fields used from traits.
Mapping multiple private fields of the same name
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When two classes, say a mapped superclass and an entity inheriting from it,
both contain a ``private`` field of the same name, this will lead to a ``MappingException``.
Since the fields are ``private``, both are technically separate and can contain
different values at the same time. However, the ``ClassMetadata`` configuration used
internally by the ORM currently refers to fields by their name only, without taking the
class containing the field into consideration. This makes it impossible to keep separate
mapping configuration for both fields.
Known Issues
------------
The Known Issues section describes critical/blocker bugs and other
issues that are either complicated to fix, not fixable due to
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 bugs, improvement and feature requests on `Github issues <https://github.com/doctrine/orm/issues>`_.
Identifier Quoting and Legacy Databases
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For compatibility reasons between all the supported vendors and
edge case problems Doctrine ORM does **NOT** do automatic identifier
quoting. This can lead to problems when trying to get
legacy-databases to work with Doctrine ORM.
- You can quote column-names as described in the
:doc:`Basic-Mapping <basic-mapping>` section.
- You cannot quote join column names.
- You cannot use non [a-zA-Z0-9\_]+ characters, they will break
several SQL statements.
Having problems with these kind of column names? Many databases
support all CRUD operations on views that semantically map to
certain tables. You can create views for all your problematic
tables and column names to avoid the legacy quoting nightmare.
Microsoft SQL Server and Doctrine "datetime"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Doctrine assumes that you use ``DateTime2`` data-types. If your legacy database contains DateTime
datatypes then you have to add your own data-type (see Basic Mapping for an example).
MySQL with MyISAM tables
~~~~~~~~~~~~~~~~~~~~~~~~
Doctrine cannot provide atomic operations when calling ``EntityManager#flush()`` if one
of the tables involved uses the storage engine MyISAM. You must use InnoDB or
other storage engines that support transactions if you need integrity.

View File

@@ -0,0 +1,195 @@
Metadata Drivers
================
The heart of an object relational mapper is the mapping information
that glues everything together. It instructs the EntityManager how
it should behave when dealing with the different entities.
Core Metadata Drivers
---------------------
Doctrine provides a few different ways for you to specify your
metadata:
- **XML files** (XmlDriver)
- **Attributes** (AttributeDriver)
- **PHP Code in files or static functions** (PhpDriver)
Something important to note about the above drivers is they are all
an intermediate step to the same end result. The mapping
information is populated to ``Doctrine\ORM\Mapping\ClassMetadata``
instances. So in the end, Doctrine only ever has to work with the
API of the ``ClassMetadata`` class to get mapping information for
an entity.
.. note::
The populated ``ClassMetadata`` instances are also cached
so in a production environment the parsing and populating only ever
happens once. You can configure the metadata cache implementation
using the ``setMetadataCacheImpl()`` method on the
``Doctrine\ORM\Configuration`` class:
.. code-block:: php
<?php
$em->getConfiguration()->setMetadataCacheImpl(new ApcuCache());
All the drivers are in the ``Doctrine\ORM\Mapping\Driver`` namespace:
.. code-block:: php
<?php
$driver = new \Doctrine\ORM\Mapping\Driver\XmlDriver('/path/to/mapping/files');
$em->getConfiguration()->setMetadataDriverImpl($driver);
Implementing Metadata Drivers
-----------------------------
In addition to the included metadata drivers you can very easily
implement your own. All you need to do is define a class which
implements the ``MappingDriver`` interface:
.. code-block:: php
<?php
declare(strict_types=1);
namespace Doctrine\Persistence\Mapping\Driver;
use Doctrine\Persistence\Mapping\ClassMetadata;
/**
* Contract for metadata drivers.
*/
interface MappingDriver
{
/**
* Loads the metadata for the specified class into the provided container.
*
* @psalm-param class-string<T> $className
* @psalm-param ClassMetadata<T> $metadata
*
* @return void
*
* @template T of object
*/
public function loadMetadataForClass(string $className, ClassMetadata $metadata);
/**
* Gets the names of all mapped classes known to this driver.
*
* @return array<int, string> The names of all mapped classes known to this driver.
* @psalm-return list<class-string>
*/
public function getAllClassNames();
/**
* Returns whether the class with the specified name should have its metadata loaded.
* This is only the case if it is either mapped as an Entity or a MappedSuperclass.
*
* @psalm-param class-string $className
*
* @return bool
*/
public function isTransient(string $className);
}
If you want to write a metadata driver to parse information from
some file format we've made your life a little easier by providing
the ``FileDriver`` implementation for you to extend from:
.. code-block:: php
<?php
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\Driver\FileDriver;
class MyMetadataDriver extends FileDriver
{
/**
* {@inheritDoc}
*/
protected $_fileExtension = '.dcm.ext';
/**
* {@inheritDoc}
*/
public function loadMetadataForClass($className, ClassMetadata $metadata)
{
$data = $this->_loadMappingFile($file);
// populate ClassMetadata instance from $data
}
/**
* {@inheritDoc}
*/
protected function _loadMappingFile($file)
{
// parse contents of $file and return php data structure
}
}
.. note::
When using the ``FileDriver`` it requires that you only have one
entity defined per file and the file named after the class described
inside where namespace separators are replaced by periods. So if you
have an entity named ``Entities\User`` and you wanted to write a
mapping file for your driver above you would need to name the file
``Entities.User.dcm.ext`` for it to be recognized.
Now you can use your ``MyMetadataDriver`` implementation by setting
it with the ``setMetadataDriverImpl()`` method:
.. code-block:: php
<?php
$driver = new MyMetadataDriver('/path/to/mapping/files');
$em->getConfiguration()->setMetadataDriverImpl($driver);
ClassMetadata
-------------
The last piece you need to know and understand about metadata in
Doctrine ORM is the API of the ``ClassMetadata`` classes. You need to
be familiar with them in order to implement your own drivers but
more importantly to retrieve mapping information for a certain
entity when needed.
You have all the methods you need to manually specify the mapping
information instead of using some mapping file to populate it from.
You can read more about the API of the ``ClassMetadata`` classes in
the PHP Mapping chapter.
Getting ClassMetadata Instances
-------------------------------
If you want to get the ``ClassMetadata`` instance for an entity in
your project to programmatically use some mapping information to
generate some HTML or something similar you can retrieve it through
the ``ClassMetadataFactory``:
.. code-block:: php
<?php
$cmf = $em->getMetadataFactory();
$class = $cmf->getMetadataFor('MyEntityName');
Now you can learn about the entity and use the data stored in the
``ClassMetadata`` instance to get all mapped fields for example and
iterate over them:
.. code-block:: php
<?php
foreach ($class->fieldMappings as $fieldMapping) {
echo $fieldMapping['fieldName'] . "\n";
}

View File

@@ -0,0 +1,139 @@
Implementing a NamingStrategy
==============================
Using a naming strategy you can provide rules for generating database identifiers,
column or table names. This feature helps
reduce the verbosity of the mapping document, eliminating repetitive noise (eg: ``TABLE_``).
.. warning
The naming strategy is always overridden by entity mapping such as the `Table` attribute.
Configuring a naming strategy
-----------------------------
The default strategy used by Doctrine is quite minimal.
By default the ``Doctrine\ORM\Mapping\DefaultNamingStrategy``
uses the simple class name and the attribute names to generate tables and columns.
You can specify a different strategy by calling ``Doctrine\ORM\Configuration#setNamingStrategy()``:
.. code-block:: php
<?php
$namingStrategy = new MyNamingStrategy();
$configuration->setNamingStrategy($namingStrategy);
Underscore naming strategy
---------------------------
``\Doctrine\ORM\Mapping\UnderscoreNamingStrategy`` is a built-in strategy.
.. code-block:: php
<?php
$namingStrategy = new \Doctrine\ORM\Mapping\UnderscoreNamingStrategy(CASE_UPPER);
$configuration->setNamingStrategy($namingStrategy);
For SomeEntityName the strategy will generate the table SOME_ENTITY_NAME with the
``CASE_UPPER`` option, or some_entity_name with the ``CASE_LOWER`` option.
Naming strategy interface
-------------------------
The interface ``Doctrine\ORM\Mapping\NamingStrategy`` allows you to specify
a naming strategy for database tables and columns.
.. code-block:: php
<?php
/**
* Return a table name for an entity class
*
* @param string $className The fully-qualified class name
* @return string A table name
*/
function classToTableName($className);
/**
* Return a column name for a property
*
* @param string $propertyName A property
* @return string A column name
*/
function propertyToColumnName($propertyName);
/**
* Return the default reference column name
*
* @return string A column name
*/
function referenceColumnName();
/**
* Return a join column name for a property
*
* @param string $propertyName A property
* @return string A join column name
*/
function joinColumnName($propertyName, $className = null);
/**
* Return a join table name
*
* @param string $sourceEntity The source entity
* @param string $targetEntity The target entity
* @param string $propertyName A property
* @return string A join table name
*/
function joinTableName($sourceEntity, $targetEntity, $propertyName = null);
/**
* Return the foreign key column name for the given parameters
*
* @param string $entityName A entity
* @param string $referencedColumnName A property
* @return string A join column name
*/
function joinKeyColumnName($entityName, $referencedColumnName = null);
Implementing a naming strategy
-------------------------------
If you have database naming standards, like all table names should be prefixed
by the application prefix, all column names should be lower case, you can easily
achieve such standards by implementing a naming strategy.
You need to create a class which implements ``Doctrine\ORM\Mapping\NamingStrategy``.
.. code-block:: php
<?php
class MyAppNamingStrategy implements NamingStrategy
{
public function classToTableName(string $className): string
{
return 'MyApp_' . substr($className, strrpos($className, '\\') + 1);
}
public function propertyToColumnName(string $propertyName): string
{
return $propertyName;
}
public function referenceColumnName(): string
{
return 'id';
}
public function joinColumnName(string $propertyName, ?string $className = null): string
{
return $propertyName . '_' . $this->referenceColumnName();
}
public function joinTableName(string $sourceEntity, string $targetEntity, string $propertyName): string
{
return strtolower($this->classToTableName($sourceEntity) . '_' .
$this->classToTableName($targetEntity));
}
public function joinKeyColumnName(string $entityName, ?string $referencedColumnName): string
{
return strtolower($this->classToTableName($entityName) . '_' .
($referencedColumnName ?: $this->referenceColumnName()));
}
}

View File

@@ -0,0 +1,467 @@
Native SQL
==========
With ``NativeQuery`` you can execute native SELECT SQL statements
and map the results to Doctrine entities or any other result format
supported by Doctrine.
In order to make this mapping possible, you need to describe
to Doctrine what columns in the result map to which entity property.
This description is represented by a ``ResultSetMapping`` object.
With this feature you can map arbitrary SQL code to objects, such as highly
vendor-optimized SQL or stored-procedures.
Writing ``ResultSetMapping`` from scratch is complex, but there is a convenience
wrapper around it called a ``ResultSetMappingBuilder``. It can generate
the mappings for you based on Entities and even generates the ``SELECT``
clause based on this information for you.
.. note::
If you want to execute DELETE, UPDATE or INSERT statements
the Native SQL API cannot be used and will probably throw errors.
Use ``EntityManager#getConnection()`` to access the native database
connection and call the ``executeUpdate()`` method for these
queries.
The NativeQuery class
---------------------
To create a ``NativeQuery`` you use the method
``EntityManager#createNativeQuery($sql, $resultSetMapping)``. As you can see in
the signature of this method, it expects 2 ingredients: The SQL you want to
execute and the ``ResultSetMapping`` that describes how the results will be
mapped.
Once you obtained an instance of a ``NativeQuery``, you can bind parameters to
it with the same API that ``Query`` has and execute it.
.. code-block:: php
<?php
use Doctrine\ORM\Query\ResultSetMapping;
$rsm = new ResultSetMapping();
// build rsm here
$query = $entityManager->createNativeQuery('SELECT id, name, discr FROM users WHERE name = ?', $rsm);
$query->setParameter(1, 'romanb');
$users = $query->getResult();
ResultSetMappingBuilder
-----------------------
An easy start into ResultSet mapping is the ``ResultSetMappingBuilder`` object.
This has several benefits:
- The builder takes care of automatically updating your ``ResultSetMapping``
when the fields or associations change on the metadata of an entity.
- You can generate the required ``SELECT`` expression for a builder
by converting it to a string.
- The API is much simpler than the usual ``ResultSetMapping`` API.
One downside is that the builder API does not yet support entities
with inheritance hierarchies.
.. code-block:: php
<?php
use Doctrine\ORM\Query\ResultSetMappingBuilder;
$sql = "SELECT u.id, u.name, a.id AS address_id, a.street, a.city " .
"FROM users u INNER JOIN address a ON u.address_id = a.id";
$rsm = new ResultSetMappingBuilder($entityManager);
$rsm->addRootEntityFromClassMetadata('MyProject\User', 'u');
$rsm->addJoinedEntityFromClassMetadata('MyProject\Address', 'a', 'u', 'address', array('id' => 'address_id'));
The builder extends the ``ResultSetMapping`` class and as such has all the functionality of it as well.
The ``SELECT`` clause can be generated
from a ``ResultSetMappingBuilder``. You can either cast the builder
object to ``(string)`` and the DQL aliases are used as SQL table aliases
or use the ``generateSelectClause($tableAliases)`` method and pass
a mapping from DQL alias (key) to SQL alias (value)
.. code-block:: php
<?php
$selectClause = $rsm->generateSelectClause(array(
'u' => 't1',
'g' => 't2'
));
$sql = "SELECT " . $selectClause . " FROM users t1 JOIN groups t2 ON t1.group_id = t2.id";
The ResultSetMapping
--------------------
Understanding the ``ResultSetMapping`` is the key to using a
``NativeQuery``. A Doctrine result can contain the following
components:
- Entity results. These represent root result elements.
- Joined entity results. These represent joined entities in
associations of root entity results.
- Field results. These represent a column in the result set that
maps to a field of an entity. A field result always belongs to an
entity result or joined entity result.
- Scalar results. These represent scalar values in the result set
that will appear in each result row. Adding scalar results to a
ResultSetMapping can also cause the overall result to become
**mixed** (see DQL - Doctrine Query Language) if the same
ResultSetMapping also contains entity results.
- Meta results. These represent columns that contain
meta-information, such as foreign keys and discriminator columns.
When querying for objects (``getResult()``), all meta columns of
root entities or joined entities must be present in the SQL query
and mapped accordingly using ``ResultSetMapping#addMetaResult``.
.. note::
It might not surprise you that Doctrine uses
``ResultSetMapping`` internally when you create DQL queries. As
the query gets parsed and transformed to SQL, Doctrine fills a
``ResultSetMapping`` that describes how the results should be
processed by the hydration routines.
We will now look at each of the result types that can appear in a
ResultSetMapping in detail.
Entity results
~~~~~~~~~~~~~~
An entity result describes an entity type that appears as a root
element in the transformed result. You add an entity result through
``ResultSetMapping#addEntityResult()``. Let's take a look at the
method signature in detail:
.. code-block:: php
<?php
/**
* Adds an entity result to this ResultSetMapping.
*
* @param string $class The class name of the entity.
* @param string $alias The alias for the class. The alias must be unique among all entity
* results or joined entity results within this ResultSetMapping.
*/
public function addEntityResult($class, $alias)
The first parameter is the fully qualified name of the entity
class. The second parameter is some arbitrary alias for this entity
result that must be unique within a ``ResultSetMapping``. You use
this alias to attach field results to the entity result. It is very
similar to an identification variable that you use in DQL to alias
classes or relationships.
An entity result alone is not enough to form a valid
``ResultSetMapping``. An entity result or joined entity result
always needs a set of field results, which we will look at soon.
Joined entity results
~~~~~~~~~~~~~~~~~~~~~
A joined entity result describes an entity type that appears as a
joined relationship element in the transformed result, attached to
a (root) entity result. You add a joined entity result through
``ResultSetMapping#addJoinedEntityResult()``. Let's take a look at
the method signature in detail:
.. code-block:: php
<?php
/**
* Adds a joined entity result.
*
* @param string $class The class name of the joined entity.
* @param string $alias The unique alias to use for the joined entity.
* @param string $parentAlias The alias of the entity result that is the parent of this joined result.
* @param object $relation The association field that connects the parent entity result with the joined entity result.
*/
public function addJoinedEntityResult($class, $alias, $parentAlias, $relation)
The first parameter is the class name of the joined entity. The
second parameter is an arbitrary alias for the joined entity that
must be unique within the ``ResultSetMapping``. You use this alias
to attach field results to the entity result. The third parameter
is the alias of the entity result that is the parent type of the
joined relationship. The fourth and last parameter is the name of
the field on the parent entity result that should contain the
joined entity result.
Field results
~~~~~~~~~~~~~
A field result describes the mapping of a single column in a SQL
result set to a field in an entity. As such, field results are
inherently bound to entity results. You add a field result through
``ResultSetMapping#addFieldResult()``. Again, let's examine the
method signature in detail:
.. code-block:: php
<?php
/**
* Adds a field result that is part of an entity result or joined entity result.
*
* @param string $alias The alias of the entity result or joined entity result.
* @param string $columnName The name of the column in the SQL result set.
* @param string $fieldName The name of the field on the (joined) entity.
*/
public function addFieldResult($alias, $columnName, $fieldName)
The first parameter is the alias of the entity result to which the
field result will belong. The second parameter is the name of the
column in the SQL result set. Note that this name is case
sensitive, i.e. if you use a native query against Oracle it must be
all uppercase. The third parameter is the name of the field on the
entity result identified by ``$alias`` into which the value of the
column should be set.
Scalar results
~~~~~~~~~~~~~~
A scalar result describes the mapping of a single column in a SQL
result set to a scalar value in the Doctrine result. Scalar results
are typically used for aggregate values but any column in the SQL
result set can be mapped as a scalar value. To add a scalar result
use ``ResultSetMapping#addScalarResult()``. The method signature in
detail:
.. code-block:: php
<?php
/**
* Adds a scalar result mapping.
*
* @param string $columnName The name of the column in the SQL result set.
* @param string $alias The result alias with which the scalar result should be placed in the result structure.
*/
public function addScalarResult($columnName, $alias)
The first parameter is the name of the column in the SQL result set
and the second parameter is the result alias under which the value
of the column will be placed in the transformed Doctrine result.
Special case: DTOs
...................
You can also use ``ResultSetMapping`` to map the results of a native SQL
query to a DTO (Data Transfer Object). This is done by adding scalar
results for each argument of the DTO's constructor, then filling the
``newObjectMappings`` property of the ``ResultSetMapping`` with
information about where to map each scalar result:
.. code-block:: php
<?php
$rsm = new ResultSetMapping();
$rsm->addScalarResult('name', 1, 'string');
$rsm->addScalarResult('email', 2, 'string');
$rsm->addScalarResult('city', 3, 'string');
$rsm->newObjectMappings['name'] = [
'className' => CmsUserDTO::class,
'objIndex' => 0, // a result can contain many DTOs, this is the index of the DTO to map to
'argIndex' => 0, // each scalar result can be mapped to a different argument of the DTO constructor
];
$rsm->newObjectMappings['email'] = [
'className' => CmsUserDTO::class,
'objIndex' => 0,
'argIndex' => 1,
];
$rsm->newObjectMappings['city'] = [
'className' => CmsUserDTO::class,
'objIndex' => 0,
'argIndex' => 2,
];
Meta results
~~~~~~~~~~~~
A meta result describes a single column in a SQL result set that
is either a foreign key or a discriminator column. These columns
are essential for Doctrine to properly construct objects out of SQL
result sets. To add a column as a meta result use
``ResultSetMapping#addMetaResult()``. The method signature in
detail:
.. code-block:: php
<?php
/**
* Adds a meta column (foreign key or discriminator column) to the result set.
*
* @param string $alias
* @param string $columnAlias
* @param string $columnName
* @param boolean $isIdentifierColumn
*/
public function addMetaResult($alias, $columnAlias, $columnName, $isIdentifierColumn = false)
The first parameter is the alias of the entity result to which the
meta column belongs. A meta result column (foreign key or
discriminator column) always belongs to an entity result. The
second parameter is the column alias/name of the column in the SQL
result set and the third parameter is the column name used in the
mapping.
The fourth parameter should be set to true in case the primary key
of the entity is the foreign key you're adding.
Discriminator Column
~~~~~~~~~~~~~~~~~~~~
When joining an inheritance tree you have to give Doctrine a hint
which meta-column is the discriminator column of this tree.
.. code-block:: php
<?php
/**
* Sets a discriminator column for an entity result or joined entity result.
* The discriminator column will be used to determine the concrete class name to
* instantiate.
*
* @param string $alias The alias of the entity result or joined entity result the discriminator
* column should be used for.
* @param string $discrColumn The name of the discriminator column in the SQL result set.
*/
public function setDiscriminatorColumn($alias, $discrColumn)
Examples
~~~~~~~~
Understanding a ResultSetMapping is probably easiest through
looking at some examples.
First a basic example that describes the mapping of a single
entity.
.. code-block:: php
<?php
// Equivalent DQL query: "select u from User u where u.name=?1"
// User owns no associations.
$rsm = new ResultSetMapping;
$rsm->addEntityResult('User', 'u');
$rsm->addFieldResult('u', 'id', 'id');
$rsm->addFieldResult('u', 'name', 'name');
$query = $this->_em->createNativeQuery('SELECT id, name FROM users WHERE name = ?', $rsm);
$query->setParameter(1, 'romanb');
$users = $query->getResult();
The result would look like this:
.. code-block:: php
array(
[0] => User (Object)
)
Note that this would be a partial object if the entity has more
fields than just id and name. In the example above the column and
field names are identical but that is not necessary, of course.
Also note that the query string passed to createNativeQuery is
**real native SQL**. Doctrine does not touch this SQL in any way.
In the previous basic example, a User had no relations and the
table the class is mapped to owns no foreign keys. The next example
assumes User has a unidirectional or bidirectional one-to-one
association to a CmsAddress, where the User is the owning side and
thus owns the foreign key.
.. code-block:: php
<?php
// Equivalent DQL query: "select u from User u where u.name=?1"
// User owns an association to an Address but the Address is not loaded in the query.
$rsm = new ResultSetMapping;
$rsm->addEntityResult('User', 'u');
$rsm->addFieldResult('u', 'id', 'id');
$rsm->addFieldResult('u', 'name', 'name');
$rsm->addMetaResult('u', 'address_id', 'address_id');
$query = $this->_em->createNativeQuery('SELECT id, name, address_id FROM users WHERE name = ?', $rsm);
$query->setParameter(1, 'romanb');
$users = $query->getResult();
Foreign keys are used by Doctrine for lazy-loading purposes when
querying for objects. In the previous example, each user object in
the result will have a proxy (a "ghost") in place of the address
that contains the address\_id. When the ghost proxy is accessed, it
loads itself based on this key.
Consequently, associations that are *fetch-joined* do not require
the foreign keys to be present in the SQL result set, only
associations that are lazy.
.. code-block:: php
<?php
// Equivalent DQL query: "select u from User u join u.address a WHERE u.name = ?1"
// User owns association to an Address and the Address is loaded in the query.
$rsm = new ResultSetMapping;
$rsm->addEntityResult('User', 'u');
$rsm->addFieldResult('u', 'id', 'id');
$rsm->addFieldResult('u', 'name', 'name');
$rsm->addJoinedEntityResult('Address' , 'a', 'u', 'address');
$rsm->addFieldResult('a', 'address_id', 'id');
$rsm->addFieldResult('a', 'street', 'street');
$rsm->addFieldResult('a', 'city', 'city');
$sql = 'SELECT u.id, u.name, a.id AS address_id, a.street, a.city FROM users u ' .
'INNER JOIN address a ON u.address_id = a.id WHERE u.name = ?';
$query = $this->_em->createNativeQuery($sql, $rsm);
$query->setParameter(1, 'romanb');
$users = $query->getResult();
In this case the nested entity ``Address`` is registered with the
``ResultSetMapping#addJoinedEntityResult`` method, which notifies
Doctrine that this entity is not hydrated at the root level, but as
a joined entity somewhere inside the object graph. In this case we
specify the alias 'u' as third parameter and ``address`` as fourth
parameter, which means the ``Address`` is hydrated into the
``User::$address`` property.
If a fetched entity is part of a mapped hierarchy that requires a
discriminator column, this column must be present in the result set
as a meta column so that Doctrine can create the appropriate
concrete type. This is shown in the following example where we
assume that there are one or more subclasses that extend User and
either Class Table Inheritance or Single Table Inheritance is used
to map the hierarchy (both use a discriminator column).
.. code-block:: php
<?php
// Equivalent DQL query: "select u from User u where u.name=?1"
// User is a mapped base class for other classes. User owns no associations.
$rsm = new ResultSetMapping;
$rsm->addEntityResult('User', 'u');
$rsm->addFieldResult('u', 'id', 'id');
$rsm->addFieldResult('u', 'name', 'name');
$rsm->addMetaResult('u', 'discr', 'discr'); // discriminator column
$rsm->setDiscriminatorColumn('u', 'discr');
$query = $this->_em->createNativeQuery('SELECT id, name, discr FROM users WHERE name = ?', $rsm);
$query->setParameter(1, 'romanb');
$users = $query->getResult();
Note that in the case of Class Table Inheritance, an example as
above would result in partial objects if any objects in the result
are actually a subtype of User. When using DQL, Doctrine
automatically includes the necessary joins for this mapping
strategy but with native SQL it is your responsibility.

View File

@@ -0,0 +1,246 @@
PHP Mapping
===========
Doctrine ORM also allows you to provide the ORM metadata in the form of plain
PHP code using the ``ClassMetadata`` API. You can write the code in inside of a
static function named ``loadMetadata($class)`` on the entity class itself.
Static Function
---------------
In addition to other drivers using configuration languages you can also
programatically specify your mapping information inside of a static function
defined on the entity class itself.
This is useful for cases where you want to keep your entity and mapping
information together but don't want to use attributes. For this you just
need to use the ``StaticPHPDriver``:
.. code-block:: php
<?php
use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver;
$driver = new StaticPHPDriver('/path/to/entities');
$em->getConfiguration()->setMetadataDriverImpl($driver);
Now you just need to define a static function named
``loadMetadata($metadata)`` on your entity:
.. code-block:: php
<?php
namespace Entities;
use Doctrine\ORM\Mapping\ClassMetadata;
class User
{
// ...
public static function loadMetadata(ClassMetadata $metadata)
{
$metadata->mapField(array(
'id' => true,
'fieldName' => 'id',
'type' => 'integer'
));
$metadata->mapField(array(
'fieldName' => 'username',
'type' => 'string'
));
}
}
ClassMetadataBuilder
--------------------
To ease the use of the ClassMetadata API (which is very raw) there is a ``ClassMetadataBuilder`` that you can use.
.. code-block:: php
<?php
namespace Entities;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
class User
{
// ...
public static function loadMetadata(ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->createField('id', 'integer')->isPrimaryKey()->generatedValue()->build();
$builder->addField('username', 'string');
}
}
The API of the ClassMetadataBuilder has the following methods with a fluent interface:
- ``addField($name, $type, array $mapping)``
- ``setMappedSuperclass()``
- ``setReadOnly()``
- ``setCustomRepositoryClass($className)``
- ``setTable($name)``
- ``addIndex(array $columns, $indexName)``
- ``addUniqueConstraint(array $columns, $constraintName)``
- ``setJoinedTableInheritance()``
- ``setSingleTableInheritance()``
- ``setDiscriminatorColumn($name, $type = 'string', $length = 255, $columnDefinition = null, $enumType = null, $options = [])``
- ``addDiscriminatorMapClass($name, $class)``
- ``setChangeTrackingPolicyDeferredExplicit()``
- ``addLifecycleEvent($methodName, $event)``
- ``addManyToOne($name, $targetEntity, $inversedBy = null)``
- ``addInverseOneToOne($name, $targetEntity, $mappedBy)``
- ``addOwningOneToOne($name, $targetEntity, $inversedBy = null)``
- ``addOwningManyToMany($name, $targetEntity, $inversedBy = null)``
- ``addInverseManyToMany($name, $targetEntity, $mappedBy)``
- ``addOneToMany($name, $targetEntity, $mappedBy)``
It also has several methods that create builders (which are necessary for advanced mappings):
- ``createField($name, $type)`` returns a ``FieldBuilder`` instance
- ``createManyToOne($name, $targetEntity)`` returns an ``AssociationBuilder`` instance
- ``createOneToOne($name, $targetEntity)`` returns an ``AssociationBuilder`` instance
- ``createManyToMany($name, $targetEntity)`` returns an ``ManyToManyAssociationBuilder`` instance
- ``createOneToMany($name, $targetEntity)`` returns an ``OneToManyAssociationBuilder`` instance
ClassMetadata API
-----------------
The ``ClassMetadata`` class is the data object for storing the mapping
metadata for a single entity. It contains all the getters and setters
you need populate and retrieve information for an entity.
General Setters
~~~~~~~~~~~~~~~
- ``setTableName($tableName)``
- ``setPrimaryTable(array $primaryTableDefinition)``
- ``setCustomRepositoryClass($repositoryClassName)``
- ``setIdGeneratorType($generatorType)``
- ``setIdGenerator($generator)``
- ``setSequenceGeneratorDefinition(array $definition)``
- ``setChangeTrackingPolicy($policy)``
- ``setIdentifier(array $identifier)``
Inheritance Setters
~~~~~~~~~~~~~~~~~~~
- ``setInheritanceType($type)``
- ``setSubclasses(array $subclasses)``
- ``setParentClasses(array $classNames)``
- ``setDiscriminatorColumn($columnDef)``
- ``setDiscriminatorMap(array $map)``
Field Mapping Setters
~~~~~~~~~~~~~~~~~~~~~
- ``mapField(array $mapping)``
- ``mapOneToOne(array $mapping)``
- ``mapOneToMany(array $mapping)``
- ``mapManyToOne(array $mapping)``
- ``mapManyToMany(array $mapping)``
Lifecycle Callback Setters
~~~~~~~~~~~~~~~~~~~~~~~~~~
- ``addLifecycleCallback($callback, $event)``
- ``setLifecycleCallbacks(array $callbacks)``
Versioning Setters
~~~~~~~~~~~~~~~~~~
- ``setVersionMapping(array &$mapping)``
- ``setVersioned($bool)``
- ``setVersionField()``
General Getters
~~~~~~~~~~~~~~~
- ``getTableName()``
- ``getSchemaName()``
- ``getTemporaryIdTableName()``
Identifier Getters
~~~~~~~~~~~~~~~~~~
- ``getIdentifierColumnNames()``
- ``usesIdGenerator()``
- ``isIdentifier($fieldName)``
- ``isIdGeneratorIdentity()``
- ``isIdGeneratorSequence()``
- ``isIdGeneratorTable()``
- ``isIdentifierNatural()``
- ``getIdentifierFieldNames()``
- ``getSingleIdentifierFieldName()``
- ``getSingleIdentifierColumnName()``
Inheritance Getters
~~~~~~~~~~~~~~~~~~~
- ``isInheritanceTypeNone()``
- ``isInheritanceTypeJoined()``
- ``isInheritanceTypeSingleTable()``
- ``isInheritedField($fieldName)``
- ``isInheritedAssociation($fieldName)``
Change Tracking Getters
~~~~~~~~~~~~~~~~~~~~~~~
- ``isChangeTrackingDeferredExplicit()``
- ``isChangeTrackingDeferredImplicit()``
Field & Association Getters
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ``isUniqueField($fieldName)``
- ``isNullable($fieldName)``
- ``getColumnName($fieldName)``
- ``getFieldMapping($fieldName)``
- ``getAssociationMapping($fieldName)``
- ``getAssociationMappings()``
- ``getFieldName($columnName)``
- ``hasField($fieldName)``
- ``getColumnNames(array $fieldNames = null)``
- ``getTypeOfField($fieldName)``
- ``getTypeOfColumn($columnName)``
- ``hasAssociation($fieldName)``
- ``isSingleValuedAssociation($fieldName)``
- ``isCollectionValuedAssociation($fieldName)``
Lifecycle Callback Getters
~~~~~~~~~~~~~~~~~~~~~~~~~~
- ``hasLifecycleCallbacks($lifecycleEvent)``
- ``getLifecycleCallbacks($event)``
Runtime reflection methods
~~~~~~~~~~~~~~~~~~~~~~~~~~
These are methods related to runtime reflection for working with the
entities themselves.
- ``getReflectionClass()``
- ``getReflectionProperties()``
- ``getReflectionProperty($name)``
- ``getSingleIdReflectionProperty()``
- ``getIdentifierValues($entity)``
- ``setIdentifierValues($entity, $id)``
- ``setFieldValue($entity, $field, $value)``
- ``getFieldValue($entity, $field)``

View File

@@ -0,0 +1,613 @@
The QueryBuilder
================
A ``QueryBuilder`` provides an API that is designed for
conditionally constructing a DQL query in several steps.
It provides a set of classes and methods that is able to
programmatically build queries, and also provides a fluent API.
This means that you can change between one methodology to the other
as you want, or just pick a preferred one.
.. note::
The ``QueryBuilder`` is not an abstraction of DQL, but merely a tool to dynamically build it.
You should still use plain DQL when you can, as it is simpler and more readable.
More about this in the :doc:`FAQ <faq>`.
Constructing a new QueryBuilder object
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The same way you build a normal Query, you build a ``QueryBuilder``
object. Here is an example of how to build a ``QueryBuilder``
object:
.. code-block:: php
<?php
// $em instanceof EntityManager
// example1: creating a QueryBuilder instance
$qb = $em->createQueryBuilder();
An instance of QueryBuilder has several informative methods. One
good example is to inspect what type of object the
``QueryBuilder`` is.
.. code-block:: php
<?php
// $qb instanceof QueryBuilder
// example2: retrieving type of QueryBuilder
echo $qb->getType(); // Prints: 0
There're currently 3 possible return values for ``getType()``:
- ``QueryBuilder::SELECT``, which returns value 0
- ``QueryBuilder::DELETE``, returning value 1
- ``QueryBuilder::UPDATE``, which returns value 2
It is possible to retrieve the associated ``EntityManager`` of the
current ``QueryBuilder``, its DQL and also a ``Query`` object when
you finish building your DQL.
.. code-block:: php
<?php
// $qb instanceof QueryBuilder
// example3: retrieve the associated EntityManager
$em = $qb->getEntityManager();
// example4: retrieve the DQL string of what was defined in QueryBuilder
$dql = $qb->getDql();
// example5: retrieve the associated Query object with the processed DQL
$q = $qb->getQuery();
Internally, ``QueryBuilder`` works with a DQL cache to increase
performance. Any changes that may affect the generated DQL actually
modifies the state of ``QueryBuilder`` to a stage we call
STATE\_DIRTY. One ``QueryBuilder`` can be in two different states:
- ``QueryBuilder::STATE_CLEAN``, which means DQL haven't been
altered since last retrieval or nothing were added since its
instantiation
- ``QueryBuilder::STATE_DIRTY``, means DQL query must (and will)
be processed on next retrieval
Working with QueryBuilder
~~~~~~~~~~~~~~~~~~~~~~~~~
High level API methods
^^^^^^^^^^^^^^^^^^^^^^
The most straightforward way to build a dynamic query with the ``QueryBuilder`` is by taking
advantage of Helper methods. For all base code, there is a set of
useful methods to simplify a programmer's life. To illustrate how
to work with them, here is the same example 6 re-written using
``QueryBuilder`` helper methods:
.. code-block:: php
<?php
// $qb instanceof QueryBuilder
$qb->select('u')
->from('User', 'u')
->where('u.id = ?1')
->orderBy('u.name', 'ASC');
``QueryBuilder`` helper methods are considered the standard way to
use the ``QueryBuilder``. The ``$qb->expr()->*`` methods can help you
build conditional expressions dynamically. Here is a converted example 8 to
suggested way to build queries with dynamic conditions:
.. code-block:: php
<?php
// $qb instanceof QueryBuilder
$qb->select(array('u')) // string 'u' is converted to array internally
->from('User', 'u')
->where($qb->expr()->orX(
$qb->expr()->eq('u.id', '?1'),
$qb->expr()->like('u.nickname', '?2')
))
->orderBy('u.surname', 'ASC');
Here is a complete list of helper methods available in ``QueryBuilder``:
.. code-block:: php
<?php
class QueryBuilder
{
// Example - $qb->select('u')
// Example - $qb->select(array('u', 'p'))
// Example - $qb->select($qb->expr()->select('u', 'p'))
public function select($select = null);
// addSelect does not override previous calls to select
//
// Example - $qb->select('u');
// ->addSelect('p.area_code');
public function addSelect($select = null);
// Example - $qb->delete('User', 'u')
public function delete($delete = null, $alias = null);
// Example - $qb->update('Group', 'g')
public function update($update = null, $alias = null);
// Example - $qb->set('u.firstName', $qb->expr()->literal('Arnold'))
// Example - $qb->set('u.numChilds', 'u.numChilds + ?1')
// Example - $qb->set('u.numChilds', $qb->expr()->sum('u.numChilds', '?1'))
public function set($key, $value);
// Example - $qb->from('Phonenumber', 'p')
// Example - $qb->from('Phonenumber', 'p', 'p.id')
public function from($from, $alias, $indexBy = null);
// Example - $qb->join('u.Group', 'g', Expr\Join::WITH, $qb->expr()->eq('u.status_id', '?1'))
// Example - $qb->join('u.Group', 'g', 'WITH', 'u.status = ?1')
// Example - $qb->join('u.Group', 'g', 'WITH', 'u.status = ?1', 'g.id')
public function join($join, $alias, $conditionType = null, $condition = null, $indexBy = null);
// Example - $qb->innerJoin('u.Group', 'g', Expr\Join::WITH, $qb->expr()->eq('u.status_id', '?1'))
// Example - $qb->innerJoin('u.Group', 'g', 'WITH', 'u.status = ?1')
// Example - $qb->innerJoin('u.Group', 'g', 'WITH', 'u.status = ?1', 'g.id')
public function innerJoin($join, $alias, $conditionType = null, $condition = null, $indexBy = null);
// Example - $qb->leftJoin('u.Phonenumbers', 'p', Expr\Join::WITH, $qb->expr()->eq('p.area_code', 55))
// Example - $qb->leftJoin('u.Phonenumbers', 'p', 'WITH', 'p.area_code = 55')
// Example - $qb->leftJoin('u.Phonenumbers', 'p', 'WITH', 'p.area_code = 55', 'p.id')
public function leftJoin($join, $alias, $conditionType = null, $condition = null, $indexBy = null);
// NOTE: ->where() overrides all previously set conditions
//
// Example - $qb->where('u.firstName = ?1', $qb->expr()->eq('u.surname', '?2'))
// Example - $qb->where($qb->expr()->andX($qb->expr()->eq('u.firstName', '?1'), $qb->expr()->eq('u.surname', '?2')))
// Example - $qb->where('u.firstName = ?1 AND u.surname = ?2')
public function where($where);
// NOTE: ->andWhere() can be used directly, without any ->where() before
//
// Example - $qb->andWhere($qb->expr()->orX($qb->expr()->lte('u.age', 40), 'u.numChild = 0'))
public function andWhere($where);
// Example - $qb->orWhere($qb->expr()->between('u.id', 1, 10));
public function orWhere($where);
// NOTE: -> groupBy() overrides all previously set grouping conditions
//
// Example - $qb->groupBy('u.id')
public function groupBy($groupBy);
// Example - $qb->addGroupBy('g.name')
public function addGroupBy($groupBy);
// NOTE: -> having() overrides all previously set having conditions
//
// Example - $qb->having('u.salary >= ?1')
// Example - $qb->having($qb->expr()->gte('u.salary', '?1'))
public function having($having);
// Example - $qb->andHaving($qb->expr()->gt($qb->expr()->count('u.numChild'), 0))
public function andHaving($having);
// Example - $qb->orHaving($qb->expr()->lte('g.managerLevel', '100'))
public function orHaving($having);
// NOTE: -> orderBy() overrides all previously set ordering conditions
//
// Example - $qb->orderBy('u.surname', 'DESC')
public function orderBy($sort, $order = null);
// Example - $qb->addOrderBy('u.firstName')
public function addOrderBy($sort, $order = null); // Default $order = 'ASC'
}
Binding parameters to your query
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Doctrine supports dynamic binding of parameters to your query,
similar to preparing queries. You can use both strings and numbers
as placeholders, although both have a slightly different syntax.
Additionally, you must make your choice: Mixing both styles is not
allowed. Binding parameters can simply be achieved as follows:
.. code-block:: php
<?php
// $qb instanceof QueryBuilder
$qb->select('u')
->from('User', 'u')
->where('u.id = ?1')
->orderBy('u.name', 'ASC')
->setParameter(1, 100); // Sets ?1 to 100, and thus we will fetch a user with u.id = 100
You are not forced to enumerate your placeholders as the
alternative syntax is available:
.. code-block:: php
<?php
// $qb instanceof QueryBuilder
$qb->select('u')
->from('User', 'u')
->where('u.id = :identifier')
->orderBy('u.name', 'ASC')
->setParameter('identifier', 100); // Sets :identifier to 100, and thus we will fetch a user with u.id = 100
Note that numeric placeholders start with a ? followed by a number
while the named placeholders start with a : followed by a string.
Calling ``setParameter()`` automatically infers which type you are setting as
value. This works for integers, arrays of strings/integers, DateTime instances
and for managed entities. If you want to set a type explicitly you can call
the third argument to ``setParameter()`` explicitly. It accepts either a DBAL
``Doctrine\DBAL\ParameterType::*`` or a DBAL Type name for conversion.
.. note::
Even though passing DateTime instance is allowed, it impacts performance
as by default there is an attempt to load metadata for object, and if it's not found,
type is inferred from the original value.
.. code-block:: php
<?php
use Doctrine\DBAL\Types\Types;
// prevents attempt to load metadata for date time class, improving performance
$qb->setParameter('date', new \DateTimeImmutable(), Types::DATETIME_IMMUTABLE)
If you've got several parameters to bind to your query, you can
also use setParameters() instead of setParameter() with the
following syntax:
.. code-block:: php
<?php
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Query\Parameter;
// $qb instanceof QueryBuilder
// Query here...
$qb->setParameters(new ArrayCollection([
new Parameter('1', 'value for ?1'),
new Parameter('2', 'value for ?2')
]));
Getting already bound parameters is easy - simply use the above
mentioned syntax with "getParameter()" or "getParameters()":
.. code-block:: php
<?php
// $qb instanceof QueryBuilder
// See example above
$params = $qb->getParameters();
// $params instanceof \Doctrine\Common\Collections\ArrayCollection
// Equivalent to
$param = $qb->getParameter(1);
// $param instanceof \Doctrine\ORM\Query\Parameter
Note: If you try to get a parameter that was not bound yet,
getParameter() simply returns NULL.
The API of a Query Parameter is:
.. code-block:: php
namespace Doctrine\ORM\Query;
class Parameter
{
public function getName();
public function getValue();
public function getType();
public function setValue($value, $type = null);
}
Limiting the Result
^^^^^^^^^^^^^^^^^^^
To limit a result the query builder has some methods in common with
the Query object which can be retrieved from ``EntityManager#createQuery()``.
.. code-block:: php
<?php
// $qb instanceof QueryBuilder
$offset = (int)$_GET['offset'];
$limit = (int)$_GET['limit'];
$qb->add('select', 'u')
->add('from', 'User u')
->add('orderBy', 'u.name ASC')
->setFirstResult( $offset )
->setMaxResults( $limit );
Executing a Query
^^^^^^^^^^^^^^^^^
The QueryBuilder is a builder object only - it has no means of actually
executing the Query. Additionally a set of parameters such as query hints
cannot be set on the QueryBuilder itself. This is why you always have to convert
a querybuilder instance into a Query object:
.. code-block:: php
<?php
// $qb instanceof QueryBuilder
$query = $qb->getQuery();
// Set additional Query options
$query->setQueryHint('foo', 'bar');
$query->useResultCache('my_cache_id');
// Execute Query
$result = $query->getResult();
$iterableResult = $query->toIterable();
$single = $query->getSingleResult();
$array = $query->getArrayResult();
$scalar = $query->getScalarResult();
$singleScalar = $query->getSingleScalarResult();
The Expr class
^^^^^^^^^^^^^^
To workaround some of the issues that ``add()`` method may cause,
Doctrine created a class that can be considered as a helper for
building expressions. This class is called ``Expr``, which provides a
set of useful methods to help build expressions:
.. code-block:: php
<?php
// $qb instanceof QueryBuilder
// example8: QueryBuilder port of:
// "SELECT u FROM User u WHERE u.id = ? OR u.nickname LIKE ? ORDER BY u.name ASC" using Expr class
$qb->add('select', new Expr\Select(array('u')))
->add('from', new Expr\From('User', 'u'))
->add('where', $qb->expr()->orX(
$qb->expr()->eq('u.id', '?1'),
$qb->expr()->like('u.nickname', '?2')
))
->add('orderBy', new Expr\OrderBy('u.name', 'ASC'));
Although it still sounds complex, the ability to programmatically
create conditions are the main feature of ``Expr``. Here it is a
complete list of supported helper methods available:
.. code-block:: php
<?php
class Expr
{
/** Conditional objects **/
// Example - $qb->expr()->andX($cond1 [, $condN])->add(...)->...
public function andX($x = null); // Returns Expr\AndX instance
// Example - $qb->expr()->orX($cond1 [, $condN])->add(...)->...
public function orX($x = null); // Returns Expr\OrX instance
/** Comparison objects **/
// Example - $qb->expr()->eq('u.id', '?1') => u.id = ?1
public function eq($x, $y); // Returns Expr\Comparison instance
// Example - $qb->expr()->neq('u.id', '?1') => u.id <> ?1
public function neq($x, $y); // Returns Expr\Comparison instance
// Example - $qb->expr()->lt('u.id', '?1') => u.id < ?1
public function lt($x, $y); // Returns Expr\Comparison instance
// Example - $qb->expr()->lte('u.id', '?1') => u.id <= ?1
public function lte($x, $y); // Returns Expr\Comparison instance
// Example - $qb->expr()->gt('u.id', '?1') => u.id > ?1
public function gt($x, $y); // Returns Expr\Comparison instance
// Example - $qb->expr()->gte('u.id', '?1') => u.id >= ?1
public function gte($x, $y); // Returns Expr\Comparison instance
// Example - $qb->expr()->isNull('u.id') => u.id IS NULL
public function isNull($x); // Returns string
// Example - $qb->expr()->isNotNull('u.id') => u.id IS NOT NULL
public function isNotNull($x); // Returns string
// Example - $qb->expr()->isMemberOf('?1', 'u.groups') => ?1 MEMBER OF u.groups
public function isMemberOf($x, $y); // Returns Expr\Comparison instance
// Example - $qb->expr()->isInstanceOf('u', Employee::class) => u INSTANCE OF Employee
public function isInstanceOf($x, $y); // Returns Expr\Comparison instance
/** Arithmetic objects **/
// Example - $qb->expr()->prod('u.id', '2') => u.id * 2
public function prod($x, $y); // Returns Expr\Math instance
// Example - $qb->expr()->diff('u.id', '2') => u.id - 2
public function diff($x, $y); // Returns Expr\Math instance
// Example - $qb->expr()->sum('u.id', '2') => u.id + 2
public function sum($x, $y); // Returns Expr\Math instance
// Example - $qb->expr()->quot('u.id', '2') => u.id / 2
public function quot($x, $y); // Returns Expr\Math instance
/** Pseudo-function objects **/
// Example - $qb->expr()->exists($qb2->getDql())
public function exists($subquery); // Returns Expr\Func instance
// Example - $qb->expr()->all($qb2->getDql())
public function all($subquery); // Returns Expr\Func instance
// Example - $qb->expr()->some($qb2->getDql())
public function some($subquery); // Returns Expr\Func instance
// Example - $qb->expr()->any($qb2->getDql())
public function any($subquery); // Returns Expr\Func instance
// Example - $qb->expr()->not($qb->expr()->eq('u.id', '?1'))
public function not($restriction); // Returns Expr\Func instance
// Example - $qb->expr()->in('u.id', array(1, 2, 3))
// Make sure that you do NOT use something similar to $qb->expr()->in('value', array('stringvalue')) as this will cause Doctrine to throw an Exception.
// Instead, use $qb->expr()->in('value', array('?1')) and bind your parameter to ?1 (see section above)
public function in($x, $y); // Returns Expr\Func instance
// Example - $qb->expr()->notIn('u.id', '2')
public function notIn($x, $y); // Returns Expr\Func instance
// Example - $qb->expr()->like('u.firstname', $qb->expr()->literal('Gui%'))
public function like($x, $y); // Returns Expr\Comparison instance
// Example - $qb->expr()->notLike('u.firstname', $qb->expr()->literal('Gui%'))
public function notLike($x, $y); // Returns Expr\Comparison instance
// Example - $qb->expr()->between('u.id', '1', '10')
public function between($val, $x, $y); // Returns Expr\Func
/** Function objects **/
// Example - $qb->expr()->trim('u.firstname')
public function trim($x); // Returns Expr\Func
// Example - $qb->expr()->concat('u.firstname', $qb->expr()->concat($qb->expr()->literal(' '), 'u.lastname'))
public function concat($x, $y); // Returns Expr\Func
// Example - $qb->expr()->substring('u.firstname', 0, 1)
public function substring($x, $from, $len); // Returns Expr\Func
// Example - $qb->expr()->lower('u.firstname')
public function lower($x); // Returns Expr\Func
// Example - $qb->expr()->upper('u.firstname')
public function upper($x); // Returns Expr\Func
// Example - $qb->expr()->length('u.firstname')
public function length($x); // Returns Expr\Func
// Example - $qb->expr()->avg('u.age')
public function avg($x); // Returns Expr\Func
// Example - $qb->expr()->max('u.age')
public function max($x); // Returns Expr\Func
// Example - $qb->expr()->min('u.age')
public function min($x); // Returns Expr\Func
// Example - $qb->expr()->abs('u.currentBalance')
public function abs($x); // Returns Expr\Func
// Example - $qb->expr()->sqrt('u.currentBalance')
public function sqrt($x); // Returns Expr\Func
// Example - $qb->expr()->mod('u.currentBalance', '10')
public function mod($x); // Returns Expr\Func
// Example - $qb->expr()->count('u.firstname')
public function count($x); // Returns Expr\Func
// Example - $qb->expr()->countDistinct('u.surname')
public function countDistinct($x); // Returns Expr\Func
}
Adding a Criteria to a Query
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can also add a :ref:`filtering-collections` to a QueryBuilder by
using ``addCriteria``:
.. code-block:: php
<?php
use Doctrine\Common\Collections\Criteria;
// ...
$criteria = Criteria::create()
->orderBy(['firstName' => Criteria::ASC]);
// $qb instanceof QueryBuilder
$qb->addCriteria($criteria);
// then execute your query like normal
Low Level API
^^^^^^^^^^^^^
Now we will describe the low level method of creating queries.
It may be useful to work at this level for optimization purposes,
but most of the time it is preferred to work at a higher level of
abstraction.
All helper methods in ``QueryBuilder`` actually rely on a single
one: ``add()``. This method is responsible of building every piece
of DQL. It takes 3 parameters: ``$dqlPartName``, ``$dqlPart`` and
``$append`` (default=false)
- ``$dqlPartName``: Where the ``$dqlPart`` should be placed.
Possible values: select, from, where, groupBy, having, orderBy
- ``$dqlPart``: What should be placed in ``$dqlPartName``. Accepts
a string or any instance of ``Doctrine\ORM\Query\Expr\*``
- ``$append``: Optional flag (default=false) if the ``$dqlPart``
should override all previously defined items in ``$dqlPartName`` or
not (no effect on the ``where`` and ``having`` DQL query parts,
which always override all previously defined items)
.. code-block:: php
<?php
// $qb instanceof QueryBuilder
// example6: how to define:
// "SELECT u FROM User u WHERE u.id = ? ORDER BY u.name ASC"
// using QueryBuilder string support
$qb->add('select', 'u')
->add('from', 'User u')
->add('where', 'u.id = ?1')
->add('orderBy', 'u.name ASC');
Expr\* classes
^^^^^^^^^^^^^^
When you call ``add()`` with string, it internally evaluates to an
instance of ``Doctrine\ORM\Query\Expr\Expr\*`` class. Here is the
same query of example 6 written using
``Doctrine\ORM\Query\Expr\Expr\*`` classes:
.. code-block:: php
<?php
// $qb instanceof QueryBuilder
// example7: how to define:
// "SELECT u FROM User u WHERE u.id = ? ORDER BY u.name ASC"
// using QueryBuilder using Expr\* instances
$qb->add('select', new Expr\Select(array('u')))
->add('from', new Expr\From('User', 'u'))
->add('where', new Expr\Comparison('u.id', '=', '?1'))
->add('orderBy', new Expr\OrderBy('u.name', 'ASC'));

View File

@@ -0,0 +1,664 @@
The Second Level Cache
======================
.. note::
The second level cache functionality is marked as experimental for now. It
is a very complex feature and we cannot guarantee yet that it works stable
in all cases.
The Second Level Cache is designed to reduce the amount of necessary database access.
It sits between your application and the database to avoid the number of database hits as much as possible.
When turned on, entities will be first searched in cache and if they are not found,
a database query will be fired and then the entity result will be stored in a cache provider.
There are some flavors of caching available, but is better to cache read-only data.
Be aware that caches are not aware of changes made to the persistent store by another application.
They can, however, be configured to regularly expire cached data.
Caching Regions
---------------
Second level cache does not store instances of an entity, instead it caches only entity identifier and values.
Each entity class, collection association and query has its region, where values of each instance are stored.
Caching Regions are specific region into the cache provider that might store entities, collection or queries.
Each cache region resides in a specific cache namespace and has its own lifetime configuration.
Notice that when caching collection and queries only identifiers are stored.
The entity values will be stored in its own region
Something like below for an entity region:
.. code-block:: php
<?php
[
'region_name:entity_1_hash' => ['id' => 1, 'name' => 'FooBar', 'associationName' => null],
'region_name:entity_2_hash' => ['id' => 2, 'name' => 'Foo', 'associationName' => ['id' => 11]],
'region_name:entity_3_hash' => ['id' => 3, 'name' => 'Bar', 'associationName' => ['id' => 22]]
];
If the entity holds a collection that also needs to be cached.
An collection region could look something like:
.. code-block:: php
<?php
[
'region_name:entity_1_coll_assoc_name_hash' => ['ownerId' => 1, 'list' => [1, 2, 3]],
'region_name:entity_2_coll_assoc_name_hash' => ['ownerId' => 2, 'list' => [2, 3]],
'region_name:entity_3_coll_assoc_name_hash' => ['ownerId' => 3, 'list' => [2, 4]]
];
A query region might be something like:
.. code-block:: php
<?php
[
'region_name:query_1_hash' => ['list' => [1, 2, 3]],
'region_name:query_2_hash' => ['list' => [2, 3]],
'region_name:query_3_hash' => ['list' => [2, 4]]
];
.. note::
The following data structures represents now the cache will looks like, this is not actual cached data.
.. _reference-second-level-cache-regions:
Cache Regions
-------------
``Doctrine\ORM\Cache\Region\DefaultRegion`` is the default implementation.
A simplest cache region compatible with all doctrine-cache drivers but does not support locking.
``Doctrine\ORM\Cache\Region`` and ``Doctrine\ORM\Cache\ConcurrentRegion``
define contracts that should be implemented by a cache provider.
It allows you to provide your own cache implementation that might take advantage of specific cache driver.
If you want to support locking for ``READ_WRITE`` strategies you should implement ``ConcurrentRegion``; ``CacheRegion`` otherwise.
Cache region
~~~~~~~~~~~~
``Doctrine\ORM\Cache\Region`` defines a contract for accessing a particular
cache region.
Concurrent cache region
~~~~~~~~~~~~~~~~~~~~~~~
A ``Doctrine\ORM\Cache\ConcurrentRegion`` is designed to store concurrently managed data region.
By default, Doctrine provides a very simple implementation based on file locks ``Doctrine\ORM\Cache\Region\FileLockRegion``.
If you want to use an ``READ_WRITE`` cache, you should consider providing your own cache region.
``Doctrine\ORM\Cache\ConcurrentRegion`` defines a contract for concurrently managed data region.
Timestamp region
~~~~~~~~~~~~~~~~
``Doctrine\ORM\Cache\TimestampRegion``
Tracks the timestamps of the most recent updates to particular entity.
.. _reference-second-level-cache-mode:
Caching mode
------------
* ``READ_ONLY`` (DEFAULT)
* Can do reads, inserts and deletes, cannot perform updates or employ any locks.
* Useful for data that is read frequently but never updated.
* Best performer.
* It is Simple.
* ``NONSTRICT_READ_WRITE``
* Read Write Cache doesnt employ any locks but can do reads, inserts, updates and deletes.
* Good if the application needs to update data rarely.
* ``READ_WRITE``
* Read Write cache employs locks before update/delete.
* Use if data needs to be updated.
* Slowest strategy.
* To use it a the cache region implementation must support locking.
Built-in cached persisters
~~~~~~~~~~~~~~~~~~~~~~~~~~
Cached persisters are responsible to access cache regions.
+-----------------------+------------------------------------------------------------------------------------------+
| Cache Usage | Persister |
+=======================+==========================================================================================+
| READ_ONLY | ``Doctrine\ORM\Cache\Persister\Entity\ReadOnlyCachedEntityPersister`` |
+-----------------------+------------------------------------------------------------------------------------------+
| READ_WRITE | ``Doctrine\ORM\Cache\Persister\Entity\ReadWriteCachedEntityPersister`` |
+-----------------------+------------------------------------------------------------------------------------------+
| NONSTRICT_READ_WRITE | ``Doctrine\ORM\Cache\Persister\Entity\NonStrictReadWriteCachedEntityPersister`` |
+-----------------------+------------------------------------------------------------------------------------------+
| READ_ONLY | ``Doctrine\ORM\Cache\Persister\Collection\ReadOnlyCachedCollectionPersister`` |
+-----------------------+------------------------------------------------------------------------------------------+
| READ_WRITE | ``Doctrine\ORM\Cache\Persister\Collection\ReadWriteCachedCollectionPersister`` |
+-----------------------+------------------------------------------------------------------------------------------+
| NONSTRICT_READ_WRITE | ``Doctrine\ORM\Cache\Persister\Collection\NonStrictReadWriteCachedCollectionPersister`` |
+-----------------------+------------------------------------------------------------------------------------------+
Configuration
-------------
Doctrine allows you to specify configurations and some points of extension for the second-level-cache
Enable Second Level Cache
~~~~~~~~~~~~~~~~~~~~~~~~~
To enable the second-level-cache, you should provide a cache factory.
``Doctrine\ORM\Cache\DefaultCacheFactory`` is the default implementation.
.. code-block:: php
<?php
/** @var \Doctrine\ORM\Cache\RegionsConfiguration $cacheConfig */
/** @var \Psr\Cache\CacheItemPoolInterface $cache */
/** @var \Doctrine\ORM\Configuration $config */
$factory = new \Doctrine\ORM\Cache\DefaultCacheFactory($cacheConfig, $cache);
// Enable second-level-cache
$config->setSecondLevelCacheEnabled();
// Cache factory
$config->getSecondLevelCacheConfiguration()
->setCacheFactory($factory);
Cache Factory
~~~~~~~~~~~~~
Cache Factory is the main point of extension.
It allows you to provide a specific implementation of the following components:
``QueryCache``
stores and retrieves query cache results.
``CachedEntityPersister``
stores and retrieves entity results.
``CachedCollectionPersister``
stores and retrieves query results.
``EntityHydrator``
transforms entities into a cache entries and cache entries into entities
``CollectionHydrator``
transforms collections into cache entries and cache entries into collections
Region Lifetime
~~~~~~~~~~~~~~~
To specify a default lifetime for all regions or specify a different lifetime for a specific region.
.. code-block:: php
<?php
/** @var \Doctrine\ORM\Configuration $config */
/** @var \Doctrine\ORM\Cache\CacheConfiguration $cacheConfig */
/** @var \Doctrine\ORM\Cache\RegionsConfiguration $regionConfig */
$cacheConfig = $config->getSecondLevelCacheConfiguration();
$regionConfig = $cacheConfig->getRegionsConfiguration();
// Cache Region lifetime
$regionConfig->setLifetime('my_entity_region', 3600); // Time to live for a specific region (in seconds)
$regionConfig->setDefaultLifetime(7200); // Default time to live (in seconds)
Cache Log
~~~~~~~~~
By providing a cache logger you should be able to get information about all cache operations such as hits, misses and puts.
``Doctrine\ORM\Cache\Logging\StatisticsCacheLogger`` is a built-in implementation that provides basic statistics.
.. code-block:: php
<?php
/** @var \Doctrine\ORM\Configuration $config */
$logger = new \Doctrine\ORM\Cache\Logging\StatisticsCacheLogger();
// Cache logger
$config->setSecondLevelCacheEnabled(true);
$config->getSecondLevelCacheConfiguration()
->setCacheLogger($logger);
// Collect cache statistics
// Get the number of entries successfully retrieved from a specific region.
$logger->getRegionHitCount('my_entity_region');
// Get the number of cached entries *not* found in a specific region.
$logger->getRegionMissCount('my_entity_region');
// Get the number of cacheable entries put in cache.
$logger->getRegionPutCount('my_entity_region');
// Get the total number of put in all regions.
$logger->getPutCount();
// Get the total number of entries successfully retrieved from all regions.
$logger->getHitCount();
// Get the total number of cached entries *not* found in all regions.
$logger->getMissCount();
If you want to get more information you should implement
``Doctrine\ORM\Cache\Logging\CacheLogger`` and collect
all the information you want.
Entity cache definition
-----------------------
* Entity cache configuration allows you to define the caching strategy and region for an entity.
* ``usage`` specifies the caching strategy: ``READ_ONLY``,
``NONSTRICT_READ_WRITE``, ``READ_WRITE``.
See :ref:`reference-second-level-cache-mode`.
* ``region`` is an optional value that specifies the name of the second
level cache region.
.. configuration-block::
.. code-block:: attribute
<?php
#[Entity]
#[Cache(usage: 'READ_ONLY', region: 'my_entity_region')]
class Country
{
#[Id]
#[GeneratedValue]
#[Column]
protected int|null $id = null;
#[Column(unique: true)]
protected string $name;
// other properties and methods
}
.. code-block:: xml
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://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">
<generator strategy="IDENTITY"/>
</id>
<field name="name" type="string" column="name"/>
</entity>
</doctrine-mapping>
Association cache definition
----------------------------
The most common use case is to cache entities. But we can also cache relationships.
It caches the primary keys of association and cache each element will be cached into its region.
.. configuration-block::
.. code-block:: attribute
<?php
#[Entity]
#[Cache(usage: 'NONSTRICT_READ_WRITE')]
class State
{
#[Id]
#[GeneratedValue]
#[Column]
protected int|null $id = null;
#[Column(unique: true)]
protected string $name;
#[Cache(usage: 'NONSTRICT_READ_WRITE')]
#[ManyToOne(targetEntity: Country::class)]
#[JoinColumn(name: 'country_id', referencedColumnName: 'id')]
protected Country|null $country = null;
/** @var Collection<int, City> */
#[Cache(usage: 'NONSTRICT_READ_WRITE')]
#[OneToMany(targetEntity: City::class, mappedBy: 'state')]
protected Collection $cities;
// other properties and methods
}
.. code-block:: xml
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://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" />
<id name="id" type="integer" column="id">
<generator strategy="IDENTITY"/>
</id>
<field name="name" type="string" column="name"/>
<many-to-one field="country" target-entity="Country">
<cache usage="NONSTRICT_READ_WRITE" />
<join-columns>
<join-column name="country_id" referenced-column-name="id"/>
</join-columns>
</many-to-one>
<one-to-many field="cities" target-entity="City" mapped-by="state">
<cache usage="NONSTRICT_READ_WRITE"/>
</one-to-many>
</entity>
</doctrine-mapping>
.. note::
for this to work, the target entity must also be marked as cacheable.
Cache usage
~~~~~~~~~~~
Basic entity cache
.. code-block:: php
<?php
$em->persist(new Country($name));
$em->flush(); // Hit database to insert the row and put into cache
$em->clear(); // Clear entity manager
$country1 = $em->find('Country', 1); // Retrieve item from cache
$country1->setName('New Name');
$em->flush(); // Hit database to update the row and update cache
$em->clear(); // Clear entity manager
$country2 = $em->find('Country', 1); // Retrieve item from cache
// Notice that $country1 and $country2 are not the same instance.
Association cache
.. code-block:: php
<?php
// Hit database to insert the row and put into cache
$em->persist(new State($name, $country));
$em->flush();
// Clear entity manager
$em->clear();
// Retrieve item from cache
$state = $em->find('State', 1);
// Hit database to update the row and update cache entry
$state->setName('New Name');
$em->persist($state);
$em->flush();
// Create a new collection item
$city = new City($name, $state);
$state->addCity($city);
// Hit database to insert new collection item,
// put entity and collection cache into cache.
$em->persist($city);
$em->persist($state);
$em->flush();
// Clear entity manager
$em->clear();
// Retrieve item from cache
$state = $em->find('State', 1);
// Retrieve association from cache
$country = $state->getCountry();
// Retrieve collection from cache
$cities = $state->getCities();
echo $country->getName();
echo $state->getName();
// Retrieve each collection item from cache
foreach ($cities as $city) {
echo $city->getName();
}
.. note::
Notice that all entities should be marked as cacheable.
Using the query cache
---------------------
The second level cache stores the entities, associations and collections.
The query cache stores the results of the query but as identifiers, entity values are actually stored in the 2nd level cache.
.. note::
Query cache should always be used in conjunction with the second-level-cache for those entities which should be cached.
.. code-block:: php
<?php
/** @var \Doctrine\ORM\EntityManager $em */
// Execute database query, store query cache and entity cache
$result1 = $em->createQuery('SELECT c FROM Country c ORDER BY c.name')
->setCacheable(true)
->getResult();
$em->clear();
// Check if query result is valid and load entities from cache
$result2 = $em->createQuery('SELECT c FROM Country c ORDER BY c.name')
->setCacheable(true)
->getResult();
Cache mode
~~~~~~~~~~
The Cache Mode controls how a particular query interacts with the second-level cache:
* ``Cache::MODE_GET`` - May read items from the cache, but will not add items.
* ``Cache::MODE_PUT`` - Will never read items from the cache, but will add items to the cache as it reads them from the database.
* ``Cache::MODE_NORMAL`` - May read items from the cache, and add items to the cache.
* ``Cache::MODE_REFRESH`` - The query will never read items from the cache, but will refresh items to the cache as it reads them from the database.
.. code-block:: php
<?php
/** @var \Doctrine\ORM\EntityManager $em */
// Will refresh the query cache and all entities the cache as it reads from the database.
$result1 = $em->createQuery('SELECT c FROM Country c ORDER BY c.name')
->setCacheMode(\Doctrine\ORM\Cache::MODE_GET)
->setCacheable(true)
->getResult();
.. note::
The default query cache mode is ```Cache::MODE_NORMAL```
DELETE / UPDATE queries
~~~~~~~~~~~~~~~~~~~~~~~
DQL UPDATE / DELETE statements are ported directly into a database and bypass
the second-level cache.
Entities that are already cached will NOT be invalidated.
However the cached data could be evicted using the cache API or an special query hint.
Execute the ``UPDATE`` and invalidate ``all cache entries`` using ``Query::HINT_CACHE_EVICT``
.. code-block:: php
<?php
// Execute and invalidate
$this->_em->createQuery("UPDATE Entity\Country u SET u.name = 'unknown' WHERE u.id = 1")
->setHint(\Doctrine\ORM\Query::HINT_CACHE_EVICT, true)
->execute();
Execute the ``UPDATE`` and invalidate ``all cache entries`` using the cache API
.. code-block:: php
<?php
// Execute
$this->_em->createQuery("UPDATE Entity\Country u SET u.name = 'unknown' WHERE u.id = 1")
->execute();
// Invoke Cache API
$em->getCache()->evictEntityRegion('Entity\Country');
Execute the ``UPDATE`` and invalidate ``a specific cache entry`` using the cache API
.. code-block:: php
<?php
// Execute
$this->_em->createQuery("UPDATE Entity\Country u SET u.name = 'unknown' WHERE u.id = 1")
->execute();
// Invoke Cache API
$em->getCache()->evictEntity('Entity\Country', 1);
Using the repository query cache
--------------------------------
As well as ``Query Cache`` all persister queries store only identifier values for an individual query.
All persisters use a single timestamp cache region to keep track of the last update for each persister,
When a query is loaded from cache, the timestamp region is checked for the last update for that persister.
Using the last update timestamps as part of the query key invalidate the cache key when an update occurs.
.. code-block:: php
<?php
// load from database and store cache query key hashing the query + parameters + last timestamp cache region..
$entities = $em->getRepository('Entity\Country')->findAll();
// load from query and entities from cache..
$entities = $em->getRepository('Entity\Country')->findAll();
// update the timestamp cache region for Country
$em->persist(new Country('zombieland'));
$em->flush();
$em->clear();
// Reload from database.
// At this point the query cache key is no longer valid, the select goes straight to the database
$entities = $em->getRepository('Entity\Country')->findAll();
Cache API
---------
Caches are not aware of changes made by another application.
However, you can use the cache API to check / invalidate cache entries.
.. code-block:: php
<?php
/** @var \Doctrine\ORM\Cache $cache */
$cache = $em->getCache();
$cache->containsEntity('Entity\State', 1) // Check if the cache exists
$cache->evictEntity('Entity\State', 1); // Remove an entity from cache
$cache->evictEntityRegion('Entity\State'); // Remove all entities from cache
$cache->containsCollection('Entity\State', 'cities', 1); // Check if the cache exists
$cache->evictCollection('Entity\State', 'cities', 1); // Remove an entity collection from cache
$cache->evictCollectionRegion('Entity\State', 'cities'); // Remove all collections from cache
Limitations
-----------
Composite primary key
~~~~~~~~~~~~~~~~~~~~~
Composite primary key are supported by second level cache,
however when one of the keys is an association the cached entity should always be retrieved using the association identifier.
For performance reasons the cache API does not extract from composite primary key.
.. code-block:: php
<?php
#[Entity]
class Reference
{
#[Id]
#[ManyToOne(targetEntity: Article::class, inversedBy: 'references')]
#[JoinColumn(name: 'source_id', referencedColumnName: 'article_id')]
private Article|null $source = null;
#[Id]
#[ManyToOne(targetEntity: Article::class, inversedBy: 'references')]
#[JoinColumn(name: 'target_id', referencedColumnName: 'article_id')]
private $target;
}
// Supported
/** @var Article $article */
$article = $em->find('Article', 1);
// Supported
/** @var Article $article */
$article = $em->find('Article', $article);
// Supported
$id = ['source' => 1, 'target' => 2];
$reference = $em->find('Reference', $id);
// NOT Supported
$id = ['source' => new Article(1), 'target' => new Article(2)];
$reference = $em->find('Reference', $id);
Distributed environments
~~~~~~~~~~~~~~~~~~~~~~~~
Some cache driver are not meant to be used in a distributed environment.
Load-balancer for distributing workloads across multiple computing resources
should be used in conjunction with distributed caching system such as memcached, redis, riak ...
Caches should be used with care when using a load-balancer if you don't share the cache.
While using APC or any file based cache update occurred in a specific machine would not reflect to the cache in other machines.
Paginator
~~~~~~~~~
Count queries generated by ``Doctrine\ORM\Tools\Pagination\Paginator`` are not cached by second-level cache.
Although entities and query result are cached, count queries will hit the
database every time.

View File

@@ -0,0 +1,151 @@
Security
========
The Doctrine library is operating very close to your database and as such needs
to handle and make assumptions about SQL injection vulnerabilities.
It is vital that you understand how Doctrine approaches security, because
we cannot protect you from SQL injection.
Please also read the documentation chapter on Security in Doctrine DBAL. This
page only handles Security issues in the ORM.
- `DBAL Security Page <https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/security.html>`
If you find a Security bug in Doctrine, please follow our
`Security reporting guidelines <https://www.doctrine-project.org/policies/security.html#reporting>`_.
User input and Doctrine ORM
---------------------------
The ORM is much better at protecting against SQL injection than the DBAL alone.
You can consider the following APIs to be safe from SQL injection:
- ``\Doctrine\ORM\EntityManager#find()`` and ``getReference()``.
- All values on Objects inserted and updated through ``Doctrine\ORM\EntityManager#persist()``
- All find methods on ``Doctrine\ORM\EntityRepository``.
- User Input set to DQL Queries or QueryBuilder methods through
- ``setParameter()`` or variants
- ``setMaxResults()``
- ``setFirstResult()``
- Queries through the Criteria API on ``Doctrine\ORM\PersistentCollection`` and
``Doctrine\ORM\EntityRepository``.
You are **NOT** safe from SQL injection when using user input with:
- Expression API of ``Doctrine\ORM\QueryBuilder``
- Concatenating user input into DQL SELECT, UPDATE or DELETE statements or
Native SQL.
This means SQL injections can only occur with Doctrine ORM when working with
Query Objects of any kind. The safe rule is to always use prepared statement
parameters for user objects when using a Query object.
.. warning::
Insecure code follows, don't copy paste this.
The following example shows insecure DQL usage:
.. code-block:: php
<?php
// INSECURE
$dql = "SELECT u
FROM MyProject\Entity\User u
WHERE u.status = '" . $_GET['status'] . "'
ORDER BY " . $_GET['orderField'] . " ASC";
For Doctrine there is absolutely no way to find out which parts of ``$dql`` are
from user input and which are not, even if we have our own parsing process
this is technically impossible. The correct way is:
.. code-block:: php
<?php
$orderFieldWhitelist = array('email', 'username');
$orderField = "email";
if (in_array($_GET['orderField'], $orderFieldWhitelist)) {
$orderField = $_GET['orderField'];
}
$dql = "SELECT u
FROM MyProject\Entity\User u
WHERE u.status = ?1
ORDER BY u." . $orderField . " ASC";
$query = $entityManager->createQuery($dql);
$query->setParameter(1, $_GET['status']);
Preventing Mass Assignment Vulnerabilities
------------------------------------------
ORMs are very convenient for CRUD applications and Doctrine is no exception.
However CRUD apps are often vulnerable to mass assignment security problems
when implemented naively.
Doctrine is not vulnerable to this problem out of the box, but you can easily
make your entities vulnerable to mass assignment when you add methods of
the kind ``updateFromArray()`` or ``updateFromJson()`` to them. A vulnerable
entity might look like this:
.. code-block:: php
<?php
#[Entity]
class InsecureEntity
{
#[Id, Column, GeneratedValue]
private int|null $id = null;
#[Column]
private string $email;
#[Column]
private bool $isAdmin;
/** @param array<string, mixed> $userInput */
public function fromArray(array $userInput): void
{
foreach ($userInput as $key => $value) {
$this->$key = $value;
}
}
}
Now the possiblity of mass-assignment exists on this entity and can
be exploited by attackers to set the "isAdmin" flag to true on any
object when you pass the whole request data to this method like:
.. code-block:: php
<?php
$entity = new InsecureEntity();
$entity->fromArray($_POST);
$entityManager->persist($entity);
$entityManager->flush();
You can spot this problem in this very simple example easily. However
in combination with frameworks and form libraries it might not be
so obvious when this issue arises. Be careful to avoid this
kind of mistake.
How to fix this problem? You should always have a whitelist
of allowed key to set via mass assignment functions.
.. code-block:: php
public function fromArray(array $userInput, $allowedFields = array())
{
foreach ($userInput as $key => $value) {
if (in_array($key, $allowedFields)) {
$this->$key = $value;
}
}
}

326
docs/en/reference/tools.rst Normal file
View File

@@ -0,0 +1,326 @@
Tools
=====
Doctrine Console
----------------
The Doctrine Console is a Command Line Interface tool for simplifying common
administration tasks during the development of a project that uses ORM.
For the following examples, we will set up the CLI as ``bin/doctrine``.
Setting Up the Console
~~~~~~~~~~~~~~~~~~~~~~
Whenever the ``doctrine`` command line tool is invoked, it can
access all Commands that were registered by a developer. There is no
auto-detection mechanism at work. The Doctrine binary
already registers all the commands that currently ship with
Doctrine DBAL and ORM. If you want to use additional commands you
have to register them yourself.
All the commands of the Doctrine Console require access to the
``EntityManager``. You have to inject it into the console application.
Here is an example of a the project-specific ``bin/doctrine`` binary.
.. code-block:: php
#!/usr/bin/env php
<?php
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Doctrine\ORM\Tools\Console\EntityManagerProvider\SingleManagerProvider;
// replace with path to your own project bootstrap file
require_once 'bootstrap.php';
// replace with mechanism to retrieve EntityManager in your app
$entityManager = GetEntityManager();
$commands = [
// If you want to add your own custom console commands,
// you can do so here.
];
ConsoleRunner::run(
new SingleManagerProvider($entityManager),
$commands
);
.. note::
You have to adjust this snippet for your specific application or framework
and use their facilities to access the Doctrine EntityManager and
Connection Resources.
Display Help Information
~~~~~~~~~~~~~~~~~~~~~~~~
Type ``php bin/doctrine`` on the command line and you should see an
overview of the available commands or use the ``--help`` flag to get
information on the available commands. If you want to know more
about the use of generate entities for example, you can call:
::
$> php bin/doctrine orm:generate-entities --help
Command Overview
~~~~~~~~~~~~~~~~
The following Commands are currently available:
- ``help`` Displays help for a command (?)
- ``list`` Lists commands
- ``dbal:import`` Import SQL file(s) directly to Database.
- ``dbal:run-sql`` Executes arbitrary SQL directly from the
command line.
- ``orm:clear-cache:metadata`` Clear all metadata cache of the
various cache drivers.
- ``orm:clear-cache:query`` Clear all query cache of the various
cache drivers.
- ``orm:clear-cache:result`` Clear result cache of the various
cache drivers.
- ``orm:generate-proxies`` Generates proxy classes for entity
classes.
- ``orm:run-dql`` Executes arbitrary DQL directly from the command
line.
- ``orm:schema-tool:create`` Processes the schema and either
create it directly on EntityManager Storage Connection or generate
the SQL output.
- ``orm:schema-tool:drop`` Processes the schema and either drop
the database schema of EntityManager Storage Connection or generate
the SQL output.
- ``orm:schema-tool:update`` Processes the schema and either
update the database schema of EntityManager Storage Connection or
generate the SQL output.
The following alias is defined:
- ``orm:generate:proxies`` is alias for ``orm:generate-proxies``.
.. note::
Console also supports auto completion, for example, instead of
``orm:clear-cache:query`` you can use just ``o:c:q``.
Database Schema Generation
--------------------------
.. note::
SchemaTool can do harm to your database. It will drop or alter
tables, indexes, sequences and such. Please use this tool with
caution in development and not on a production server. It is meant
for helping you develop your Database Schema, but NOT with
migrating schema from A to B in production. A safe approach would
be generating the SQL on development server and saving it into SQL
Migration files that are executed manually on the production
server.
SchemaTool assumes your Doctrine Project uses the given database on
its own. Update and Drop commands will mess with other tables if
they are not related to the current project that is using Doctrine.
Please be careful!
To generate your database schema from your Doctrine mapping files
you can use the ``SchemaTool`` class or the ``schema-tool`` Console
Command.
When using the SchemaTool class directly, create your schema using
the ``createSchema()`` method. First create an instance of the
``SchemaTool`` and pass it an instance of the ``EntityManager``
that you want to use to create the schema. This method receives an
array of ``ClassMetadata`` instances.
.. code-block:: php
<?php
$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
$classes = array(
$em->getClassMetadata('Entities\User'),
$em->getClassMetadata('Entities\Profile')
);
$tool->createSchema($classes);
To drop the schema you can use the ``dropSchema()`` method.
.. code-block:: php
<?php
$tool->dropSchema($classes);
This drops all the tables that are currently used by your metadata
model. When you are changing your metadata a lot during development
you might want to drop the complete database instead of only the
tables of the current model to clean up with orphaned tables.
.. code-block:: php
<?php
$tool->dropSchema($classes, \Doctrine\ORM\Tools\SchemaTool::DROP_DATABASE);
You can also use database introspection to update your schema
easily with the ``updateSchema()`` method. It will compare your
existing database schema to the passed array of ``ClassMetadata``
instances.
.. code-block:: php
<?php
$tool->updateSchema($classes);
If you want to use this functionality from the command line you can
use the ``schema-tool`` command.
To create the schema use the ``create`` command:
.. code-block:: php
$ php bin/doctrine orm:schema-tool:create
To drop the schema use the ``drop`` command:
.. code-block:: php
$ php bin/doctrine orm:schema-tool:drop
If you want to drop and then recreate the schema then use both
options:
.. code-block:: php
$ php bin/doctrine orm:schema-tool:drop
$ php bin/doctrine orm:schema-tool:create
As you would think, if you want to update your schema use the
``update`` command:
.. code-block:: php
$ php bin/doctrine orm:schema-tool:update
All of the above commands also accept a ``--dump-sql`` option that
will output the SQL for the ran operation.
.. code-block:: php
$ php bin/doctrine orm:schema-tool:create --dump-sql
Runtime vs Development Mapping Validation
-----------------------------------------
For performance reasons Doctrine ORM has to skip some of the
necessary validation of metadata mappings. You have to execute
this validation in your development workflow to verify the
associations are correctly defined.
You can either use the Doctrine Command Line Tool:
.. code-block:: php
doctrine orm:validate-schema
If the validation fails, you can change the verbosity level to
check the detected errors:
doctrine orm:validate-schema -v
Or you can trigger the validation manually:
.. code-block:: php
<?php
use Doctrine\ORM\Tools\SchemaValidator;
$validator = new SchemaValidator($entityManager);
$errors = $validator->validateMapping();
if (count($errors) > 0) {
// Lots of errors!
echo implode("\n\n", $errors);
}
If the mapping is invalid the errors array contains a positive
number of elements with error messages.
.. warning::
One mapping option that is not validated is the use of the referenced column name.
It has to point to the equivalent primary key otherwise Doctrine will not work.
.. note::
One common error is to use a backlash in front of the
fully-qualified class-name. Whenever a FQCN is represented inside a
string (such as in your mapping definitions) you have to drop the
prefix backslash. PHP does this with ``get_class()`` or Reflection
methods for backwards compatibility reasons.
Adding own commands
-------------------
You can also add your own commands on-top of the Doctrine supported
tools if you are using a manually built console script.
To include a new command on Doctrine Console, you need to do modify the
``doctrine.php`` file a little:
.. code-block:: php
<?php
// doctrine.php
use Symfony\Component\Console\Application;
// as before ...
// replace the ConsoleRunner::run() statement with:
$cli = new Application('Doctrine Command Line Interface', \Doctrine\ORM\Version::VERSION);
$cli->setCatchExceptions(true);
$cli->setHelperSet($helperSet);
// Register All Doctrine Commands
ConsoleRunner::addCommands($cli);
// Register your own command
$cli->addCommand(new \MyProject\Tools\Console\Commands\MyCustomCommand);
// Runs console application
$cli->run();
Additionally, include multiple commands (and overriding previously
defined ones) is possible through the command:
.. code-block:: php
<?php
$cli->addCommands(array(
new \MyProject\Tools\Console\Commands\MyCustomCommand(),
new \MyProject\Tools\Console\Commands\SomethingCommand(),
new \MyProject\Tools\Console\Commands\AnotherCommand(),
new \MyProject\Tools\Console\Commands\OneMoreCommand(),
));
Re-use console application
--------------------------
You are also able to retrieve and re-use the default console application.
Just call ``ConsoleRunner::createApplication(...)`` with an appropriate
HelperSet, like it is described in the configuration section.
.. code-block:: php
<?php
// Retrieve default console application
$cli = ConsoleRunner::createApplication($helperSet);
// Runs console application
$cli->run();

View File

@@ -0,0 +1,393 @@
Transactions and Concurrency
============================
.. _transactions-and-concurrency_transaction-demarcation:
Transaction Demarcation
-----------------------
Transaction demarcation is the task of defining your transaction
boundaries. Proper transaction demarcation is very important
because if not done properly it can negatively affect the
performance of your application. Many databases and database
abstraction layers like PDO by default operate in auto-commit mode,
which means that every single SQL statement is wrapped in a small
transaction. Without any explicit transaction demarcation from your
side, this quickly results in poor performance because transactions
are not cheap.
For the most part, Doctrine ORM already takes care of proper
transaction demarcation for you: All the write operations
(INSERT/UPDATE/DELETE) are queued until ``EntityManager#flush()``
is invoked which wraps all of these changes in a single
transaction.
However, Doctrine ORM also allows (and encourages) you to take over
and control transaction demarcation yourself.
These are two ways to deal with transactions when using the
Doctrine ORM and are now described in more detail.
.. _transactions-and-concurrency_approach-implicitly:
Approach 1: Implicitly
~~~~~~~~~~~~~~~~~~~~~~
The first approach is to use the implicit transaction handling
provided by the Doctrine ORM EntityManager. Given the following
code snippet, without any explicit transaction demarcation:
.. code-block:: php
<?php
// $em instanceof EntityManager
$user = new User;
$user->setName('George');
$em->persist($user);
$em->flush();
Since we do not do any custom transaction demarcation in the above
code, ``EntityManager#flush()`` will begin and commit/rollback a
transaction. This behavior is made possible by the aggregation of
the DML operations by the Doctrine ORM and is sufficient if all the
data manipulation that is part of a unit of work happens through
the domain model and thus the ORM.
.. _transactions-and-concurrency_approach-explicitly:
Approach 2: Explicitly
~~~~~~~~~~~~~~~~~~~~~~
The explicit alternative is to use the ``Doctrine\DBAL\Connection``
API directly to control the transaction boundaries. The code then
looks like this:
.. code-block:: php
<?php
// $em instanceof EntityManager
$em->getConnection()->beginTransaction(); // suspend auto-commit
try {
// ... do some work
$user = new User;
$user->setName('George');
$em->persist($user);
$em->flush();
$em->getConnection()->commit();
} catch (Exception $e) {
$em->getConnection()->rollBack();
throw $e;
}
Explicit transaction demarcation is required when you want to
include custom DBAL operations in a unit of work or when you want
to make use of some methods of the ``EntityManager`` API that
require an active transaction. Such methods will throw a
``TransactionRequiredException`` to inform you of that
requirement.
A more convenient alternative for explicit transaction demarcation is the use
of provided control abstractions in the form of
``Connection#transactional($func)`` and ``EntityManager#transactional($func)``.
When used, these control abstractions ensure that you never forget to rollback
the transaction, in addition to the obvious code reduction. An example that is
functionally equivalent to the previously shown code looks as follows:
.. code-block:: php
<?php
// $em instanceof EntityManager
$em->transactional(function($em) {
// ... do some work
$user = new User;
$user->setName('George');
$em->persist($user);
});
.. warning::
For historical reasons, ``EntityManager#transactional($func)`` will return
``true`` whenever the return value of ``$func`` is loosely false.
Some examples of this include ``array()``, ``"0"``, ``""``, ``0``, and
``null``.
The difference between ``Connection#transactional($func)`` and
``EntityManager#transactional($func)`` is that the latter
abstraction flushes the ``EntityManager`` prior to transaction
commit and in case of an exception the ``EntityManager`` gets closed
in addition to the transaction rollback.
.. _transactions-and-concurrency_exception-handling:
Exception Handling
~~~~~~~~~~~~~~~~~~
When using implicit transaction demarcation and an exception occurs
during ``EntityManager#flush()``, the transaction is automatically
rolled back and the ``EntityManager`` closed.
When using explicit transaction demarcation and an exception
occurs, the transaction should be rolled back immediately and the
``EntityManager`` closed by invoking ``EntityManager#close()`` and
subsequently discarded, as demonstrated in the example above. This
can be handled elegantly by the control abstractions shown earlier.
Note that when catching ``Exception`` you should generally re-throw
the exception. If you intend to recover from some exceptions, catch
them explicitly in earlier catch blocks (but do not forget to
rollback the transaction and close the ``EntityManager`` there as
well). All other best practices of exception handling apply
similarly (i.e. either log or re-throw, not both, etc.).
As a result of this procedure, all previously managed or removed
instances of the ``EntityManager`` become detached. The state of
the detached objects will be the state at the point at which the
transaction was rolled back. The state of the objects is in no way
rolled back and thus the objects are now out of synch with the
database. The application can continue to use the detached objects,
knowing that their state is potentially no longer accurate.
If you intend to start another unit of work after an exception has
occurred you should do that with a new ``EntityManager``.
.. _transactions-and-concurrency_locking-support:
Locking Support
---------------
Doctrine ORM offers support for Pessimistic- and Optimistic-locking
strategies natively. This allows to take very fine-grained control
over what kind of locking is required for your Entities in your
application.
.. _transactions-and-concurrency_optimistic-locking:
Optimistic Locking
~~~~~~~~~~~~~~~~~~
Database transactions are fine for concurrency control during a
single request. However, a database transaction should not span
across requests, the so-called "user think time". Therefore a
long-running "business transaction" that spans multiple requests
needs to involve several database transactions. Thus, database
transactions alone can no longer control concurrency during such a
long-running business transaction. Concurrency control becomes the
partial responsibility of the application itself.
Doctrine has integrated support for automatic optimistic locking
via a version field. In this approach any entity that should be
protected against concurrent modifications during long-running
business transactions gets a version field that is either a simple
number (mapping type: integer) or a timestamp (mapping type:
datetime). When changes to such an entity are persisted at the end
of a long-running conversation the version of the entity is
compared to the version in the database and if they don't match, an
``OptimisticLockException`` is thrown, indicating that the entity
has been modified by someone else already.
You designate a version field in an entity as follows. In this
example we'll use an integer.
.. configuration-block::
.. code-block:: attribute
<?php
class User
{
// ...
#[Version, Column(type: 'integer')]
private int $version;
// ...
}
.. code-block:: xml
<doctrine-mapping>
<entity name="User">
<field name="version" type="integer" version="true" />
</entity>
</doctrine-mapping>
Alternatively a datetime type can be used (which maps to a SQL
timestamp or datetime):
.. configuration-block::
.. code-block:: attribute
<?php
class User
{
// ...
#[Version, Column(type: 'datetime')]
private DateTime $version;
// ...
}
.. code-block:: xml
<doctrine-mapping>
<entity name="User">
<field name="version" type="datetime" version="true" />
</entity>
</doctrine-mapping>
Version numbers (not timestamps) should however be preferred as
they can not potentially conflict in a highly concurrent
environment, unlike timestamps where this is a possibility,
depending on the resolution of the timestamp on the particular
database platform.
When a version conflict is encountered during
``EntityManager#flush()``, an ``OptimisticLockException`` is thrown
and the active transaction rolled back (or marked for rollback).
This exception can be caught and handled. Potential responses to an
OptimisticLockException are to present the conflict to the user or
to refresh or reload objects in a new transaction and then retrying
the transaction.
With PHP promoting a share-nothing architecture, the time between
showing an update form and actually modifying the entity can in the
worst scenario be as long as your applications session timeout. If
changes happen to the entity in that time frame you want to know
directly when retrieving the entity that you will hit an optimistic
locking exception:
You can always verify the version of an entity during a request
either when calling ``EntityManager#find()``:
.. code-block:: php
<?php
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\OptimisticLockException;
$theEntityId = 1;
$expectedVersion = 184;
try {
$entity = $em->find('User', $theEntityId, LockMode::OPTIMISTIC, $expectedVersion);
// do the work
$em->flush();
} catch(OptimisticLockException $e) {
echo "Sorry, but someone else has already changed this entity. Please apply the changes again!";
}
Or you can use ``EntityManager#lock()`` to find out:
.. code-block:: php
<?php
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\OptimisticLockException;
$theEntityId = 1;
$expectedVersion = 184;
$entity = $em->find('User', $theEntityId);
try {
// assert version
$em->lock($entity, LockMode::OPTIMISTIC, $expectedVersion);
} catch(OptimisticLockException $e) {
echo "Sorry, but someone else has already changed this entity. Please apply the changes again!";
}
Important Implementation Notes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can easily get the optimistic locking workflow wrong if you
compare the wrong versions. Say you have Alice and Bob editing a
hypothetical blog post:
- Alice reads the headline of the blog post being "Foo", at
optimistic lock version 1 (GET Request)
- Bob reads the headline of the blog post being "Foo", at
optimistic lock version 1 (GET Request)
- Bob updates the headline to "Bar", upgrading the optimistic lock
version to 2 (POST Request of a Form)
- Alice updates the headline to "Baz", ... (POST Request of a
Form)
Now at the last stage of this scenario the blog post has to be read
again from the database before Alice's headline can be applied. At
this point you will want to check if the blog post is still at
version 1 (which it is not in this scenario).
Using optimistic locking correctly, you *have* to add the version
as an additional hidden field (or into the SESSION for more
safety). Otherwise you cannot verify the version is still the one
being originally read from the database when Alice performed her
GET request for the blog post. If this happens you might see lost
updates you wanted to prevent with Optimistic Locking.
See the example code, The form (GET Request):
.. code-block:: php
<?php
$post = $em->find('BlogPost', 123456);
echo '<input type="hidden" name="id" value="' . $post->getId() . '" />';
echo '<input type="hidden" name="version" value="' . $post->getCurrentVersion() . '" />';
And the change headline action (POST Request):
.. code-block:: php
<?php
$postId = (int)$_GET['id'];
$postVersion = (int)$_GET['version'];
$post = $em->find('BlogPost', $postId, \Doctrine\DBAL\LockMode::OPTIMISTIC, $postVersion);
.. _transactions-and-concurrency_pessimistic-locking:
Pessimistic Locking
~~~~~~~~~~~~~~~~~~~
Doctrine ORM supports Pessimistic Locking at the database level. No
attempt is being made to implement pessimistic locking inside
Doctrine, rather vendor-specific and ANSI-SQL commands are used to
acquire row-level locks. Every Entity can be part of a pessimistic
lock, there is no special metadata required to use this feature.
However for Pessimistic Locking to work you have to disable the
Auto-Commit Mode of your Database and start a transaction around
your pessimistic lock use-case using the "Approach 2: Explicit
Transaction Demarcation" described above. Doctrine ORM will throw an
Exception if you attempt to acquire an pessimistic lock and no
transaction is running.
Doctrine ORM currently supports two pessimistic lock modes:
- Pessimistic Write
(``Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE``), locks the
underlying database rows for concurrent Read and Write Operations.
- Pessimistic Read (``Doctrine\DBAL\LockMode::PESSIMISTIC_READ``),
locks other concurrent requests that attempt to update or lock rows
in write mode.
You can use pessimistic locks in four different scenarios:
1. Using
``EntityManager#find($className, $id, \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE)``
or
``EntityManager#find($className, $id, \Doctrine\DBAL\LockMode::PESSIMISTIC_READ)``
2. Using
``EntityManager#lock($entity, \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE)``
or
``EntityManager#lock($entity, \Doctrine\DBAL\LockMode::PESSIMISTIC_READ)``
3. Using
``EntityManager#refresh($entity, \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE)``
or
``EntityManager#refresh($entity, \Doctrine\DBAL\LockMode::PESSIMISTIC_READ)``
4. Using
``Query#setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE)``
or
``Query#setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_READ)``

View File

@@ -0,0 +1,164 @@
Implementing a TypedFieldMapper
===============================
.. versionadded:: 2.14
You can specify custom typed field mapping between PHP type and DBAL type using ``Doctrine\ORM\Configuration``
and a custom ``Doctrine\ORM\Mapping\TypedFieldMapper`` implementation.
.. code-block:: php
<?php
$configuration->setTypedFieldMapper(new CustomTypedFieldMapper());
DefaultTypedFieldMapper
-----------------------
By default the ``Doctrine\ORM\Mapping\DefaultTypedFieldMapper`` is used, and you can pass an array of
PHP type => DBAL type mappings into its constructor to override the default behavior or add new mappings.
.. code-block:: php
<?php
use App\CustomIds\CustomIdObject;
use App\DBAL\Type\CustomIdObjectType;
use Doctrine\ORM\Mapping\DefaultTypedFieldMapper;
$configuration->setTypedFieldMapper(new DefaultTypedFieldMapper([
CustomIdObject::class => CustomIdObjectType::class,
]));
Then, an entity using the ``CustomIdObject`` typed field will be correctly assigned its DBAL type
(``CustomIdObjectType``) without the need of explicit declaration.
.. configuration-block::
.. code-block:: attribute
<?php
#[ORM\Entity]
#[ORM\Table(name: 'cms_users_typed_with_custom_typed_field')]
class UserTypedWithCustomTypedField
{
#[ORM\Column]
public CustomIdObject $customId;
// ...
}
.. code-block:: xml
<doctrine-mapping>
<entity name="UserTypedWithCustomTypedField">
<field name="customId"/>
<!-- -->
</entity>
</doctrine-mapping>
.. code-block:: yaml
UserTypedWithCustomTypedField:
type: entity
fields:
customId: ~
It is perfectly valid to override even the "automatic" mapping rules mentioned above:
.. code-block:: php
<?php
use App\DBAL\Type\CustomIntType;
use Doctrine\ORM\Mapping\DefaultTypedFieldMapper;
$configuration->setTypedFieldMapper(new DefaultTypedFieldMapper([
'int' => CustomIntType::class,
]));
.. note::
If chained, once the first ``TypedFieldMapper`` assigns a type to a field, the ``DefaultTypedFieldMapper`` will
ignore its mapping and not override it anymore (if it is later in the chain). See below for chaining type mappers.
TypedFieldMapper interface
-------------------------
The interface ``Doctrine\ORM\Mapping\TypedFieldMapper`` allows you to implement your own
typed field mapping logic. It consists of just one function
.. code-block:: php
<?php
/**
* Validates & completes the given field mapping based on typed property.
*
* @param array{fieldName: string, enumType?: string, type?: mixed} $mapping The field mapping to validate & complete.
* @param \ReflectionProperty $field
*
* @return array{fieldName: string, enumType?: string, type?: mixed} The updated mapping.
*/
public function validateAndComplete(array $mapping, ReflectionProperty $field): array;
ChainTypedFieldMapper
---------------------
The class ``Doctrine\ORM\Mapping\ChainTypedFieldMapper`` allows you to chain multiple ``TypedFieldMapper`` instances.
When being evaluated, the ``TypedFieldMapper::validateAndComplete`` is called in the order in which
the instances were supplied to the ``ChainTypedFieldMapper`` constructor.
.. code-block:: php
<?php
use App\DBAL\Type\CustomIntType;
use Doctrine\ORM\Mapping\ChainTypedFieldMapper;
use Doctrine\ORM\Mapping\DefaultTypedFieldMapper;
$configuration->setTypedFieldMapper(
new ChainTypedFieldMapper(
new DefaultTypedFieldMapper(['int' => CustomIntType::class,]),
new CustomTypedFieldMapper()
)
);
Implementing a TypedFieldMapper
-------------------------------
If you want to assign all ``BackedEnum`` fields to your custom ``BackedEnumDBALType`` or you want to use different
DBAL types based on whether the entity field is nullable or not, you can achieve this by implementing your own
typed field mapper.
You need to create a class which implements ``Doctrine\ORM\Mapping\TypedFieldMapper``.
.. code-block:: php
<?php
final class CustomEnumTypedFieldMapper implements TypedFieldMapper
{
/**
* {@inheritDoc}
*/
public function validateAndComplete(array $mapping, ReflectionProperty $field): array
{
$type = $field->getType();
if (
! isset($mapping['type'])
&& ($type instanceof ReflectionNamedType)
) {
if (! $type->isBuiltin() && enum_exists($type->getName())) {
$mapping['type'] = BackedEnumDBALType::class;
}
}
return $mapping;
}
}
.. note::
Note that this case checks whether the mapping is already assigned, and if yes, it skips it. This is up to your
implementation. You can make a "greedy" mapper which will always override the mapping with its own type, or one
that behaves like the ``DefaultTypedFieldMapper`` and does not modify the type once its set prior in the chain.

View File

@@ -0,0 +1,60 @@
Association Updates: Owning Side and Inverse Side
=================================================
When mapping bidirectional associations it is important to
understand the concept of the owning and inverse sides. The
following general rules apply:
- Relationships may be bidirectional or unidirectional.
- A bidirectional relationship has both an owning side and an inverse side
- A unidirectional relationship only has an owning side.
- Doctrine will **only** check the owning side of an association for changes.
Bidirectional Associations
--------------------------
The following rules apply to **bidirectional** associations:
- The inverse side has to have the ``mappedBy`` attribute of the OneToOne,
OneToMany, or ManyToMany mapping declaration. The ``mappedBy``
attribute contains the name of the association-field on the owning side.
- The owning side has to have the ``inversedBy`` attribute of the
OneToOne, ManyToOne, or ManyToMany mapping declaration.
The ``inversedBy`` attribute contains the name of the association-field
on the inverse-side.
- ManyToOne is always the owning side of a bidirectional association.
- OneToMany is always the inverse side of a bidirectional association.
- The owning side of a OneToOne association is the entity with the table
containing the foreign key.
- You can pick the owning side of a many-to-many association yourself.
Important concepts
------------------
**Doctrine will only check the owning side of an association for changes.**
To fully understand this, remember how bidirectional associations
are maintained in the object world. There are 2 references on each
side of the association and these 2 references both represent the
same association but can change independently of one another. Of
course, in a correct application the semantics of the bidirectional
association are properly maintained by the application developer
(that's their responsibility). Doctrine needs to know which of these
two in-memory references is the one that should be persisted and
which not. This is what the owning/inverse concept is mainly used
for.
**Changes made only to the inverse side of an association are ignored. Make sure to update both sides of a bidirectional association (or at least the owning side, from Doctrine's point of view)**
The owning side of a bidirectional association is the side Doctrine
"looks at" when determining the state of the association, and
consequently whether there is anything to do to update the
association in the database.
.. note::
"Owning side" and "inverse side" are technical concepts of
the ORM technology, not concepts of your domain model. What you
consider as the owning side in your domain model can be different
from what the owning side is for Doctrine. These are unrelated.

View File

@@ -0,0 +1,198 @@
Doctrine Internals explained
============================
Object relational mapping is a complex topic and sufficiently understanding how Doctrine works internally helps you use its full power.
How Doctrine keeps track of Objects
-----------------------------------
Doctrine uses the Identity Map pattern to track objects. Whenever you fetch an
object from the database, Doctrine will keep a reference to this object inside
its UnitOfWork. The array holding all the entity references is two-levels deep
and has the keys "root entity name" and "id". Since Doctrine allows composite
keys the id is a sorted, serialized version of all the key columns.
This allows Doctrine room for optimizations. If you call the EntityManager and
ask for an entity with a specific ID twice, it will return the same instance:
.. code-block:: php
public function testIdentityMap(): void
{
$objectA = $this->entityManager->find('EntityName', 1);
$objectB = $this->entityManager->find('EntityName', 1);
$this->assertSame($objectA, $objectB)
}
Only one SELECT query will be fired against the database here. In the second
``EntityManager#find()`` call Doctrine will check the identity map first and
doesn't need to make that database roundtrip.
Even if you get a proxy object first then fetch the object by the same id you
will still end up with the same reference:
.. code-block:: php
public function testIdentityMapReference(): void
{
$objectA = $this->entityManager->getReference('EntityName', 1);
// check entity is not initialized
$this->assertTrue($this->entityManager->isUninitializedObject($objectA));
$objectB = $this->entityManager->find('EntityName', 1);
$this->assertSame($objectA, $objectB)
}
The identity map being indexed by primary keys only allows shortcuts when you
ask for objects by primary key. Assume you have the following ``persons``
table:
::
id | name
-------------
1 | Benjamin
2 | Bud
Take the following example where two
consecutive calls are made against a repository to fetch an entity by a set of
criteria:
.. code-block:: php
public function testIdentityMapRepositoryFindBy()
{
$repository = $this->entityManager->getRepository('Person');
$objectA = $repository->findOneBy(array('name' => 'Benjamin'));
$objectB = $repository->findOneBy(array('name' => 'Benjamin'));
$this->assertSame($objectA, $objectB);
}
This query will still return the same references and `$objectA` and `$objectB`
are indeed referencing the same object. However when checking your SQL logs you
will realize that two queries have been executed against the database. Doctrine
only knows objects by id, so a query for different criteria has to go to the
database, even if it was executed just before.
But instead of creating a second Person object Doctrine first gets the primary
key from the row and check if it already has an object inside the UnitOfWork
with that primary key. In our example it finds an object and decides to return
this instead of creating a new one.
The identity map has a second use-case. When you call ``EntityManager#flush``
Doctrine will ask the identity map for all objects that are currently managed.
This means you don't have to call ``EntityManager#persist`` over and over again
to pass known objects to the EntityManager. This is a NO-OP for known entities,
but leads to much code written that is confusing to other developers.
The following code WILL update your database with the changes made to the
``Person`` object, even if you did not call ``EntityManager#persist``:
.. code-block:: php
<?php
$user = $entityManager->find("Person", 1);
$user->setName("Guilherme");
$entityManager->flush();
How Doctrine Detects Changes
----------------------------
Doctrine is a data-mapper that tries to achieve persistence-ignorance (PI).
This means you map php objects into a relational database that don't
necessarily know about the database at all. A natural question would now be,
"how does Doctrine even detect objects have changed?".
For this Doctrine keeps a second map inside the UnitOfWork. Whenever you fetch
an object from the database Doctrine will keep a copy of all the properties and
associations inside the UnitOfWork. Because variables in the PHP language are
subject to "copy-on-write" the memory usage of a PHP request that only reads
objects from the database is the same as if Doctrine did not keep this variable
copy. Only if you start changing variables PHP will create new variables internally
that consume new memory.
Now whenever you call ``EntityManager#flush`` Doctrine will iterate over the
Identity Map and for each object compares the original property and association
values with the values that are currently set on the object. If changes are
detected then the object is queued for a SQL UPDATE operation. Only the fields
that actually changed are updated.
This process has an obvious performance impact. The larger the size of the
UnitOfWork is, the longer this computation takes. There are several ways to
optimize the performance of the Flush Operation:
- Mark entities as read only. These entities can only be inserted or removed,
but are never updated. They are omitted in the changeset calculation.
- Temporarily mark entities as read only. If you have a very large UnitOfWork
but know that a large set of entities has not changed, just mark them as read
only with ``$entityManager->getUnitOfWork()->markReadOnly($entity)``.
- Use :doc:`Change Tracking Policies <change-tracking-policies>` to use more
explicit strategies of notifying the UnitOfWork what objects/properties
changed.
Query Internals
---------------
The different ORM Layers
------------------------
Doctrine ships with a set of layers with different responsibilities. This
section gives a short explanation of each layer.
Hydration
~~~~~~~~~
Responsible for creating a final result from a raw database statement and a
result-set mapping object. The developer can choose which kind of result they
wish to be hydrated. Default result-types include:
- SQL to Entities
- SQL to structured Arrays
- SQL to simple scalar result arrays
- SQL to a single result variable
Hydration to entities and arrays is one of the most complex parts of Doctrine
algorithm-wise. It can build results with for example:
- Single table selects
- Joins with n:1 or 1:n cardinality, grouping belonging to the same parent.
- Mixed results of objects and scalar values
- Hydration of results by a given scalar value as key.
Persisters
~~~~~~~~~~
tbr
UnitOfWork
~~~~~~~~~~
tbr
ResultSetMapping
~~~~~~~~~~~~~~~~
tbr
DQL Parser
~~~~~~~~~~
tbr
SQLWalker
~~~~~~~~~
tbr
EntityManager
~~~~~~~~~~~~~
tbr
ClassMetadataFactory
~~~~~~~~~~~~~~~~~~~~
tbr

View File

@@ -0,0 +1,741 @@
Working with Associations
=========================
Associations between entities are represented just like in regular
object-oriented PHP code using references to other objects or
collections of objects.
Changes to associations in your code are not synchronized to the
database directly, only when calling ``EntityManager#flush()``.
There are other concepts you should know about when working
with associations in Doctrine:
- If an entity is removed from a collection, the association is
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 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
``Doctrine\Common\Collections\Collection`` interface.
Association Example Entities
----------------------------
We will use a simple comment system with Users and Comments as
entities to show examples of association management. See the PHP
docblocks of each association in the following example for
information about its type and if it's the owning or inverse side.
.. code-block:: php
<?php
#[Entity]
class User
{
#[Id, GeneratedValue, Column]
private int|null $id = null;
/**
* Bidirectional - Many users have Many favorite comments (OWNING SIDE)
*
* @var Collection<int, Comment>
*/
#[ManyToMany(targetEntity: Comment::class, inversedBy: 'userFavorites')]
#[JoinTable(name: 'user_favorite_comments')]
private Collection $favorites;
/**
* Unidirectional - Many users have marked many comments as read
*
* @var Collection<int, Comment>
*/
#[ManyToMany(targetEntity: Comment::class)]
#[JoinTable(name: 'user_read_comments')]
private Collection $commentsRead;
/**
* Bidirectional - One-To-Many (INVERSE SIDE)
*
* @var Collection<int, Comment>
*/
#[OneToMany(targetEntity: Comment::class, mappedBy: 'author')]
private Collection $commentsAuthored;
/** Unidirectional - Many-To-One */
#[ManyToOne(targetEntity: Comment::class)]
private Comment|null $firstComment = null;
}
#[Entity]
class Comment
{
#[Id, GeneratedValue, Column]
private string $id;
/**
* Bidirectional - Many comments are favorited by many users (INVERSE SIDE)
*
* @var Collection<int, User>
*/
#[ManyToMany(targetEntity: User::class, mappedBy: 'favorites')]
private Collection $userFavorites;
/**
* Bidirectional - Many Comments are authored by one user (OWNING SIDE)
*/
#[ManyToOne(targetEntity: User::class, inversedBy: 'commentsAuthored')]
private User|null $author = null;
}
This two entities generate the following MySQL Schema (Foreign Key
definitions omitted):
.. code-block:: sql
CREATE TABLE User (
id VARCHAR(255) NOT NULL,
firstComment_id VARCHAR(255) DEFAULT NULL,
PRIMARY KEY(id)
) ENGINE = InnoDB;
CREATE TABLE Comment (
id VARCHAR(255) NOT NULL,
author_id VARCHAR(255) DEFAULT NULL,
PRIMARY KEY(id)
) ENGINE = InnoDB;
CREATE TABLE user_favorite_comments (
user_id VARCHAR(255) NOT NULL,
favorite_comment_id VARCHAR(255) NOT NULL,
PRIMARY KEY(user_id, favorite_comment_id)
) ENGINE = InnoDB;
CREATE TABLE user_read_comments (
user_id VARCHAR(255) NOT NULL,
comment_id VARCHAR(255) NOT NULL,
PRIMARY KEY(user_id, comment_id)
) ENGINE = InnoDB;
Establishing Associations
-------------------------
Establishing an association between two entities is
straight-forward. Here are some examples for the unidirectional
relations of the ``User``:
.. code-block:: php
<?php
class User
{
// ...
/** @return Collection<int, Comment> */
public function getReadComments(): Collection {
return $this->commentsRead;
}
public function setFirstComment(Comment $c): void {
$this->firstComment = $c;
}
}
The interaction code would then look like in the following snippet
(``$em`` here is an instance of the EntityManager):
.. code-block:: php
<?php
$user = $em->find('User', $userId);
// unidirectional many to many
$comment = $em->find('Comment', $readCommentId);
$user->getReadComments()->add($comment);
$em->flush();
// unidirectional many to one
$myFirstComment = new Comment();
$user->setFirstComment($myFirstComment);
$em->persist($myFirstComment);
$em->flush();
In the case of bi-directional associations you have to update the
fields on both sides:
.. code-block:: php
<?php
class User
{
// ..
/** @return Collection<int, Comment> */
public function getAuthoredComments(): Collection {
return $this->commentsAuthored;
}
/** @return Collection<int, Comment> */
public function getFavoriteComments(): Collection {
return $this->favorites;
}
}
class Comment
{
// ...
/** @return Collection<int, User> */
public function getUserFavorites(): Collection {
return $this->userFavorites;
}
public function setAuthor(User|null $author = null): void {
$this->author = $author;
}
}
// Many-to-Many
$user->getFavorites()->add($favoriteComment);
$favoriteComment->getUserFavorites()->add($user);
$em->flush();
// Many-To-One / One-To-Many Bidirectional
$newComment = new Comment();
$user->getAuthoredComments()->add($newComment);
$newComment->setAuthor($user);
$em->persist($newComment);
$em->flush();
Notice how always both sides of the bidirectional association are
updated. The previous unidirectional associations were simpler to
handle.
Removing Associations
---------------------
Removing an association between two entities is similarly
straight-forward. There are two strategies to do so, by key and by
element. Here are some examples:
.. code-block:: php
<?php
// Remove by Elements
$user->getComments()->removeElement($comment);
$comment->setAuthor(null);
$user->getFavorites()->removeElement($comment);
$comment->getUserFavorites()->removeElement($user);
// Remove by Key
$user->getComments()->remove($ithComment);
$comment->setAuthor(null);
You need to call ``$em->flush()`` to make persist these changes in
the database permanently.
Notice how both sides of the bidirectional association are always
updated. Unidirectional associations are consequently simpler to
handle.
Also note that if you use type-hinting in your methods, you will
have to specify a nullable type, i.e. ``setAddress(?Address $address)``,
otherwise ``setAddress(null)`` will fail to remove the association.
Another way to deal with this is to provide a special method, like
``removeAddress()``. This can also provide better encapsulation as
it hides the internal meaning of not having an address.
When working with collections, keep in mind that a Collection is
essentially an ordered map (just like a PHP array). That is why the
``remove`` operation accepts an index/key. ``removeElement`` is a
separate method that has O(n) complexity using ``array_search``,
where n is the size of the map.
.. note::
Since Doctrine always only looks at the owning side of a
bidirectional association for updates, it is not necessary for
write operations that an inverse collection of a bidirectional
one-to-many or many-to-many association is updated. This knowledge
can often be used to improve performance by avoiding the loading of
the inverse collection.
You can also clear the contents of a whole collection using the
``Collections::clear()`` method. You should be aware that using
this method can lead to a straight and optimized database delete or
update call during the flush operation that is not aware of
entities that have been re-added to the collection.
Say you clear a collection of tags by calling
``$post->getTags()->clear();`` and then call
``$post->getTags()->add($tag)``. This will not recognize the tag having
already been added previously and will consequently issue two separate database
calls.
Association Management Methods
------------------------------
It is generally a good idea to encapsulate proper association
management inside the entity classes. This makes it easier to use
the class correctly and can encapsulate details about how the
association is maintained.
The following code shows updates to the previous User and Comment
example that encapsulate much of the association management code:
.. code-block:: php
<?php
class User
{
// ...
public function markCommentRead(Comment $comment): void {
// Collections implement ArrayAccess
$this->commentsRead[] = $comment;
}
public function addComment(Comment $comment): void {
if (count($this->commentsAuthored) == 0) {
$this->setFirstComment($comment);
}
$this->comments[] = $comment;
$comment->setAuthor($this);
}
private function setFirstComment(Comment $c): void {
$this->firstComment = $c;
}
public function addFavorite(Comment $comment): void {
$this->favorites->add($comment);
$comment->addUserFavorite($this);
}
public function removeFavorite(Comment $comment): void {
$this->favorites->removeElement($comment);
$comment->removeUserFavorite($this);
}
}
class Comment
{
// ..
public function addUserFavorite(User $user): void {
$this->userFavorites[] = $user;
}
public function removeUserFavorite(User $user): void {
$this->userFavorites->removeElement($user);
}
}
You will notice that ``addUserFavorite`` and ``removeUserFavorite``
do not call ``addFavorite`` and ``removeFavorite``, thus the
bidirectional association is strictly-speaking still incomplete.
However if you would naively add the ``addFavorite`` in
``addUserFavorite``, you end up with an infinite loop, so more work
is needed. As you can see, proper bidirectional association
management in plain OOP is a non-trivial task and encapsulating all
the details inside the classes can be challenging.
.. note::
If you want to make sure that your collections are perfectly
encapsulated you should not return them from a
``getCollectionName()`` method directly, but call
``$collection->toArray()``. This way a client programmer for the
entity cannot circumvent the logic you implement on your entity for
association management. For example:
.. code-block:: php
<?php
class User {
/** @return array<int, Comment> */
public function getReadComments(): array {
return $this->commentsRead->toArray();
}
}
This will however always initialize the collection, with all the
performance penalties given the size. In some scenarios of large
collections it might even be a good idea to completely hide the
read access behind methods on the EntityRepository.
There is no single, best way for association management. It greatly
depends on the requirements of your concrete domain model as well
as your preferences.
Synchronizing Bidirectional Collections
---------------------------------------
In the case of Many-To-Many associations you as the developer have the
responsibility of keeping the collections on the owning and inverse side
in sync when you apply changes to them. Doctrine can only
guarantee a consistent state for the hydration, not for your client
code.
Using the User-Comment entities from above, a very simple example
can show the possible caveats you can encounter:
.. code-block:: php
<?php
$user->getFavorites()->add($favoriteComment);
// not calling $favoriteComment->getUserFavorites()->add($user);
$user->getFavorites()->contains($favoriteComment); // TRUE
$favoriteComment->getUserFavorites()->contains($user); // FALSE
There are two approaches to handle this problem in your code:
1. Ignore updating the inverse side of bidirectional collections,
BUT never read from them in requests that changed their state. In
the next request Doctrine hydrates the consistent collection state
again.
2. Always keep the bidirectional collections in sync through
association management methods. Reads of the Collections directly
after changes are consistent then.
.. _transitive-persistence:
Transitive persistence / Cascade Operations
-------------------------------------------
Doctrine ORM provides a mechanism for transitive persistence through cascading of certain operations.
Each association to another entity or a collection of
entities can be configured to automatically cascade the following operations to the associated entities:
``persist``, ``remove``, ``detach``, ``refresh`` or ``all``.
The main use case for ``cascade: persist`` is to avoid "exposing" associated entities to your PHP application.
Continuing with the User-Comment example of this chapter, this is how the creation of a new user and a new
comment might look like in your controller (without ``cascade: persist``):
.. code-block:: php
<?php
$user = new User();
$myFirstComment = new Comment();
$user->addComment($myFirstComment);
$em->persist($user);
$em->persist($myFirstComment); // required, if `cascade: persist` is not set
$em->flush();
Note that the Comment entity is instantiated right here in the controller.
To avoid this, ``cascade: persist`` allows you to "hide" the Comment entity from the controller,
only accessing it through the User entity:
.. code-block:: php
<?php
// User entity
class User
{
private int $id;
/** @var Collection<int, Comment> */
private Collection $comments;
public function __construct()
{
$this->id = User::new();
$this->comments = new ArrayCollection();
}
public function comment(string $text, DateTimeInterface $time) : void
{
$newComment = Comment::create($text, $time);
$newComment->setUser($this);
$this->comments->add($newComment);
}
// ...
}
If you then set up the cascading to the ``User#commentsAuthored`` property...
.. code-block:: php
<?php
class User
{
// ...
/** Bidirectional - One-To-Many (INVERSE SIDE) */
#[OneToMany(targetEntity: Comment::class, mappedBy: 'author', cascade: ['persist', 'remove'])]
private $commentsAuthored;
// ...
}
...you can now create a user and an associated comment like this:
.. code-block:: php
<?php
$user = new User();
$user->comment('Lorem ipsum', new DateTime());
$em->persist($user);
$em->flush();
.. note::
The idea of ``cascade: persist`` is not to save you any lines of code in the controller.
If you instantiate the comment object in the controller (i.e. don't set up the user entity as shown above),
even with ``cascade: persist`` you still have to call ``$myFirstComment->setUser($user);``.
Thanks to ``cascade: remove``, you can easily delete a user and all linked comments without having to loop through them:
.. code-block:: php
<?php
$user = $em->find('User', $deleteUserId);
$em->remove($user);
$em->flush();
.. note::
Cascade operations are performed in memory. That means collections and related entities
are fetched into memory (even if they are marked as lazy) when
the cascade operation is about to be performed. This approach allows
entity lifecycle events to be performed for each of these operations.
However, pulling object graphs into memory on cascade can cause considerable performance
overhead, especially when the cascaded collections are large. Make sure
to weigh the benefits and downsides of each cascade operation that you define.
To rely on the database level cascade operations for the delete operation instead, you can
configure each join column with :doc:`the onDelete option <working-with-objects>`.
Even though automatic cascading is convenient, it should be used
with care. Do not blindly apply ``cascade=all`` to all associations as
it will unnecessarily degrade the performance of your application.
For each cascade operation that gets activated, Doctrine also
applies that operation to the association, be it single or
collection valued.
.. _persistence-by-reachability:
Persistence by Reachability: Cascade Persist
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are additional semantics that apply to the Cascade Persist
operation. During each ``flush()`` operation Doctrine detects if there
are new entities in any collection and three possible cases can
happen:
1. New entities in a collection marked as ``cascade: persist`` will be
directly persisted by Doctrine.
2. New entities in a collection not marked as ``cascade: persist`` will
produce an Exception and rollback the ``flush()`` operation.
3. Collections without new entities are skipped.
This concept is called Persistence by Reachability: New entities
that are found on already managed entities are automatically
persisted as long as the association is defined as ``cascade: persist``.
Orphan Removal
--------------
There is another concept of cascading that is relevant only when removing entities
from collections. If an Entity of type ``A`` contains references to privately
owned Entities ``B`` then if the reference from ``A`` to ``B`` is removed the
entity ``B`` should also be removed, because it is not used anymore.
OrphanRemoval works with one-to-one, one-to-many and many-to-many associations.
.. note::
When using the ``orphanRemoval=true`` option Doctrine makes the assumption
that the entities are privately owned and will **NOT** be reused by other entities.
If you neglect this assumption your entities will get deleted by Doctrine even if
you assigned the orphaned entity to another one.
.. note::
``orphanRemoval=true`` option should be used in combination with ``cascade=["persist"]`` option
as the child entity, that is manually persisted, will not be deleted automatically by Doctrine
when a collection is still an instance of ArrayCollection (before first flush / hydration).
This is a Doctrine limitation since ArrayCollection does not have access to a UnitOfWork.
As a better example consider an Addressbook application where you have Contacts, Addresses
and StandingData:
.. code-block:: php
<?php
namespace Addressbook;
use Doctrine\Common\Collections\ArrayCollection;
#[Entity]
class Contact
{
#[Id, Column(type: 'integer'), GeneratedValue]
private int|null $id = null;
#[OneToOne(targetEntity: StandingData::class, cascade: ['persist'], orphanRemoval: true)]
private StandingData|null $standingData = null;
/** @var Collection<int, Address> */
#[OneToMany(targetEntity: Address::class, mappedBy: 'contact', cascade: ['persist'], orphanRemoval: true)]
private Collection $addresses;
public function __construct()
{
$this->addresses = new ArrayCollection();
}
public function newStandingData(StandingData $sd): void
{
$this->standingData = $sd;
}
public function removeAddress(int $pos): void
{
unset($this->addresses[$pos]);
}
}
Now two examples of what happens when you remove the references:
.. code-block:: php
<?php
$contact = $em->find("Addressbook\Contact", $contactId);
$contact->newStandingData(new StandingData("Firstname", "Lastname", "Street"));
$contact->removeAddress(1);
$em->flush();
In this case you have not only changed the ``Contact`` entity itself but
you have also removed the references for standing data and as well as one
address reference. When flush is called not only are the references removed
but both the old standing data and the one address entity are also deleted
from the database.
.. _filtering-collections:
Filtering Collections
---------------------
Collections have a filtering API that allows to slice parts of data from
a collection. If the collection has not been loaded from the database yet,
the filtering API can work on the SQL level to make optimized access to
large collections.
.. code-block:: php
<?php
use Doctrine\Common\Collections\Criteria;
$group = $entityManager->find('Group', $groupId);
$userCollection = $group->getUsers();
$criteria = Criteria::create()
->where(Criteria::expr()->eq("birthday", "1982-02-17"))
->orderBy(array("username" => Criteria::ASC))
->setFirstResult(0)
->setMaxResults(20)
;
$birthdayUsers = $userCollection->matching($criteria);
.. tip::
You can move the access of slices of collections into dedicated methods of
an entity. For example ``Group#getTodaysBirthdayUsers()``.
The Criteria has a limited matching language that works both on the
SQL and on the PHP collection level. This means you can use collection matching
interchangeably, independent of in-memory or sql-backed collections.
.. code-block:: php
<?php
use Doctrine\Common\Collections;
class Criteria
{
/**
* @return Criteria
*/
static public function create();
/**
* @param Expression $where
* @return Criteria
*/
public function where(Expression $where);
/**
* @param Expression $where
* @return Criteria
*/
public function andWhere(Expression $where);
/**
* @param Expression $where
* @return Criteria
*/
public function orWhere(Expression $where);
/**
* @param array $orderings
* @return Criteria
*/
public function orderBy(array $orderings);
/**
* @param int $firstResult
* @return Criteria
*/
public function setFirstResult($firstResult);
/**
* @param int $maxResults
* @return Criteria
*/
public function setMaxResults($maxResults);
public function getOrderings();
public function getWhereExpression();
public function getFirstResult();
public function getMaxResults();
}
You can build expressions through the ExpressionBuilder. It has the following
methods:
* ``andX($arg1, $arg2, ...)``
* ``orX($arg1, $arg2, ...)``
* ``not($expression)``
* ``eq($field, $value)``
* ``gt($field, $value)``
* ``lt($field, $value)``
* ``lte($field, $value)``
* ``gte($field, $value)``
* ``neq($field, $value)``
* ``isNull($field)``
* ``in($field, array $values)``
* ``notIn($field, array $values)``
* ``contains($field, $value)``
* ``memberOf($value, $field)``
* ``startsWith($field, $value)``
* ``endsWith($field, $value)``
.. note::
There is a limitation on the compatibility of Criteria comparisons.
You have to use scalar values only as the value in a comparison or
the behaviour between different backends is not the same.

View File

@@ -0,0 +1,831 @@
Working with Objects
====================
In this chapter we will help you understand the ``EntityManager``
and the ``UnitOfWork``. A Unit of Work is similar to an
object-level transaction. A new Unit of Work is implicitly started
when an EntityManager is initially created or after
``EntityManager#flush()`` has been invoked. A Unit of Work is
committed (and a new one started) by invoking
``EntityManager#flush()``.
A Unit of Work can be manually closed by calling
EntityManager#close(). Any changes to objects within this Unit of
Work that have not yet been persisted are lost.
.. note::
It is very important to understand that only
``EntityManager#flush()`` ever causes write operations against the
database to be executed. Any other methods such as
``EntityManager#persist($entity)`` or
``EntityManager#remove($entity)`` only notify the UnitOfWork to
perform these operations during flush.
Not calling ``EntityManager#flush()`` will lead to all changes
during that request being lost.
.. note::
Doctrine NEVER touches 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
-----------------------------
Entities are objects with identity. Their identity has a conceptual
meaning inside your domain. In a CMS application each article has a
unique id. You can uniquely identify each article by that id.
Take the following example, where you find an article with the
headline "Hello World" with the ID 1234:
.. code-block:: php
<?php
$article = $entityManager->find('CMS\Article', 1234);
$article->setHeadline('Hello World dude!');
$article2 = $entityManager->find('CMS\Article', 1234);
echo $article2->getHeadline();
In this case the Article is accessed from the entity manager twice,
but modified in between. Doctrine ORM realizes this and will only
ever give you access to one instance of the Article with ID 1234,
no matter how often do you retrieve it from the EntityManager and
even no matter what kind of Query method you are using (find,
Repository Finder or DQL). This is called "Identity Map" pattern,
which means Doctrine keeps a map of each entity and ids that have
been retrieved per PHP request and keeps returning you the same
instances.
In the previous example the echo prints "Hello World dude!" to the
screen. You can even verify that ``$article`` and ``$article2`` are
indeed pointing to the same instance by running the following
code:
.. code-block:: php
<?php
if ($article === $article2) {
echo "Yes we are the same!";
}
Sometimes you want to clear the identity map of an EntityManager to
start over. We use this regularly in our unit-tests to enforce
loading objects from the database again instead of serving them
from the identity map. You can call ``EntityManager#clear()`` to
achieve this result.
Entity Object Graph Traversal
-----------------------------
Although Doctrine allows for a complete separation of your domain
model (Entity classes) there will never be a situation where
objects are "missing" when traversing associations. You can walk
all the associations inside your entity models as deep as you
want.
Take the following example of a single ``Article`` entity fetched
from newly opened EntityManager.
.. code-block:: php
<?php
#[Entity]
class Article
{
#[Id, Column(type: 'integer'), GeneratedValue]
private int|null $id = null;
#[Column(type: 'string')]
private string $headline;
#[ManyToOne(targetEntity: User::class)]
private User|null $author = null;
/** @var Collection<int, Comment> */
#[OneToMany(targetEntity: Comment::class, mappedBy: 'article')]
private Collection $comments;
public function __construct()
{
$this->comments = new ArrayCollection();
}
public function getAuthor(): User|null { return $this->author; }
public function getComments(): Collection { return $this->comments; }
}
$article = $em->find('Article', 1);
This code only retrieves the ``Article`` instance with id 1 executing
a single SELECT statement against the articles table in the database.
You can still access the associated properties author and comments
and the associated objects they contain.
This works by utilizing the lazy loading pattern. Instead of
passing you back a real Author instance and a collection of
comments Doctrine will create proxy instances for you. Only if you
access these proxies for the first time they will go through the
EntityManager and load their state from the database.
This lazy-loading process happens behind the scenes, hidden from
your code. See the following code:
.. code-block:: php
<?php
$article = $em->find('Article', 1);
// accessing a method of the user instance triggers the lazy-load
echo "Author: " . $article->getAuthor()->getName() . "\n";
// Lazy Loading Proxies pass instanceof tests:
if ($article->getAuthor() instanceof User) {
// a User Proxy is a generated "UserProxy" class
}
// accessing the comments as an iterator triggers the lazy-load
// retrieving ALL the comments of this article from the database
// using a single SELECT statement
foreach ($article->getComments() as $comment) {
echo $comment->getText() . "\n\n";
}
// Article::$comments passes instanceof tests for the Collection interface
// But it will NOT pass for the ArrayCollection interface
if ($article->getComments() instanceof \Doctrine\Common\Collections\Collection) {
echo "This will always be true!";
}
.. warning::
Traversing the object graph for parts that are lazy-loaded will
easily trigger lots of SQL queries and will perform badly if used
to heavily. Make sure to use DQL to fetch-join all the parts of the
object-graph that you need as efficiently as possible.
Persisting entities
-------------------
An entity can be made persistent by passing it to the
``EntityManager#persist($entity)`` method. By applying the persist
operation on some entity, that entity becomes MANAGED, which means
that its persistence is from now on managed by an EntityManager. As
a result the persistent state of such an entity will subsequently
be properly synchronized with the database when
``EntityManager#flush()`` is invoked.
.. note::
Invoking the ``persist`` method on an entity does NOT
cause an immediate SQL INSERT to be issued on the database.
Doctrine applies a strategy called "transactional write-behind",
which means that it will delay most SQL commands until
``EntityManager#flush()`` is invoked which will then issue all
necessary SQL statements to synchronize your objects with the
database in the most efficient way and a single, short transaction,
taking care of maintaining referential integrity.
.. note::
Do not make any assumptions in your code about the number of queries
it takes to flush changes, about the ordering of ``INSERT``, ``UPDATE``
and ``DELETE`` queries or the order in which entities will be processed.
Example:
.. code-block:: php
<?php
$user = new User;
$user->setName('Mr.Right');
$em->persist($user);
$em->flush();
.. note::
Generated entity identifiers / primary keys are
guaranteed to be available after the next successful flush
operation that involves the entity in question. You can not rely on
a generated identifier to be available directly after invoking
``persist``. The inverse is also true. You can not rely on a
generated identifier being not available after a failed flush
operation.
The semantics of the persist operation, applied on an entity X, are
as follows:
- If X is a new entity, it becomes managed. The entity X will be
entered into the database as a result of the flush operation.
- If X is a preexisting managed entity, it is ignored by the
persist operation. However, the persist operation is cascaded to
entities referenced by X, if the relationships from X to these
other entities are mapped with cascade=PERSIST or cascade=ALL (see
":ref:`transitive-persistence`").
- If X is a removed entity, it becomes managed.
- If X is a detached entity, an exception will be thrown on
flush.
.. caution::
Do not pass detached entities to the persist operation. The persist operation always
considers entities that are not yet known to the ``EntityManager`` as new entities
(refer to the ``STATE_NEW`` constant inside the ``UnitOfWork``).
Removing entities
-----------------
An entity can be removed from persistent storage by passing it to
the ``EntityManager#remove($entity)`` method. By applying the
``remove`` operation on some entity, that entity becomes REMOVED,
which means that its persistent state will be deleted once
``EntityManager#flush()`` is invoked.
.. note::
Just like ``persist``, invoking ``remove`` on an entity
does NOT cause an immediate SQL DELETE to be issued on the
database. The entity will be deleted on the next invocation of
``EntityManager#flush()`` that involves that entity. This
means that entities scheduled for removal can still be queried
for and appear in query and collection results. See
the section on :ref:`Database and UnitOfWork Out-Of-Sync <workingobjects_database_uow_outofsync>`
for more information.
Example:
.. code-block:: php
<?php
$em->remove($user);
$em->flush();
The semantics of the remove operation, applied to an entity X are
as follows:
- If X is a new entity, it is ignored by the remove operation.
However, the remove operation is cascaded to entities referenced by
X, if the relationship from X to these other entities is mapped
with cascade=REMOVE or cascade=ALL (see ":ref:`transitive-persistence`").
- If X is a managed entity, the remove operation causes it to
become removed. The remove operation is cascaded to entities
referenced by X, if the relationships from X to these other
entities is mapped with cascade=REMOVE or cascade=ALL (see
":ref:`transitive-persistence`").
- If X is a detached entity, an InvalidArgumentException will be
thrown.
- If X is a removed entity, it is ignored by the remove operation.
- A removed entity X will be removed from the database as a result
of the flush operation.
After an entity has been removed, its in-memory state is the same as
before the removal, except for generated identifiers.
During the ``EntityManager#flush()`` operation, the removed entity
will also be removed from all collections in entities currently
loaded into memory.
.. _remove_object_many_to_many_join_tables:
Join-table management when removing from many-to-many collections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Regarding existing rows in many-to-many join tables that refer to
an entity being removed, the following applies.
When the entity being removed does not declare the many-to-many association
itself (that is, the many-to-many association is unidirectional and
the entity is on the inverse side), the ORM has no reasonable way to
detect associations targeting the entity's class. Thus, no ORM-level handling
of join-table rows is attempted and database-level constraints apply.
In case of database-level ``ON DELETE RESTRICT`` constraints, the
``EntityManager#flush()`` operation may abort and a ``ConstraintViolationException``
may be thrown. No in-memory collections will be modified in this case.
With ``ON DELETE CASCADE``, the RDBMS will take care of removing rows
from join tables.
When the entity being removed is part of bi-directional many-to-many
association, either as the owning or inverse side, the ORM will
delete rows from join tables before removing the entity itself. That means
database-level ``ON DELETE RESTRICT`` constraints on join tables are not
effective, since the join table rows are removed first. Removal of join table
rows happens through specialized methods in entity and collection persister
classes and take one query per entity and join table. In case the association
uses a ``@JoinColumn`` configuration with ``onDelete="CASCADE"``, instead
of using a dedicated ``DELETE`` query the database-level operation will be
relied upon.
.. note::
In case you rely on database-level ``ON DELETE RESTRICT`` constraints,
be aware that by making many-to-many associations bidirectional the
assumed protection may be lost.
Performance of different deletion strategies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Deleting an object with all its associated objects can be achieved
in multiple ways with very different performance impacts.
1. If an association is marked as ``CASCADE=REMOVE`` Doctrine ORM
will fetch this association. If its a Single association it will
pass this entity to
``EntityManager#remove()``. If the association is a collection, Doctrine will loop over all its elements and pass them to``EntityManager#remove()``.
In both cases the cascade remove semantics are applied recursively.
For large object graphs this removal strategy can be very costly.
2. Using a DQL ``DELETE`` statement allows you to delete multiple
entities of a type with a single command and without hydrating
these entities. This can be very efficient to delete large object
graphs from the database.
3. Using foreign key semantics ``onDelete="CASCADE"`` can force the
database to remove all associated objects internally. This strategy
is a bit tricky to get right but can be very powerful and fast. You
should be aware however that using strategy 1 (``CASCADE=REMOVE``)
completely by-passes any foreign key ``onDelete=CASCADE`` option,
because Doctrine will fetch and remove all associated entities
explicitly nevertheless.
.. note::
Calling ``remove`` on an entity will remove the object from the identity
map and therefore detach it. Querying the same entity again, for example
via a lazy loaded relation, will return a new object.
Detaching entities
------------------
An entity is detached from an EntityManager and thus no longer
managed by invoking the ``EntityManager#detach($entity)`` method on
it or by cascading the detach operation to it. Changes made to the
detached entity, if any (including removal of the entity), will not
be synchronized to the database after the entity has been
detached.
Doctrine will not hold on to any references to a detached entity.
Example:
.. code-block:: php
<?php
$em->detach($entity);
The semantics of the detach operation, applied to an entity X are
as follows:
- If X is a managed entity, the detach operation causes it to
become detached. The detach operation is cascaded to entities
referenced by X, if the relationships from X to these other
entities is mapped with cascade=DETACH or cascade=ALL (see
":ref:`transitive-persistence`"). Entities which previously referenced X
will continue to reference X.
- If X is a new or detached entity, it is ignored by the detach
operation.
- If X is a removed entity, the detach operation is cascaded to
entities referenced by X, if the relationships from X to these
other entities is mapped with cascade=DETACH or cascade=ALL (see
":ref:`transitive-persistence`"). Entities which previously referenced X
will continue to reference X.
There are several situations in which an entity is detached
automatically without invoking the ``detach`` method:
- When ``EntityManager#clear()`` is invoked, all entities that are
currently managed by the EntityManager instance become detached.
- When serializing an entity. The entity retrieved upon subsequent
unserialization will be detached (This is the case for all entities
that are serialized and stored in some cache).
The ``detach`` operation is usually not as frequently needed and
used as ``persist`` and ``remove``.
Synchronization with the Database
---------------------------------
The state of persistent entities is synchronized with the database
on flush of an ``EntityManager`` which commits the underlying
``UnitOfWork``. The synchronization involves writing any updates to
persistent entities and their relationships to the database.
Thereby bidirectional relationships are persisted based on the
references held by the owning side of the relationship as explained
in the Association Mapping chapter.
When ``EntityManager#flush()`` is called, Doctrine inspects all
managed, new and removed entities and will perform the following
operations.
.. _workingobjects_database_uow_outofsync:
Effects of Database and UnitOfWork being Out-Of-Sync
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As soon as you begin to change the state of entities, call persist or remove the
contents of the UnitOfWork and the database will drive out of sync. They can
only be synchronized by calling ``EntityManager#flush()``. This section
describes the effects of database and UnitOfWork being out of sync.
- Entities that are scheduled for removal can still be queried from the database.
They are returned from DQL and Repository queries and are visible in collections.
- Entities that are passed to ``EntityManager#persist`` do not turn up in query
results.
- Entities that have changed will not be overwritten with the state from the database.
This is because the identity map will detect the construction of an already existing
entity and assumes its the most up to date version.
``EntityManager#flush()`` is never called implicitly by Doctrine. You always have to trigger it manually.
Synchronizing New and Managed Entities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The flush operation applies to a managed entity with the following
semantics:
- The entity itself is synchronized to the database using a SQL
UPDATE statement, only if at least one persistent field has
changed.
- No SQL updates are executed if the entity did not change.
The flush operation applies to a new entity with the following
semantics:
- The entity itself is synchronized to the database using a SQL
INSERT statement.
For all (initialized) relationships of the new or managed entity
the following semantics apply to each associated entity X:
- If X is new and persist operations are configured to cascade on
the relationship, X will be persisted.
- If X is new and no persist operations are configured to cascade
on the relationship, an exception will be thrown as this indicates
a programming error.
- If X is removed and persist operations are configured to cascade
on the relationship, an exception will be thrown as this indicates
a programming error (X would be re-persisted by the cascade).
- If X is detached and persist operations are configured to
cascade on the relationship, an exception will be thrown (This is
semantically the same as passing X to persist()).
Synchronizing Removed Entities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The flush operation applies to a removed entity by deleting its
persistent state from the database. No cascade options are relevant
for removed entities on flush, the cascade remove option is already
executed during ``EntityManager#remove($entity)``.
The size of a Unit of Work
~~~~~~~~~~~~~~~~~~~~~~~~~~
The size of a Unit of Work mainly refers to the number of managed
entities at a particular point in time.
The cost of flushing
~~~~~~~~~~~~~~~~~~~~
How costly a flush operation is, mainly depends on two factors:
- The size of the EntityManager's current UnitOfWork.
- The configured change tracking policies
You can get the size of a UnitOfWork as follows:
.. code-block:: php
<?php
$uowSize = $em->getUnitOfWork()->size();
The size represents the number of managed entities in the Unit of
Work. This size affects the performance of flush() operations due
to change tracking (see "Change Tracking Policies") and, of course,
memory consumption, so you may want to check it from time to time
during development.
.. note::
Do not invoke ``flush`` after every change to an entity
or every single invocation of persist/remove/... This is an
anti-pattern and unnecessarily reduces the performance of your
application. Instead, form units of work that operate on your
objects and call ``flush`` when you are done. While serving a
single HTTP request there should be usually no need for invoking
``flush`` more than 0-2 times.
Direct access to a Unit of Work
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can get direct access to the Unit of Work by calling
``EntityManager#getUnitOfWork()``. This will return the UnitOfWork
instance the EntityManager is currently using.
.. code-block:: php
<?php
$uow = $em->getUnitOfWork();
.. note::
Directly manipulating a UnitOfWork is not recommended.
When working directly with the UnitOfWork API, respect methods
marked as INTERNAL by not using them and carefully read the API
documentation.
Entity State
~~~~~~~~~~~~
As outlined in the architecture overview an entity can be in one of
four possible states: NEW, MANAGED, REMOVED, DETACHED. If you
explicitly need to find out what the current state of an entity is
in the context of a certain ``EntityManager`` you can ask the
underlying ``UnitOfWork``:
.. code-block:: php
<?php
switch ($em->getUnitOfWork()->getEntityState($entity)) {
case UnitOfWork::STATE_MANAGED:
...
case UnitOfWork::STATE_REMOVED:
...
case UnitOfWork::STATE_DETACHED:
...
case UnitOfWork::STATE_NEW:
...
}
An entity is in MANAGED state if it is associated with an
``EntityManager`` and it is not REMOVED.
An entity is in REMOVED state after it has been passed to
``EntityManager#remove()`` until the next flush operation of the
same EntityManager. A REMOVED entity is still associated with an
``EntityManager`` until the next flush operation.
An entity is in DETACHED state if it has persistent state and
identity but is currently not associated with an
``EntityManager``.
An entity is in NEW state if has no persistent state and identity
and is not associated with an ``EntityManager`` (for example those
just created via the "new" operator).
Querying
--------
Doctrine ORM provides the following ways, in increasing level of
power and flexibility, to query for persistent objects. You should
always start with the simplest one that suits your needs.
By Primary Key
~~~~~~~~~~~~~~
The most basic way to query for a persistent object is by its
identifier / primary key using the
``EntityManager#find($entityName, $id)`` method. Here is an
example:
.. code-block:: php
<?php
// $em instanceof EntityManager
$user = $em->find('MyProject\Domain\User', $id);
The return value is either the found entity instance or null if no
instance could be found with the given identifier.
Essentially, ``EntityManager#find()`` is just a shortcut for the
following:
.. code-block:: php
<?php
// $em instanceof EntityManager
$user = $em->getRepository('MyProject\Domain\User')->find($id);
``EntityManager#getRepository($entityName)`` returns a repository
object which provides many ways to retrieve entities of the
specified type. By default, the repository instance is of type
``Doctrine\ORM\EntityRepository``. You can also use custom
repository classes as shown later.
By Simple Conditions
~~~~~~~~~~~~~~~~~~~~
To query for one or more entities based on several conditions that
form a logical conjunction, use the ``findBy`` and ``findOneBy``
methods on a repository as follows:
.. code-block:: php
<?php
// $em instanceof EntityManager
// All users that are 20 years old
$users = $em->getRepository('MyProject\Domain\User')->findBy(array('age' => 20));
// All users that are 20 years old and have a surname of 'Miller'
$users = $em->getRepository('MyProject\Domain\User')->findBy(array('age' => 20, 'surname' => 'Miller'));
// A single user by its nickname
$user = $em->getRepository('MyProject\Domain\User')->findOneBy(array('nickname' => 'romanb'));
You can also load by owning side associations through the repository:
.. code-block:: php
<?php
$number = $em->find('MyProject\Domain\Phonenumber', 1234);
$user = $em->getRepository('MyProject\Domain\User')->findOneBy(array('phone' => $number->getId()));
The ``EntityRepository#findBy()`` method additionally accepts orderings, limit and offset as second to fourth parameters:
.. code-block:: php
<?php
$tenUsers = $em->getRepository('MyProject\Domain\User')->findBy(array('age' => 20), array('name' => 'ASC'), 10, 0);
If you pass an array of values Doctrine will convert the query into a WHERE field IN (..) query automatically:
.. code-block:: php
<?php
$users = $em->getRepository('MyProject\Domain\User')->findBy(array('age' => array(20, 30, 40)));
// translates roughly to: SELECT * FROM users WHERE age IN (20, 30, 40)
An EntityRepository also provides a mechanism for more concise
calls through its use of ``__call``. Thus, the following two
examples are equivalent:
.. code-block:: php
<?php
// A single user by its nickname
$user = $em->getRepository('MyProject\Domain\User')->findOneBy(array('nickname' => 'romanb'));
// A single user by its nickname (__call magic)
$user = $em->getRepository('MyProject\Domain\User')->findOneByNickname('romanb');
Additionally, you can just count the result of the provided conditions when you don't really need the data:
.. code-block:: php
<?php
// Check there is no user with nickname
$availableNickname = 0 === $em->getRepository('MyProject\Domain\User')->count(['nickname' => 'nonexistent']);
By Criteria
~~~~~~~~~~~
The Repository implement the ``Doctrine\Common\Collections\Selectable``
interface. That means you can build ``Doctrine\Common\Collections\Criteria``
and pass them to the ``matching($criteria)`` method.
See section `Filtering collections` of chapter :doc:`Working with Associations <working-with-associations>`
By Eager Loading
~~~~~~~~~~~~~~~~
Whenever you query for an entity that has persistent associations
and these associations are mapped as EAGER, they will automatically
be loaded together with the entity being queried and is thus
immediately available to your application.
Eager Loading can also be configured at runtime through
``AbstractQuery::setFetchMode`` in DQL or Native Queries.
Eager loading for many-to-one and one-to-one associations is using either a
LEFT JOIN or a second query for fetching the related entity eagerly.
Eager loading for many-to-one associations uses a second query to load
the collections for several entities at the same time.
When many-to-many, one-to-one or one-to-many associations are eagerly loaded,
then the global batch size configuration is used to avoid IN(?) queries with
too many arguments. The default batch size is 100 and can be changed with
``Configuration::setEagerFetchBatchSize()``.
For eagerly loaded Many-To-Many associations one query has to be made for each
collection.
By Lazy Loading
~~~~~~~~~~~~~~~
Whenever you have a managed entity instance at hand, you can
traverse and use any associations of that entity that are
configured LAZY as if they were in-memory already. Doctrine will
automatically load the associated objects on demand through the
concept of lazy-loading.
By DQL
~~~~~~
The most powerful and flexible method to query for persistent
objects is the Doctrine Query Language, an object query language.
DQL enables you to query for persistent objects in the language of
objects. DQL understands classes, fields, inheritance and
associations. DQL is syntactically very similar to the familiar SQL
but *it is not SQL*.
A DQL query is represented by an instance of the
``Doctrine\ORM\Query`` class. You create a query using
``EntityManager#createQuery($dql)``. Here is a simple example:
.. code-block:: php
<?php
// $em instanceof EntityManager
// All users with an age between 20 and 30 (inclusive).
$q = $em->createQuery("select u from MyDomain\Model\User u where u.age >= 20 and u.age <= 30");
$users = $q->getResult();
Note that this query contains no knowledge about the relational
schema, only about the object model. DQL supports positional as
well as named parameters, many functions, (fetch) joins,
aggregates, subqueries and much more. Detailed information about
DQL and its syntax as well as the Doctrine class can be found in
:doc:`the dedicated chapter <dql-doctrine-query-language>`.
For programmatically building up queries based on conditions that
are only known at runtime, Doctrine provides the special
``Doctrine\ORM\QueryBuilder`` class. While this a powerful tool,
it also brings more complexity to your code compared to plain DQL,
so you should only use it when you need it. More information on
constructing queries with a QueryBuilder can be found
:doc:`in Query Builder chapter <query-builder>`.
By Native Queries
~~~~~~~~~~~~~~~~~
As an alternative to DQL or as a fallback for special SQL
statements native queries can be used. Native queries are built by
using a hand-crafted SQL query and a ResultSetMapping that
describes how the SQL result set should be transformed by Doctrine.
More information about native queries can be found in
:doc:`the dedicated chapter <native-sql>`.
Custom Repositories
~~~~~~~~~~~~~~~~~~~
By default the EntityManager returns a default implementation of
``Doctrine\ORM\EntityRepository`` when you call
``EntityManager#getRepository($entityClass)``. You can overwrite
this behaviour by specifying the class name of your own Entity
Repository in the Attribute or XML metadata. In large
applications that require lots of specialized DQL queries using a
custom repository is one recommended way of grouping these queries
in a central location.
.. code-block:: php
<?php
namespace MyDomain\Model;
use MyDomain\Model\UserRepository;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: UserRepository::class)]
class User
{
}
class UserRepository extends EntityRepository
{
/** @return Collection<User> */
public function getAllAdminUsers(): Collection
{
return $this->_em->createQuery('SELECT u FROM MyDomain\Model\User u WHERE u.status = "admin"')
->getResult();
}
}
You can access your repository now by calling:
.. code-block:: php
<?php
// $em instanceof EntityManager
$admins = $em->getRepository('MyDomain\Model\User')->getAllAdminUsers();

View File

@@ -0,0 +1,786 @@
XML Mapping
===========
The XML mapping driver enables you to provide the ORM metadata in
form of XML documents. It requires the ``dom`` extension in order to be
able to validate your mapping documents against its XML Schema.
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
`https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd <https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd>`_.
The most convenient way to work with
XML mapping files is to use an IDE/editor that can provide
code-completion based on such an XML Schema document. The following
is an outline of a XML mapping document with the proper xmlns/xsi
setup for the latest code in trunk.
.. code-block:: xml
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://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">
...
</doctrine-mapping>
The XML mapping document of a class is loaded on-demand the first
time it is requested and subsequently stored in the metadata cache.
In order to work, this requires certain conventions:
- Each entity/mapped superclass must get its own dedicated XML
mapping document.
- The name of the mapping document must consist of the fully
qualified name of the class, where namespace separators are
replaced by dots (.). For example an Entity with the fully
qualified class-name "MyProject" would require a mapping file
"MyProject.Entities.User.dcm.xml" unless the extension is changed.
- All mapping documents should get the extension ".dcm.xml" to
identify it as a Doctrine mapping file. This is more of a
convention and you are not forced to do this. You can change the
file extension easily enough.
.. code-block:: php
<?php
$driver->setFileExtension('.xml');
It is recommended to put all XML mapping documents in a single
folder but you can spread the documents over several folders if you
want to. In order to tell the XmlDriver where to look for your
mapping documents, supply an array of paths as the first argument
of the constructor, like this:
.. code-block:: php
<?php
$config = new \Doctrine\ORM\Configuration();
$driver = new \Doctrine\ORM\Mapping\Driver\XmlDriver(array('/path/to/files1', '/path/to/files2'));
$config->setMetadataDriverImpl($driver);
.. warning::
Note that Doctrine ORM does not modify any settings for ``libxml``,
therefore, external XML entities may or may not be enabled or
configured correctly.
XML mappings are not XXE/XEE attack vectors since they are not
related with user input, but it is recommended that you do not
use external XML entities in your mapping files to avoid running
into unexpected behaviour.
Simplified XML Driver
~~~~~~~~~~~~~~~~~~~~~
The Symfony project sponsored a driver that simplifies usage of the XML Driver.
The changes between the original driver are:
1. File Extension is .orm.xml
2. Filenames are shortened, "MyProject\Entities\User" will become User.orm.xml
3. You can add a global file and add multiple entities in this file.
Configuration of this client works a little bit different:
.. code-block:: php
<?php
$namespaces = array(
'/path/to/files1' => 'MyProject\Entities',
'/path/to/files2' => 'OtherProject\Entities'
);
$driver = new \Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver($namespaces);
$driver->setGlobalBasename('global'); // global.orm.xml
Example
-------
As a quick start, here is a small example document that makes use
of several common elements:
.. code-block:: xml
// Doctrine.Tests.ORM.Mapping.User.dcm.xml
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://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\ORM\Mapping\User" table="cms_users">
<indexes>
<index name="name_idx" columns="name"/>
<index columns="user_email"/>
</indexes>
<unique-constraints>
<unique-constraint columns="name,user_email" name="search_idx" />
</unique-constraints>
<lifecycle-callbacks>
<lifecycle-callback type="prePersist" method="doStuffOnPrePersist"/>
<lifecycle-callback type="prePersist" method="doOtherStuffOnPrePersistToo"/>
<lifecycle-callback type="postPersist" method="doStuffOnPostPersist"/>
</lifecycle-callbacks>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
<sequence-generator sequence-name="tablename_seq" allocation-size="100" initial-value="1" />
</id>
<field name="name" column="name" type="string" length="50" nullable="true" unique="true" />
<field name="email" column="user_email" type="string" column-definition="CHAR(32) NOT NULL" />
<one-to-one field="address" target-entity="Address" inversed-by="user">
<cascade><cascade-remove /></cascade>
<join-column name="address_id" referenced-column-name="id" on-delete="CASCADE" on-update="CASCADE"/>
</one-to-one>
<one-to-many field="phonenumbers" target-entity="Phonenumber" mapped-by="user">
<cascade>
<cascade-persist/>
</cascade>
<order-by>
<order-by-field name="number" direction="ASC" />
</order-by>
</one-to-many>
<many-to-many field="groups" target-entity="Group">
<cascade>
<cascade-all/>
</cascade>
<join-table name="cms_users_groups">
<join-columns>
<join-column name="user_id" referenced-column-name="id" nullable="false" unique="false" />
</join-columns>
<inverse-join-columns>
<join-column name="group_id" referenced-column-name="id" column-definition="INT NULL" />
</inverse-join-columns>
</join-table>
</many-to-many>
</entity>
</doctrine-mapping>
Be aware that class-names specified in the XML files should be
fully qualified.
XML-Element Reference
---------------------
The XML-Element reference explains all the tags and attributes that
the Doctrine Mapping XSD Schema defines. You should read the
Basic-, Association- and Inheritance Mapping chapters to understand
what each of this definitions means in detail.
Defining an Entity
~~~~~~~~~~~~~~~~~~
Each XML Mapping File contains the definition of one entity,
specified as the ``<entity />`` element as a direct child of the
``<doctrine-mapping />`` element:
.. code-block:: xml
<doctrine-mapping>
<entity name="MyProject\User" table="cms_users" schema="schema_name" repository-class="MyProject\UserRepository">
<!-- definition here -->
</entity>
</doctrine-mapping>
Required attributes:
- name - The fully qualified class-name of the entity.
Optional attributes:
- **table** - The Table-Name to be used for this entity. Otherwise the
Unqualified Class-Name is used by default.
- **repository-class** - The fully qualified class-name of an
alternative ``Doctrine\ORM\EntityRepository`` implementation to be
used with this entity.
- **inheritance-type** - The type of inheritance, defaults to none. A
more detailed description follows in the
*Defining Inheritance Mappings* section.
- **read-only** - Specifies that this entity is marked as read only and not
considered for change-tracking. Entities of this type can be persisted
and removed though.
- **schema** - The schema the table lies in, for platforms that support schemas
Defining Fields
~~~~~~~~~~~~~~~
Each entity class can contain zero to infinite fields that are
managed by Doctrine. You can define them using the ``<field />``
element as a children to the ``<entity />`` element. The field
element is only used for primitive types that are not the ID of the
entity. For the ID mapping you have to use the ``<id />`` element.
.. code-block:: xml
<entity name="MyProject\User">
<field name="name" type="string" length="50" />
<field name="username" type="string" unique="true" />
<field name="age" type="integer" nullable="true" />
<field name="isActive" column="is_active" type="boolean" />
<field name="weight" type="decimal" scale="5" precision="2" />
<field name="login_count" type="integer" nullable="false">
<options>
<option name="comment">The number of times the user has logged in.</option>
<option name="default">0</option>
</options>
</field>
</entity>
Required attributes:
- name - The name of the Property/Field on the given Entity PHP
class.
Optional attributes:
- type - The ``Doctrine\DBAL\Types\Type`` name, defaults to
"string"
- column - Name of the column in the database, defaults to the
field name.
- length - The length of the given type, for use with strings
only.
- unique - Should this field contain a unique value across the
table? Defaults to false.
- nullable - Should this field allow NULL as a value? Defaults to
false.
- insertable - Should this field be inserted? Defaults to true.
- updatable - Should this field be updated? Defaults to true.
- generated - Enum of the values ALWAYS, INSERT, NEVER that determines if
generated value must be fetched from database after INSERT or UPDATE.
Defaults to "NEVER".
- version - Should this field be used for optimistic locking? Only
works on fields with type integer or datetime.
- scale - Scale of a decimal type.
- precision - Precision of a decimal type.
- options - Array of additional options:
- default - The default value to set for the column if no value
is supplied.
- unsigned - Boolean value to determine if the column should
be capable of representing only non-negative integers
(applies only for integer column and might not be supported by
all vendors).
- fixed - Boolean value to determine if the specified length of
a string column should be fixed or varying (applies only for
string/binary column and might not be supported by all vendors).
- comment - The comment of the column in the schema (might not
be supported by all vendors).
- customSchemaOptions - Array of additional schema options
which are mostly vendor specific.
- column-definition - Optional alternative SQL representation for
this column. This definition begin after the field-name and has to
specify the complete column definition. Using this feature will
turn this field dirty for Schema-Tool update commands at all
times.
.. note::
For more detailed information on each attribute, please refer to
the DBAL ``Schema-Representation`` documentation.
Defining Identity and Generator Strategies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An entity has to have at least one ``<id />`` element. For
composite keys you can specify more than one id-element, however
surrogate keys are recommended for use with Doctrine ORM. The Id
field allows to define properties of the identifier and allows a
subset of the ``<field />`` element attributes:
.. code-block:: xml
<entity name="MyProject\User">
<id name="id" type="integer" column="user_id" />
</entity>
Required attributes:
- name - The name of the Property/Field on the given Entity PHP
class.
- type - The ``Doctrine\DBAL\Types\Type`` name, preferably
"string" or "integer".
Optional attributes:
- column - Name of the column in the database, defaults to the
field name.
Using the simplified definition above Doctrine will use no
identifier strategy for this entity. That means you have to
manually set the identifier before calling
``EntityManager#persist($entity)``. This is the so called
``NONE`` strategy.
If you want to switch the identifier generation strategy you have
to nest a ``<generator />`` element inside the id-element. This of
course only works for surrogate keys. For composite keys you always
have to use the ``NONE`` strategy.
.. code-block:: xml
<entity name="MyProject\User">
<id name="id" type="integer" column="user_id">
<generator strategy="AUTO" />
</id>
</entity>
The following values are allowed for the ``<generator />`` strategy
attribute:
- AUTO - Automatic detection of the identifier strategy based on
the preferred solution of the database vendor.
- IDENTITY - Use of a IDENTIFY strategy such as Auto-Increment IDs
available to Doctrine AFTER the INSERT statement has been executed.
- SEQUENCE - Use of a database sequence to retrieve the
entity-ids. This is possible before the INSERT statement is
executed.
If you are using the SEQUENCE strategy you can define an additional
element to describe the sequence:
.. code-block:: xml
<entity name="MyProject\User">
<id name="id" type="integer" column="user_id">
<generator strategy="SEQUENCE" />
<sequence-generator sequence-name="user_seq" allocation-size="5" initial-value="1" />
</id>
</entity>
Required attributes for ``<sequence-generator />``:
- sequence-name - The name of the sequence
Optional attributes for ``<sequence-generator />``:
- allocation-size - By how much steps should the sequence be
incremented when a value is retrieved. Defaults to 1
- initial-value - What should the initial value of the sequence
be.
**NOTE**
If you want to implement a cross-vendor compatible application you
have to specify and additionally define the <sequence-generator />
element, if Doctrine chooses the sequence strategy for a
platform.
Defining a Mapped Superclass
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sometimes you want to define a class that multiple entities inherit
from, which itself is not an entity however. The chapter on
*Inheritance Mapping* describes a Mapped Superclass in detail. You
can define it in XML using the ``<mapped-superclass />`` tag.
.. code-block:: xml
<doctrine-mapping>
<mapped-superclass name="MyProject\BaseClass">
<field name="created" type="datetime" />
<field name="updated" type="datetime" />
</mapped-superclass>
</doctrine-mapping>
Required attributes:
- name - Class name of the mapped superclass.
You can nest any number of ``<field />`` and unidirectional
``<many-to-one />`` or ``<one-to-one />`` associations inside a
mapped superclass.
Defining Inheritance Mappings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are currently two inheritance persistence strategies that you
can choose from when defining entities that inherit from each
other. Single Table inheritance saves the fields of the complete
inheritance hierarchy in a single table, joined table inheritance
creates a table for each entity combining the fields using join
conditions.
You can specify the inheritance type in the ``<entity />`` element
and then use the ``<discriminator-column />`` and
``<discriminator-mapping />`` attributes.
.. code-block:: xml
<entity name="MyProject\Animal" inheritance-type="JOINED">
<discriminator-column name="discr" type="string" />
<discriminator-map>
<discriminator-mapping value="cat" class="MyProject\Cat" />
<discriminator-mapping value="dog" class="MyProject\Dog" />
<discriminator-mapping value="mouse" class="MyProject\Mouse" />
</discriminator-map>
</entity>
The allowed values for inheritance-type attribute are ``JOINED`` or
``SINGLE_TABLE``.
.. note::
All inheritance related definitions have to be defined on the root
entity of the hierarchy.
Defining Lifecycle Callbacks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can define the lifecycle callback methods on your entities
using the ``<lifecycle-callbacks />`` element:
.. code-block:: xml
<entity name="Doctrine\Tests\ORM\Mapping\User" table="cms_users">
<lifecycle-callbacks>
<lifecycle-callback type="prePersist" method="onPrePersist" />
</lifecycle-callbacks>
</entity>
Defining One-To-One Relations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can define One-To-One Relations/Associations using the
``<one-to-one />`` element. The required and optional attributes
depend on the associations being on the inverse or owning side.
For the inverse side the mapping is as simple as:
.. code-block:: xml
<entity class="MyProject\User">
<one-to-one field="address" target-entity="Address" mapped-by="user" />
</entity>
Required attributes for inverse One-To-One:
- field - Name of the property/field on the entity's PHP class.
- target-entity - Name of the entity associated entity class. If
this is not qualified the namespace of the current class is
prepended. *IMPORTANT:* No leading backslash!
- mapped-by - Name of the field on the owning side (here Address
entity) that contains the owning side association.
For the owning side this mapping would look like:
.. code-block:: xml
<entity class="MyProject\Address">
<one-to-one field="user" target-entity="User" inversed-by="address" />
</entity>
Required attributes for owning One-to-One:
- field - Name of the property/field on the entity's PHP class.
- target-entity - Name of the entity associated entity class. If
this is not qualified the namespace of the current class is
prepended. *IMPORTANT:* No leading backslash!
Optional attributes for owning One-to-One:
- inversed-by - If the association is bidirectional the
inversed-by attribute has to be specified with the name of the
field on the inverse entity that contains the back-reference.
- orphan-removal - If true, the inverse side entity is always
deleted when the owning side entity is. Defaults to false.
- fetch - Either LAZY or EAGER, defaults to LAZY. This attribute
makes only sense on the owning side, the inverse side *ALWAYS* has
to use the ``FETCH`` strategy.
The definition for the owning side relies on a bunch of mapping
defaults for the join column names. Without the nested
``<join-column />`` element Doctrine assumes to foreign key to be
called ``user_id`` on the Address Entities table. This is because
the ``MyProject\Address`` entity is the owning side of this
association, which means it contains the foreign key.
The completed explicitly defined mapping is:
.. code-block:: xml
<entity class="MyProject\Address">
<one-to-one field="user" target-entity="User" inversed-by="address">
<join-column name="user_id" referenced-column-name="id" />
</one-to-one>
</entity>
Defining Many-To-One Associations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The many-to-one association is *ALWAYS* the owning side of any
bidirectional association. This simplifies the mapping compared to
the one-to-one case. The minimal mapping for this association looks
like:
.. code-block:: xml
<entity class="MyProject\Article">
<many-to-one field="author" target-entity="User" />
</entity>
Required attributes:
- field - Name of the property/field on the entity's PHP class.
- target-entity - Name of the entity associated entity class. If
this is not qualified the namespace of the current class is
prepended. *IMPORTANT:* No leading backslash!
Optional attributes:
- inversed-by - If the association is bidirectional the
inversed-by attribute has to be specified with the name of the
field on the inverse entity that contains the back-reference.
- orphan-removal - If true the entity on the inverse side is
always deleted when the owning side entity is and it is not
connected to any other owning side entity anymore. Defaults to
false.
- fetch - Either LAZY or EAGER, defaults to LAZY.
This definition relies on a bunch of mapping defaults with regards
to the naming of the join-column/foreign key. The explicitly
defined mapping includes a ``<join-column />`` tag nested inside
the many-to-one association tag:
.. code-block:: xml
<entity class="MyProject\Article">
<many-to-one field="author" target-entity="User">
<join-column name="author_id" referenced-column-name="id" />
</many-to-one>
</entity>
The join-column attribute ``name`` specifies the column name of the
foreign key and the ``referenced-column-name`` attribute specifies
the name of the primary key column on the User entity.
Defining One-To-Many Associations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The one-to-many association is *ALWAYS* the inverse side of any
association. There exists no such thing as a uni-directional
one-to-many association, which means this association only ever
exists for bi-directional associations.
.. code-block:: xml
<entity class="MyProject\User">
<one-to-many field="phonenumbers" target-entity="Phonenumber" mapped-by="user" />
</entity>
Required attributes:
- field - Name of the property/field on the entity's PHP class.
- target-entity - Name of the entity associated entity class. If
this is not qualified the namespace of the current class is
prepended. *IMPORTANT:* No leading backslash!
- mapped-by - Name of the field on the owning side (here
Phonenumber entity) that contains the owning side association.
Optional attributes:
- fetch - Either LAZY, EXTRA_LAZY or EAGER, defaults to LAZY.
- index-by: Index the collection by a field on the target entity.
Defining Many-To-Many Associations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From all the associations the many-to-many has the most complex
definition. When you rely on the mapping defaults you can omit many
definitions and rely on their implicit values.
.. code-block:: xml
<entity class="MyProject\User">
<many-to-many field="groups" target-entity="Group" />
</entity>
Required attributes:
- field - Name of the property/field on the entity's PHP class.
- target-entity - Name of the entity associated entity class. If
this is not qualified the namespace of the current class is
prepended. *IMPORTANT:* No leading backslash!
Optional attributes:
- mapped-by - Name of the field on the owning side that contains
the owning side association if the defined many-to-many association
is on the inverse side.
- inversed-by - If the association is bidirectional the
inversed-by attribute has to be specified with the name of the
field on the inverse entity that contains the back-reference.
- fetch - Either LAZY, EXTRA_LAZY or EAGER, defaults to LAZY.
- index-by: Index the collection by a field on the target entity.
The mapping defaults would lead to a join-table with the name
"User\_Group" being created that contains two columns "user\_id"
and "group\_id". The explicit definition of this mapping would be:
.. code-block:: xml
<entity class="MyProject\User">
<many-to-many field="groups" target-entity="Group">
<join-table name="cms_users_groups">
<join-columns>
<join-column name="user_id" referenced-column-name="id"/>
</join-columns>
<inverse-join-columns>
<join-column name="group_id" referenced-column-name="id"/>
</inverse-join-columns>
</join-table>
</many-to-many>
</entity>
Here both the ``<join-columns>`` and ``<inverse-join-columns>``
tags are necessary to tell Doctrine for which side the specified
join-columns apply. These are nested inside a ``<join-table />``
attribute which allows to specify the table name of the
many-to-many join-table.
Cascade Element
~~~~~~~~~~~~~~~
Doctrine allows cascading of several UnitOfWork operations to
related entities. You can specify the cascade operations in the
``<cascade />`` element inside any of the association mapping
tags.
.. code-block:: xml
<entity class="MyProject\User">
<many-to-many field="groups" target-entity="Group">
<cascade>
<cascade-all/>
</cascade>
</many-to-many>
</entity>
Besides ``<cascade-all />`` the following operations can be
specified by their respective tags:
- ``<cascade-persist />``
- ``<cascade-remove />``
- ``<cascade-refresh />``
- ``<cascade-detach />``
Join Column Element
~~~~~~~~~~~~~~~~~~~
In any explicitly defined association mapping you will need the
``<join-column />`` tag. It defines how the foreign key and primary
key names are called that are used for joining two entities.
Required attributes:
- name - The column name of the foreign key.
- referenced-column-name - The column name of the associated
entities primary key
Optional attributes:
- unique - If the join column should contain a UNIQUE constraint.
This makes sense for Many-To-Many join-columns only to simulate a
one-to-many unidirectional using a join-table.
- nullable - should the join column be nullable, defaults to true.
- on-delete - Foreign Key Cascade action to perform when entity is
deleted, defaults to NO ACTION/RESTRICT but can be set to
"CASCADE".
Defining Order of To-Many Associations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can require one-to-many or many-to-many associations to be
retrieved using an additional ``ORDER BY``.
.. code-block:: xml
<entity class="MyProject\User">
<many-to-many field="groups" target-entity="Group">
<order-by>
<order-by-field name="name" direction="ASC" />
</order-by>
</many-to-many>
</entity>
Defining Indexes or Unique Constraints
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To define additional indexes or unique constraints on the entities
table you can use the ``<indexes />`` and
``<unique-constraints />`` elements:
.. code-block:: xml
<entity name="Doctrine\Tests\ORM\Mapping\User" table="cms_users">
<indexes>
<index name="name_idx" columns="name"/>
<index columns="user_email"/>
</indexes>
<unique-constraints>
<unique-constraint columns="name,user_email" name="search_idx" />
</unique-constraints>
</entity>
You have to specify the column and not the entity-class field names
in the index and unique-constraint definitions.
Derived Entities ID syntax
~~~~~~~~~~~~~~~~~~~~~~~~~~
If the primary key of an entity contains a foreign key to another entity we speak of a derived
entity relationship. You can define this in XML with the "association-key" attribute in the ``<id>`` tag.
.. code-block:: xml
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://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="Application\Model\ArticleAttribute">
<id name="article" association-key="true" />
<id name="attribute" type="string" />
<field name="value" type="string" />
<many-to-one field="article" target-entity="Article" inversed-by="attributes" />
</entity>
</doctrine-mapping>

82
docs/en/sidebar.rst Normal file
View File

@@ -0,0 +1,82 @@
:orphan:
.. toc::
.. tocheader:: Tutorials
.. toctree::
:depth: 3
tutorials/getting-started
tutorials/getting-started-database
tutorials/getting-started-models
tutorials/working-with-indexed-associations
tutorials/extra-lazy-associations
tutorials/composite-primary-keys
tutorials/ordered-associations
tutorials/override-field-association-mappings-in-subclasses
tutorials/pagination
tutorials/embeddables
.. toc::
.. tocheader:: Reference
.. toctree::
:depth: 3
reference/architecture
reference/configuration
reference/faq
reference/basic-mapping
reference/association-mapping
reference/inheritance-mapping
reference/working-with-objects
reference/working-with-associations
reference/typedfieldmapper
reference/events
reference/unitofwork
reference/unitofwork-associations
reference/transactions-and-concurrency
reference/batch-processing
reference/dql-doctrine-query-language
reference/query-builder
reference/native-sql
reference/change-tracking-policies
reference/attributes-reference
reference/xml-mapping
reference/php-mapping
reference/caching
reference/improving-performance
reference/tools
reference/metadata-drivers
reference/best-practices
reference/limitations-and-known-issues
tutorials/pagination
reference/filters
reference/namingstrategy
reference/advanced-configuration
reference/second-level-cache
reference/security
.. toc::
.. tocheader:: Cookbook
.. toctree::
:depth: 3
cookbook/aggregate-fields
cookbook/custom-mapping-types
cookbook/decorator-pattern
cookbook/dql-custom-walkers
cookbook/dql-user-defined-functions
cookbook/implementing-arrayaccess-for-domain-objects
cookbook/resolve-target-entity-listener
cookbook/sql-table-prefixes
cookbook/strategy-cookbook-introduction
cookbook/validation-of-entities
cookbook/working-with-datetime
cookbook/mysql-enums
cookbook/advanced-field-value-conversion-using-custom-mapping-types
cookbook/entities-in-session

View File

@@ -0,0 +1,309 @@
Composite and Foreign Keys as Primary Key
=========================================
Doctrine ORM supports composite primary keys natively. Composite keys are a very powerful relational database concept
and we took good care to make sure Doctrine ORM supports as many of the composite primary key use-cases.
For Doctrine ORM composite keys of primitive data-types are supported, even foreign keys as
primary keys are supported.
This tutorial shows how the semantics of composite primary keys work and how they map to the database.
General Considerations
~~~~~~~~~~~~~~~~~~~~~~
Every entity with a composite key cannot use an id generator other than "NONE". That means
the ID fields have to have their values set before you call ``EntityManager#persist($entity)``.
Primitive Types only
~~~~~~~~~~~~~~~~~~~~
You can have composite keys as long as they only consist of the primitive types
``integer`` and ``string``. Suppose you want to create a database of cars and use the model-name
and year of production as primary keys:
.. configuration-block::
.. code-block:: attribute
<?php
namespace VehicleCatalogue\Model;
#[Entity]
class Car
{
public function __construct(
#[Id, Column]
private string $name,
#[Id, Column]
private int $year,
) {
}
public function getModelName(): string
{
return $this->name;
}
public function getYearOfProduction(): int
{
return $this->year;
}
}
.. code-block:: xml
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://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="VehicleCatalogue\Model\Car">
<id field="name" type="string" />
<id field="year" type="integer" />
</entity>
</doctrine-mapping>
Now you can use this entity:
.. code-block:: php
<?php
namespace VehicleCatalogue\Model;
// $em is the EntityManager
$car = new Car("Audi A8", 2010);
$em->persist($car);
$em->flush();
And for querying you can use arrays to both DQL and EntityRepositories:
.. code-block:: php
<?php
namespace VehicleCatalogue\Model;
// $em is the EntityManager
$audi = $em->find("VehicleCatalogue\Model\Car", array("name" => "Audi A8", "year" => 2010));
$dql = "SELECT c FROM VehicleCatalogue\Model\Car c WHERE c.id = ?1";
$audi = $em->createQuery($dql)
->setParameter(1, ["name" => "Audi A8", "year" => 2010])
->getSingleResult();
You can also use this entity in associations. Doctrine will then generate two foreign keys one for ``name``
and to ``year`` to the related entities.
.. note::
This example shows how you can nicely solve the requirement for existing
values before ``EntityManager#persist()``: By adding them as mandatory values for the constructor.
Identity through foreign Entities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are tons of use-cases where the identity of an Entity should be determined by the entity
of one or many parent entities.
- Dynamic Attributes of an Entity (for example Article). Each Article has many
attributes with primary key "article_id" and "attribute_name".
- Address object of a Person, the primary key of the address is "user_id". This is not a case of a composite primary
key, but the identity is derived through a foreign entity and a foreign key.
- Join Tables with metadata can be modelled as Entity, for example connections between two articles
with a little description and a score.
The semantics of mapping identity through foreign entities are easy:
- Only allowed on Many-To-One or One-To-One associations.
- Plug an ``#[Id]`` attribute onto every association.
- Set an attribute ``association-key`` with the field name of the association in XML.
Use-Case 1: Dynamic Attributes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We keep up the example of an Article with arbitrary attributes, the mapping looks like this:
.. configuration-block::
.. code-block:: attribute
<?php
namespace Application\Model;
use Doctrine\Common\Collections\ArrayCollection;
#[Entity]
class Article
{
#[Id, Column, GeneratedValue]
private int|null $id = null;
#[Column]
private string $title;
/** @var ArrayCollection<string, ArticleAttribute> */
#[OneToMany(targetEntity: ArticleAttribute::class, mappedBy: 'article', cascade: ['ALL'], indexBy: 'attribute')]
private Collection $attributes;
public function addAttribute(string $name, ArticleAttribute $value): void
{
$this->attributes[$name] = new ArticleAttribute($name, $value, $this);
}
}
#[Entity]
class ArticleAttribute
{
#[Id, ManyToOne(targetEntity: Article::class, inversedBy: 'attributes')]
private Article $article;
#[Id, Column]
private string $attribute;
#[Column]
private string $value;
public function __construct(string $name, string $value, Article $article)
{
$this->attribute = $name;
$this->value = $value;
$this->article = $article;
}
}
.. code-block:: xml
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://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="Application\Model\ArticleAttribute">
<id name="article" association-key="true" />
<id name="attribute" type="string" />
<field name="value" type="string" />
<many-to-one field="article" target-entity="Article" inversed-by="attributes" />
<entity>
</doctrine-mapping>
Use-Case 2: Simple Derived Identity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sometimes you have the requirement that two objects are related by a One-To-One association
and that the dependent class should re-use the primary key of the class it depends on.
One good example for this is a user-address relationship:
.. configuration-block::
.. code-block:: attribute
<?php
#[Entity]
class User
{
#[Id, Column, GeneratedValue]
private int|null $id = null;
}
#[Entity]
class Address
{
#[Id, OneToOne(targetEntity: User::class)]
private User|null $user = null;
}
Use-Case 3: Join-Table with Metadata
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the classic order product shop example there is the concept of the order item
which contains references to order and product and additional data such as the amount
of products purchased and maybe even the current price.
.. code-block:: php
<?php
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
#[Entity]
class Order
{
#[Id, Column, GeneratedValue]
private int|null $id = null;
/** @var ArrayCollection<int, OrderItem> */
#[OneToMany(targetEntity: OrderItem::class, mappedBy: 'order')]
private Collection $items;
#[Column]
private bool $paid = false;
#[Column]
private bool $shipped = false;
#[Column]
private DateTime $created;
public function __construct(
#[ManyToOne(targetEntity: Customer::class)]
private Customer $customer,
) {
$this->items = new ArrayCollection();
$this->created = new DateTime("now");
}
}
#[Entity]
class Product
{
#[Id, Column, GeneratedValue]
private int|null $id = null;
#[Column]
private string $name;
#[Column]
private int $currentPrice;
public function getCurrentPrice(): int
{
return $this->currentPrice;
}
}
#[Entity]
class OrderItem
{
#[Id, ManyToOne(targetEntity: Order::class)]
private Order|null $order = null;
#[Id, ManyToOne(targetEntity: Product::class)]
private Product|null $product = null;
#[Column]
private int $amount = 1;
#[Column]
private int $offeredPrice;
public function __construct(Order $order, Product $product, int $amount = 1)
{
$this->order = $order;
$this->product = $product;
$this->offeredPrice = $product->getCurrentPrice();
}
}
Performance Considerations
~~~~~~~~~~~~~~~~~~~~~~~~~~
Using composite keys always comes with a performance hit compared to using entities with
a simple surrogate key. This performance impact is mostly due to additional PHP code that is
necessary to handle this kind of keys, most notably when using derived identifiers.
On the SQL side there is not much overhead as no additional or unexpected queries have to be
executed to manage entities with derived foreign keys.

View File

@@ -0,0 +1,144 @@
Separating Concerns using Embeddables
=====================================
Embeddables are classes which are not entities themselves, but are embedded
in entities and can also be queried in DQL. You'll mostly want to use them
to reduce duplication or separating concerns. Value objects such as date range
or address are the primary use case for this feature.
.. note::
Embeddables can only contain properties with basic ``@Column`` mapping.
For the purposes of this tutorial, we will assume that you have a ``User``
class in your application and you would like to store an address in
the ``User`` class. We will model the ``Address`` class as an embeddable
instead of simply adding the respective columns to the ``User`` class.
.. configuration-block::
.. code-block:: attribute
<?php
#[Entity]
class User
{
#[Embedded(class: Address::class)]
private Address $address;
}
#[Embeddable]
class Address
{
#[Column(type: "string")]
private string $street;
#[Column(type: "string")]
private string $postalCode;
#[Column(type: "string")]
private string $city;
#[Column(type: "string")]
private string $country;
}
.. code-block:: xml
<doctrine-mapping>
<entity name="User">
<embedded name="address" class="Address" />
</entity>
<embeddable name="Address">
<field name="street" type="string" />
<field name="postalCode" type="string" />
<field name="city" type="string" />
<field name="country" type="string" />
</embeddable>
</doctrine-mapping>
In terms of your database schema, Doctrine will automatically inline all
columns from the ``Address`` class into the table of the ``User`` class,
just as if you had declared them directly there.
Initializing embeddables
------------------------
In case all fields in the embeddable are ``nullable``, you might want
to initialize the embeddable, to avoid getting a null value instead of
the embedded object.
.. code-block:: php
public function __construct()
{
$this->address = new Address();
}
Column Prefixing
----------------
By default, Doctrine names your columns by prefixing them, using the value
object name.
Following the example above, your columns would be named as ``address_street``,
``address_postalCode``...
You can change this behaviour to meet your needs by changing the
``columnPrefix`` attribute in the ``@Embedded`` notation.
The following example shows you how to set your prefix to ``myPrefix_``:
.. configuration-block::
.. code-block:: attribute
<?php
#[Entity]
class User
{
#[Embedded(class: Address::class, columnPrefix: "myPrefix_")]
private Address $address;
}
.. code-block:: xml
<entity name="User">
<embedded name="address" class="Address" column-prefix="myPrefix_" />
</entity>
To have Doctrine drop the prefix and use the value object's property name
directly, set ``columnPrefix=false`` (``use-column-prefix="false"`` for XML):
.. configuration-block::
.. code-block:: attribute
<?php
#[Entity]
class User
{
#[Embedded(class: Address::class, columnPrefix: false)]
private Address $address;
}
.. code-block:: xml
<entity name="User">
<embedded name="address" class="Address" use-column-prefix="false" />
</entity>
DQL
---
You can also use mapped fields of embedded classes in DQL queries, just
as if they were declared in the ``User`` class:
.. code-block:: sql
SELECT u FROM User u WHERE u.address.city = :myCity

View File

@@ -0,0 +1,80 @@
Extra Lazy Associations
=======================
.. versionadded:: 2.1
In many cases associations between entities can get pretty large. Even in a simple scenario like a blog.
where posts can be commented, you always have to assume that a post draws hundreds of comments.
In Doctrine ORM if you accessed an association it would always get loaded completely into memory. This
can lead to pretty serious performance problems, if your associations contain several hundreds or thousands
of entities.
Doctrine ORM includes a feature called **Extra Lazy** for associations. Associations
are marked as **Lazy** by default, which means the whole collection object for an association is populated
the first time its accessed. If you mark an association as extra lazy the following methods on collections
can be called without triggering a full load of the collection:
- ``Collection#contains($entity)``
- ``Collection#containsKey($key)``
- ``Collection#count()``
- ``Collection#get($key)``
- ``Collection#slice($offset, $length = null)``
For each of the above methods the following semantics apply:
- For each call, if the Collection is not yet loaded, issue a straight SELECT statement against the database.
- For each call, if the collection is already loaded, fallback to the default functionality for lazy collections. No additional SELECT statements are executed.
Additionally even with Doctrine ORM the following methods do not trigger the collection load:
- ``Collection#add($entity)``
- ``Collection#offsetSet($key, $entity)`` - ArrayAccess with no specific key ``$coll[] = $entity``, it does
not work when setting specific keys like ``$coll[0] = $entity``.
With extra lazy collections you can now not only add entities to large collections but also paginate them
easily using a combination of ``count`` and ``slice``.
.. warning::
``removeElement`` directly issued DELETE queries to the database from
version 2.4.0 to 2.7.0. This circumvents the flush operation and might run
outside a transactional boundary if you don't create one yourself. We
consider this a critical bug in the assumption of how the ORM works and
reverted ``removeElement`` EXTRA_LAZY behavior in 2.7.1.
Enabling Extra-Lazy Associations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The mapping configuration is simple. Instead of using the default value of ``fetch="LAZY"`` you have to
switch to extra lazy as shown in these examples:
.. configuration-block::
.. code-block:: attribute
<?php
namespace Doctrine\Tests\Models\CMS;
#[Entity]
class CmsGroup
{
/** @var Collection<int, CmsUser> */
#[ManyToMany(targetEntity: CmsUser::class, mappedBy: 'groups', fetch: 'EXTRA_LAZY')]
public Collection $users;
}
.. code-block:: xml
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://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\CMS\CmsGroup">
<!-- ... -->
<many-to-many field="users" target-entity="CmsUser" mapped-by="groups" fetch="EXTRA_LAZY" />
</entity>
</doctrine-mapping>

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