| @@ 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 |
|
| @@ 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 |
|