Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 74-90 (lines=17) @@
71
    /**
72
     * {@inheritdoc}
73
     */
74
    public function getProperty($property, $root = null)
75
    {
76
        if ($this->cache === null) {
77
            $translatableFields = $this->getClassMetadata()->getFieldNames();
78
            $translationFields = $this->getDocumentManager()
79
                ->getClassMetadata($this->getClassMetadata()->getAssociationTargetClass($this->getTranslationAlias()))
80
                ->getFieldNames();
81
82
            $this->cache = array_diff($translationFields, $translatableFields);
83
        }
84
85
        if (in_array($property, $this->cache, true)) {
86
            $root = $this->getTranslationAlias();
87
        }
88
89
        return $this->getPropertyFromRepositoryTrait($property, $root);
90
    }
91
92
    /**
93
     * @return string

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

@@ 96-112 (lines=17) @@
93
    /**
94
     * {@inheritdoc}
95
     */
96
    public function getProperty($property, $root = null)
97
    {
98
        if ($this->cache === null) {
99
            $translatableFields = $this->getClassMetadata()->getFieldNames();
100
            $translationFields = $this->getEntityManager()
101
                ->getClassMetadata($this->getClassMetadata()->getAssociationMapping('translations')['targetEntity'])
102
                ->getFieldNames();
103
104
            $this->cache = array_diff($translationFields, $translatableFields);
105
        }
106
107
        if (in_array($property, $this->cache, true)) {
108
            $root = $this->getTranslationAlias($root);
109
        }
110
111
        return $this->getPropertyFromRepositoryTrait($property, $root);
112
    }
113
114
    /**
115
     * @param QueryBuilder|string|null $root