PHP Classes

File: src/vendor/doctrine/collections/docs/en/derived-collections.rst

Recommend this page to a friend!
  Classes of walid laggoune   QPHP   src/vendor/doctrine/collections/docs/en/derived-collections.rst   Download  
File: src/vendor/doctrine/collections/docs/en/derived-collections.rst
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: QPHP
Exchange messages with a queue server using Swoole
Author: By
Last change:
Date: 2 years ago
Size: 738 bytes
 

Contents

Class file image Download
Derived Collections =================== You can create custom collection classes by extending the ``Doctrine\Common\Collections\ArrayCollection`` class. If the ``__construct`` semantics are different from the default ``ArrayCollection`` you can override the ``createFrom`` method: .. code-block:: php final class DerivedArrayCollection extends ArrayCollection { /** @var \stdClass */ private $foo; public function __construct(\stdClass $foo, array $elements = []) { $this->foo = $foo; parent::__construct($elements); } protected function createFrom(array $elements) : self { return new static($this->foo, $elements); } }