Code Duplication    Length = 19-19 lines in 2 locations

src/Component/Translation/Repository/Doctrine/MongoDB/TranslatableRepository.php 1 location

@@ 66-84 (lines=19) @@
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function getProperty($property, $root = null)
67
    {
68
        if ($this->cache === null) {
69
            $translationMetadata = $this
70
                ->getDocumentManager()
71
                ->getClassMetadata($this->getClassMetadata()->getAssociationTargetClass($this->getTranslationAlias()));
72
73
            $this->cache = array_diff(
74
                $this->getProperties($translationMetadata),
75
                $this->getProperties($this->getClassMetadata())
76
            );
77
        }
78
79
        if (in_array($this->getRootProperty($property), $this->cache, true)) {
80
            $root = $this->getTranslationAlias();
81
        }
82
83
        return parent::getProperty($property, $root);
84
    }
85
86
    /**
87
     * @return string

src/Component/Translation/Repository/Doctrine/ORM/TranslatableRepository.php 1 location

@@ 88-106 (lines=19) @@
85
    /**
86
     * {@inheritdoc}
87
     */
88
    public function getProperty($property, $root = null)
89
    {
90
        if ($this->cache === null) {
91
            $translationMetadata = $this
92
                ->getEntityManager()
93
                ->getClassMetadata($this->getClassMetadata()->getAssociationMapping('translations')['targetEntity']);
94
95
            $this->cache = array_diff(
96
                $this->getProperties($translationMetadata),
97
                $this->getProperties($this->getClassMetadata())
98
            );
99
        }
100
101
        if (in_array($this->getRootProperty($property), $this->cache, true)) {
102
            $root = $this->getTranslationAlias($root);
103
        }
104
105
        return parent::getProperty($property, $root);
106
    }
107
108
    /**
109
     * @param QueryBuilder|string|null $root