I see. Thanks for your reply.

Am Montag, 30. September 2019 12:10:31 UTC+2 schrieb Marco Pivetta:
>
> Heya,
>
> Yes, this is correct: the keys should remain stable after loading. 
> Collections also don't guarantee the keys to be integer-indexed or 
> string-indexed, so no assumptions are being made there: this is a design 
> decision that cannot be changed at this point without breaking BC for 
> others.
>
>
> Marco Pivetta 
>
> http://twitter.com/Ocramius      
>
> http://ocramius.github.com/
>
>
> On Mon, Sep 30, 2019 at 12:03 PM naitsirch <[email protected] 
> <javascript:>> wrote:
>
>> Hi,
>>
>> I would like to ask why `unset` is used when collection items are removed 
>> (e.g. 
>> https://github.com/doctrine/collections/blob/master/lib/Doctrine/Common/Collections/ArrayCollection.php#L150).
>>  
>> Is it required for other functions in Doctrine to work?
>>
>> The issue with `unset` is, that it leaves a "hole" in the array. This is 
>> no problem when you work with PHP. But when you are working with 
>> serialization (JSON) and Javascript in the frontend. This is a pain, 
>> because an PHP array that is missing one element, will be encoded as a JSON 
>> object instead of an array. And in the frontend where you work with 
>> Javascript, things like collection.map will fail because an object does not 
>> have `map`.
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "doctrine-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/doctrine-user/49879c7c-17f7-43ff-8f71-c5ed67af2c48%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/doctrine-user/49879c7c-17f7-43ff-8f71-c5ed67af2c48%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/doctrine-user/0a96c678-de64-4b9b-b2cc-765914062dee%40googlegroups.com.

Reply via email to