1
0
mirror of synced 2025-02-02 21:41:45 +03:00

412 Commits

Author SHA1 Message Date
1on
6f5b001a6b Clean post flush event added. Triggered after post flush after all clears. Event is flush-safe 2018-03-28 12:38:22 +03:00
Sergey Linnik
b3805549d9 Handle all errors in UnitOfWork commit 2017-08-31 11:38:49 +03:00
Marco Pivetta
dac1a16964 #6174 #5570 removed unused/dead code 2016-12-18 16:09:52 +01:00
Marco Pivetta
d9821d3fda #6174 #5570 CS - spacing 2016-12-18 16:09:45 +01:00
Marco Pivetta
576a4d7e31 #6174 #5570 CS - spacing 2016-12-18 16:09:38 +01:00
Marco Pivetta
eaee924180 #6174 #5570 flattened nested conditionals 2016-12-18 16:09:32 +01:00
Marco Pivetta
cf941ce54f #6174 #5570 documenting thrown exception types 2016-12-18 16:09:25 +01:00
Marco Pivetta
cfb7461f51 #6174 #5570 CS - alignment 2016-12-18 16:09:18 +01:00
bilouwan
25efabdb74 doMerge will mergeEntityStateIntoManagedCopy BEFORE persistNew to let lifecyle events changes be persisted 2016-12-18 16:08:15 +01:00
Guilherme Blanco
0ff512ba8f Fixed support for inverse side second level cache 2016-12-05 14:36:33 -03:00
Mathieu De Zutter
b0e4e3eda4 Remove old code in comments. 2016-09-10 20:16:33 +02:00
Mathieu De Zutter
95dcf51ad5 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-10 20:16:28 +02:00
Marco Pivetta
fecadf059c #5849 #5850 renamed clearEntityInsertions to clearEntityInsertionsForEntityName, for clarity 2016-06-06 00:32:01 +02:00
Marco Pivetta
800215040a #5849 #5850 refactored clearIdentityMapForEntityName to remove useless looping 2016-06-06 00:31:56 +02:00
Marco Pivetta
ec4dd4ab44 #5849 #5850 renamed clearIdentityMap to clearIdentityMapForEntityName, for clarity 2016-06-06 00:31:51 +02:00
Rico Humme
4a38c96ec5 Correct naming convention of function. Was confusing otherwise 2016-06-06 00:30:42 +02:00
Rico Humme
110d771883 Split of functionality in separate functions 2016-06-06 00:30:37 +02:00
Rico Humme
cd746beae2 Clear entityInsertions for specific entityName 2016-06-06 00:30:28 +02:00
Marco Pivetta
596e895763 #1573 - correcting docblock arguments/description 2015-12-11 20:18:42 +01:00
bilouwan
4148220f9c Refactor testing Proxy not initilized 2015-12-11 20:18:31 +01:00
bilouwan
216c466233 Unit test & fix for merge versionned entity 2015-12-11 20:18:12 +01:00
Lenard Palko
c68edec0c2 Fix skipping properties if they are listed after a not loaded relation. 2015-07-15 21:51:55 +01:00
Josef Kříž
e57be9da5e Fix: generated IDs are converted to integer 2015-03-23 17:51:04 +01: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
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
2bdc1142fe add string casting to id hashes 2015-03-17 21:08:06 +00:00
Jeroen Thora
a409e7591d Changed some wrong usage of the @internal phpdoc 2015-03-15 16:53:34 +01: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
2eb7dedf4f Refactored IdentifierFlattener 2015-02-16 00:53:46 +00: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
8910c2c482 DDC-2704 - data should be merged only into initialized proxies 2015-01-24 13:22:16 +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
Guilherme Blanco
2418f8f5e6 Removed todo by implementing it. 2015-01-18 22:21:18 -05: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
d0c0f43c79 #1228 DDC-3490 - preventing invalid association values from being persisted 2015-01-18 00:53:57 +01:00
flip111
d1a2655090 Update UnitOfWork.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
88e071d22d moved exception constructors out of UoW 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
57ce6ccfcf #1172 - fixed minor CS issues (spacing) 2015-01-16 22:54:30 +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
6fc0d84b7a DDC-3427 - s/EntityManager/EntityManagerInterface in type-hints 2015-01-16 14:21:30 +01:00
Guilherme Blanco
f90475772d Classify persisters into more granular namespaces. 2015-01-16 00:10:25 +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
Lars Strojny
8e4092750d Include IDs in the exception message to ease debugging 2015-01-13 02:41:05 +01:00
Carnage
00b6f62287 Fixed issue 2015-01-13 02:36:58 +01:00