[MODM-122] array_slice fails on ReferenceMany and EmbeddedMany fields Created: 17/Feb/11 Updated: 17/Feb/11 Resolved: 17/Feb/11
|Project:||Doctrine MongoDB ODM|
|Reporter:||Vitaliy Kaplich||Assignee:||Jonathan H. Wage|
CentOS, PHP 5.3
I am not sure if it's a bug of the framework or a bug in implementation of array_slice function in PHP
I know that PersistentCollection has method "slice" (at least in master branch) but my concern is backward compatibility with the code which treats ReferenceMany type fields as arrays.
Please let me know are there any workarounds for this or probably you guys are going to implement some fix?
Thanks a lot!
|Comment by Jonathan H. Wage [ 17/Feb/11 ]|
Hi, you need to pass an array so you can convert the iterator to an array with the iterator_to_array() method or call ->toArray() on the PersistentCollection. Then you can pass that array to array_slice()