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:
parent
d0717ee458
commit
241e4d2f53
1 changed files with 17 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue