getParentMetadataForProperty()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\DoctrineMongoDBAdminBundle\Guesser;
15
16
use Doctrine\ODM\MongoDB\Mapping\MappingException;
17
use Sonata\AdminBundle\Guesser\TypeGuesserInterface;
18
use Sonata\DoctrineMongoDBAdminBundle\Model\ModelManager;
19
20
abstract class AbstractTypeGuesser implements TypeGuesserInterface
21
{
22
    /**
23
     * @param string $baseClass
24
     * @param string $propertyFullName
25
     *
26
     * @return array|null
27
     */
28
    protected function getParentMetadataForProperty($baseClass, $propertyFullName, ModelManager $modelManager)
29
    {
30
        try {
31
            return $modelManager->getParentMetadataForProperty($baseClass, $propertyFullName);
32
        } catch (MappingException $e) {
33
            // no metadata found.
34
            return null;
35
        }
36
    }
37
}
38