1
0
Fork 0
mirror of synced 2025-04-01 12:26:11 +03:00

DDC-737 - Implemented slice() on PersistentCollection for fowards compatibility reasons. The method will be required on Collection interface with the next Doctrine\Common release

This commit is contained in:
Benjamin Eberlei 2010-08-24 21:56:29 +02:00
parent d0717ee458
commit 241e4d2f53

View file

@ -661,4 +661,21 @@ final class PersistentCollection implements Collection
{
return $this->coll;
}
/**
* Extract a slice of $length elements starting at position $offset from the Collection.
*
* If $length is null it returns all elements from $offset to the end of the Collection.
* Keys have to be preserved by this method. Calling this method will only return the
* selected slice and NOT change the elements contained in the collection slice is called on.
*
* @param int $offset
* @param int $length
* @return array
*/
public function slice($offset, $length = null)
{
$this->initialize();
return $this->coll->slice($offset, $length);
}
}