1
0
mirror of synced 2024-12-05 03:06:05 +03:00
Commit Graph

390 Commits

Author SHA1 Message Date
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
Marco Pivetta
516d04c391 #1001 DDC-3005 - Removing useless dependency from the HydrationCompleteHandler to the UnitOfWork 2015-01-13 00:31:32 +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
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
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
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
Dawid Spiechowicz
9c24e0b510 I can't look at those semicolons, sorry ;-) 2014-05-27 09:37:40 +02:00
Marco Pivetta
ccc789eadd DDC-3123 - the UoW should clear extra updates immediately 2014-05-15 00:18:50 +02:00
flack
5cf906d76b Remove some redundant clauses 2014-05-02 21:52:00 +02: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
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
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
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
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
Zacharias Luiten
8a168bb2ce stop executing executeDeletions when there is nothing to to delete anymore 2014-02-25 16:02:02 +01:00
Per Persson
3543ccea7f Pass class name to constructor. 2014-02-11 23:48:31 +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
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
Steve Müller
a6c8ab8a5f make lock mode usage consistent 2014-02-05 15:13:53 +01:00
Marco Pivetta
7a32eca039 DDC-2931 - Safe comparison between proxies and entities when refreshing objects 2014-02-01 01:57:51 +01:00