1
0
Fork 0
mirror of synced 2025-04-01 20:36:14 +03:00
Doctrine 2 Object Relational Mapper (ORM)
Find a file
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
bin Fix typo 2016-03-21 14:16:07 +02:00
docs Updated docs 2016-09-08 00:32:15 +02:00
lib/Doctrine/ORM Avoid conflicts due to spl_object_hash(). 2016-09-09 23:22:31 +02:00
tests Avoid conflicts due to spl_object_hash(). 2016-09-09 23:22:31 +02:00
tools/sandbox Region cache clear commands 2013-12-16 11:05:05 -05:00
.gitattributes Remove README.markdown from .gitattributes 2013-01-19 20:04:43 +01:00
.gitignore Added composer.lock to .gitignore 2013-03-07 14:12:10 +01:00
.gitmodules Removing submodules as of doctrine/doctrine2#570 2013-02-15 18:33:29 +01:00
.scrutinizer.yml Test suite is SLOOOOOOOOWWWWWW 2015-12-29 17:11:14 +01:00
.travis.yml Stop testing against PHP 5.5 2016-06-19 08:51:24 +02:00
build.properties New Build process 2013-09-07 12:56:49 +02:00
build.properties.dev Add support to distribute the XSD to a given directory during build process 2011-08-27 13:23:17 +02:00
build.xml New Build process 2013-09-07 12:56:49 +02:00
composer.json Merge pull request #5713 from OndraM/remove-coveralls 2016-07-31 03:19:42 +02:00
CONTRIBUTING.md Removing section about jira as it has been removed. 2016-02-17 11:02:19 +01:00
doctrine-mapping.xsd Allow override of inversedBy 2015-11-05 12:11:29 +01:00
LICENSE Updated year range 2015-09-29 22:52:45 +00:00
phpunit.xml.dist Fixed typos 2013-03-11 00:08:58 +00:00
README.md Cleanup no longer used coveralls settings 2016-03-12 01:24:56 +00:00
run-all.sh Fixed typos 2013-03-11 00:08:58 +00:00
SECURITY.md Add SECURITY.md and a chapter on security assumptions in Doctrine ORM. 2014-02-21 16:12:32 +01:00
UPGRADE.md #6001 documenting minor BC break in QueryCacheEntry#time type - specific version used 2016-09-08 13:51:21 +02:00

Master 2.5
Build status Build status
Coverage Status Coverage Status

Doctrine 2 is an object-relational mapper (ORM) for PHP 5.4+ 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: