These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Doctrine\ODM\MongoDB\Event; |
||
6 | |||
7 | use Doctrine\Common\Persistence\Event\OnClearEventArgs as BaseOnClearEventArgs; |
||
8 | use Doctrine\ODM\MongoDB\DocumentManager; |
||
9 | use const E_USER_DEPRECATED; |
||
10 | use function assert; |
||
11 | use function sprintf; |
||
12 | use function trigger_error; |
||
13 | |||
14 | /** |
||
15 | * Provides event arguments for the onClear event. |
||
16 | * |
||
17 | * @final |
||
18 | */ |
||
19 | class OnClearEventArgs extends BaseOnClearEventArgs |
||
20 | { |
||
21 | public function __construct($objectManager, $entityClass = null) |
||
22 | { |
||
23 | if (self::class !== static::class) { |
||
24 | @trigger_error(sprintf('The class "%s" extends "%s" which will be final in MongoDB ODM 2.0.', static::class, self::class), E_USER_DEPRECATED); |
||
0 ignored issues
–
show
|
|||
25 | } |
||
26 | parent::__construct($objectManager, $entityClass); |
||
27 | } |
||
28 | |||
29 | public function getDocumentManager() : DocumentManager |
||
30 | { |
||
31 | $dm = $this->getObjectManager(); |
||
32 | assert($dm instanceof DocumentManager); |
||
33 | return $dm; |
||
34 | } |
||
35 | |||
36 | public function getDocumentClass() : ?string |
||
37 | { |
||
38 | return $this->getEntityClass(); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Returns whether this event clears all documents. |
||
43 | */ |
||
44 | public function clearsAllDocuments() : bool |
||
45 | { |
||
46 | return $this->clearsAllEntities(); |
||
47 | } |
||
48 | } |
||
49 |
If you suppress an error, we recommend checking for the error condition explicitly: