diff options
Diffstat (limited to 'vendor/doctrine/collections/docs/en/derived-collections.rst')
| -rw-r--r-- | vendor/doctrine/collections/docs/en/derived-collections.rst | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/vendor/doctrine/collections/docs/en/derived-collections.rst b/vendor/doctrine/collections/docs/en/derived-collections.rst deleted file mode 100644 index 03d9da5..0000000 --- a/vendor/doctrine/collections/docs/en/derived-collections.rst +++ /dev/null | |||
| @@ -1,26 +0,0 @@ | |||
| 1 | Derived Collections | ||
| 2 | =================== | ||
| 3 | |||
| 4 | You can create custom collection classes by extending the | ||
| 5 | ``Doctrine\Common\Collections\ArrayCollection`` class. If the | ||
| 6 | ``__construct`` semantics are different from the default ``ArrayCollection`` | ||
| 7 | you can override the ``createFrom`` method: | ||
| 8 | |||
| 9 | .. code-block:: php | ||
| 10 | final class DerivedArrayCollection extends ArrayCollection | ||
| 11 | { | ||
| 12 | /** @var \stdClass */ | ||
| 13 | private $foo; | ||
| 14 | |||
| 15 | public function __construct(\stdClass $foo, array $elements = []) | ||
| 16 | { | ||
| 17 | $this->foo = $foo; | ||
| 18 | |||
| 19 | parent::__construct($elements); | ||
| 20 | } | ||
| 21 | |||
| 22 | protected function createFrom(array $elements) : self | ||
| 23 | { | ||
| 24 | return new static($this->foo, $elements); | ||
| 25 | } | ||
| 26 | } | ||
