Closed pmccarren closed 10 years ago
@pmccarren Can you send only your "Set the att value on the model once generated." change to the "experimental" (3.0) branch please.
Sure, absolutely.
Great. :)
Good to go! :)
@GrahamCampbell One possible way to remove objects in reverse order is once we create an object, we can append its objectHash (what spl_object_hash generates) to a reference array, and then when needed, simply iterate over said array in reverse order. The one check you'd have to have is to ensure that the object still exists before you attempt to delete it. Thoughts? I'm happy to prototype this too
Yeh, would be nice, but would lead to poor performance of the isSaved function.
I assume you mean something like this under the hood:
$saved = array(
0 => array('our hash', object),
1 => array('our hash', object),
2 => array('our hash', object),
);
Hmmm. What if we were to simply have 2 completely separate arrays. That could be the answer!
$saved = array(
'hash a' => object3,
'hash b' => object1,
'hash c' => object2,
);
$map = array(
0 => 'hash b',
1 => 'hash c',
2 => 'hash a',
);
I'm going to get something to eat. I'll be back in 30 mins or so, and I'll take a look at this. Feel free to tackle this in a pull to 2.2 @pmccarren.
@GrahamCampbell yeah exactly! sorry I wasn't clear there. I believe two separate arrays is the key
Prototyped it over here: #316
Hmmm. I did want it in 2.2, rather than 3.0, but leave the pull open anyway so we can discuss it.
Would you like me to create a PR with this change into 2.2/master?
No, don't bother. When I've got time, I'll review your change against 3.0. Thanks for taking the time to contribute - it's much appreciated. :)
No problem! Glad to help out. using FactoryMuffin has made my testing experience so much better
One failing test here:
That confirms what I said inline. This will have to go into 2.2 because of the change in behaviour.