summaryrefslogtreecommitdiff
path: root/vendor/doctrine/collections/docs/en/derived-collections.rst
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2024-08-13 23:45:21 +0200
committerpolo <ordipolo@gmx.fr>2024-08-13 23:45:21 +0200
commitbf6655a534a6775d30cafa67bd801276bda1d98d (patch)
treec6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/doctrine/collections/docs/en/derived-collections.rst
parent94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff)
downloadAppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/collections/docs/en/derived-collections.rst')
-rw-r--r--vendor/doctrine/collections/docs/en/derived-collections.rst26
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/doctrine/collections/docs/en/derived-collections.rst b/vendor/doctrine/collections/docs/en/derived-collections.rst
new file mode 100644
index 0000000..03d9da5
--- /dev/null
+++ b/vendor/doctrine/collections/docs/en/derived-collections.rst
@@ -0,0 +1,26 @@
1Derived Collections
2===================
3
4You 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``
7you 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 }