| @@ 14-44 (lines=31) @@ | ||
| 11 | /** |
|
| 12 | * @deprecated This class was deprecated in MongoDB ODM 2.0.0. Please use Doctrine\ODM\MongoDB\Proxy\Resolver\ProxyManagerClassNameResolver instead |
|
| 13 | */ |
|
| 14 | final class ClassNameResolver |
|
| 15 | { |
|
| 16 | /** @var Configuration */ |
|
| 17 | private $configuration; |
|
| 18 | ||
| 19 | public function __construct(Configuration $configuration) |
|
| 20 | { |
|
| 21 | $this->configuration = $configuration; |
|
| 22 | } |
|
| 23 | ||
| 24 | /** |
|
| 25 | * Gets the real class name of a class name that could be a proxy. |
|
| 26 | */ |
|
| 27 | public function getRealClass(string $class) : string |
|
| 28 | { |
|
| 29 | return $this->getClassNameInflector()->getUserClassName($class); |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Gets the real class name of an object (even if its a proxy). |
|
| 34 | */ |
|
| 35 | public function getClass(object $object) : string |
|
| 36 | { |
|
| 37 | return $this->getRealClass(get_class($object)); |
|
| 38 | } |
|
| 39 | ||
| 40 | private function getClassNameInflector() : ClassNameInflectorInterface |
|
| 41 | { |
|
| 42 | return $this->configuration->getProxyManagerConfiguration()->getClassNameInflector(); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| @@ 14-44 (lines=31) @@ | ||
| 11 | /** |
|
| 12 | * @internal |
|
| 13 | */ |
|
| 14 | final class ProxyManagerClassNameResolver implements ClassNameResolver |
|
| 15 | { |
|
| 16 | /** @var Configuration */ |
|
| 17 | private $configuration; |
|
| 18 | ||
| 19 | public function __construct(Configuration $configuration) |
|
| 20 | { |
|
| 21 | $this->configuration = $configuration; |
|
| 22 | } |
|
| 23 | ||
| 24 | /** |
|
| 25 | * Gets the real class name of a class name that could be a proxy. |
|
| 26 | */ |
|
| 27 | public function getRealClass(string $class) : string |
|
| 28 | { |
|
| 29 | return $this->getClassNameInflector()->getUserClassName($class); |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Gets the real class name of an object (even if its a proxy). |
|
| 34 | */ |
|
| 35 | public function getClass(object $object) : string |
|
| 36 | { |
|
| 37 | return $this->getRealClass(get_class($object)); |
|
| 38 | } |
|
| 39 | ||
| 40 | private function getClassNameInflector() : ClassNameInflectorInterface |
|
| 41 | { |
|
| 42 | return $this->configuration->getProxyManagerConfiguration()->getClassNameInflector(); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||