summaryrefslogtreecommitdiff
path: root/vendor/doctrine/persistence/src/Persistence/ObjectManagerDecorator.php
blob: 8c038b8e82dde07f70389b72a51266d3cb82e57b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php

declare(strict_types=1);

namespace Doctrine\Persistence;

use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\ClassMetadataFactory;

/**
 * Base class to simplify ObjectManager decorators
 *
 * @template-covariant TObjectManager of ObjectManager
 */
abstract class ObjectManagerDecorator implements ObjectManager
{
    /** @var TObjectManager */
    protected $wrapped;

    /**
     * {@inheritDoc}
     */
    public function find(string $className, $id)
    {
        return $this->wrapped->find($className, $id);
    }

    public function persist(object $object)
    {
        $this->wrapped->persist($object);
    }

    public function remove(object $object)
    {
        $this->wrapped->remove($object);
    }

    public function clear(): void
    {
        $this->wrapped->clear();
    }

    public function detach(object $object)
    {
        $this->wrapped->detach($object);
    }

    public function refresh(object $object)
    {
        $this->wrapped->refresh($object);
    }

    public function flush()
    {
        $this->wrapped->flush();
    }

    /**
     * {@inheritDoc}
     */
    public function getRepository(string $className)
    {
        return $this->wrapped->getRepository($className);
    }

    /**
     * {@inheritDoc}
     */
    public function getClassMetadata(string $className)
    {
        return $this->wrapped->getClassMetadata($className);
    }

    /** @psalm-return ClassMetadataFactory<ClassMetadata<object>> */
    public function getMetadataFactory()
    {
        return $this->wrapped->getMetadataFactory();
    }

    public function initializeObject(object $obj)
    {
        $this->wrapped->initializeObject($obj);
    }

    /**
     * {@inheritDoc}
     */
    public function contains(object $object)
    {
        return $this->wrapped->contains($object);
    }
}