@@ 18-39 (lines=22) @@ | ||
15 | * |
|
16 | * @final |
|
17 | */ |
|
18 | class PostCollectionLoadEventArgs extends ManagerEventArgs |
|
19 | { |
|
20 | /** @var PersistentCollectionInterface */ |
|
21 | private $collection; |
|
22 | ||
23 | public function __construct(PersistentCollectionInterface $collection, DocumentManager $dm) |
|
24 | { |
|
25 | if (self::class !== static::class) { |
|
26 | @trigger_error(sprintf('The class "%s" extends "%s" which will be final in MongoDB ODM 2.0.', static::class, self::class), E_USER_DEPRECATED); |
|
27 | } |
|
28 | parent::__construct($dm); |
|
29 | $this->collection = $collection; |
|
30 | } |
|
31 | ||
32 | /** |
|
33 | * Gets collection that was just initialized (loaded). |
|
34 | */ |
|
35 | public function getCollection() : PersistentCollectionInterface |
|
36 | { |
|
37 | return $this->collection; |
|
38 | } |
|
39 | } |
|
40 |
@@ 17-38 (lines=22) @@ | ||
14 | * |
|
15 | * @final |
|
16 | */ |
|
17 | class PreLoadEventArgs extends LifecycleEventArgs |
|
18 | { |
|
19 | /** @var array */ |
|
20 | private $data; |
|
21 | ||
22 | public function __construct(object $document, DocumentManager $dm, array &$data) |
|
23 | { |
|
24 | if (self::class !== static::class) { |
|
25 | @trigger_error(sprintf('The class "%s" extends "%s" which will be final in MongoDB ODM 2.0.', static::class, self::class), E_USER_DEPRECATED); |
|
26 | } |
|
27 | parent::__construct($document, $dm); |
|
28 | $this->data =& $data; |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * Get the array of data to be loaded and hydrated. |
|
33 | */ |
|
34 | public function &getData() : array |
|
35 | { |
|
36 | return $this->data; |
|
37 | } |
|
38 | } |
|
39 |