Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0.0ALPHA2
-
Fix Version/s: 1.0.0BETA2
-
Component/s: Persister
-
Labels:None
Description
After changing ordering of elements in collection, it is persisted incorrectly (with different ordering than expected).
Here is a test case:
/** @Document(collection="tests", db="tests") */ class doc { /** @Id */ protected $id; /** @EmbedMany(targetDocument="emb") */ protected $collection; function __construct($c) {$this->set($c);} function set($c) {$this->collection = $c;} function get() {return $this->collection;} } /** @EmbeddedDocument */ class emb { /** @String */ protected $val; function __construct($val) {$this->val = $val;} function get() {return $this->val;} } $collection = new ArrayCollection(array( new emb('0'), new emb('1'), new emb('2') )); // TEST CASE: $doc = new doc($collection); $dm->persist($doc); $dm->flush(); // place element '0' after '1' $collection = new ArrayCollection(array( $collection[1], $collection[0], $collection[2] )); $doc->set($collection); $dm->persist($doc); $dm->flush(); $dm->refresh($doc); foreach($doc->get() as $value) { echo $value->get() . "\n"; } // expecting: // 1 // 0 // 2 // getting: // 2 // 1 // 0
Is it an issue? Or is it supposed that ordering should be resolved in application code?
Activity
Jonathan H. Wage
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Fix Version/s | 1.0.0BETA1 [ 10080 ] | |
| Affects Version/s | 1.0.0ALPHA2 [ 10065 ] | |
| Affects Version/s | 1.0.0ALPHA1 [ 10064 ] |
Jonathan H. Wage
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
Vladimir Razuvaev
made changes -
| Resolution | Fixed [ 1 ] | |
| Status | Resolved [ 5 ] | Reopened [ 4 ] |
Jonathan H. Wage
made changes -
| Status | Reopened [ 4 ] | Resolved [ 5 ] |
| Fix Version/s | 1.0.0BETA2 [ 10092 ] | |
| Fix Version/s | 1.0.0BETA1 [ 10080 ] | |
| Resolution | Fixed [ 1 ] |
This list may be incomplete, as errors occurred whilst retrieving source from linked applications:
- Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=MODM-29, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
Hi, I think we should try and make it maintain the order. I will investigate.