@@ 91-110 (lines=20) @@ | ||
88 | * |
|
89 | * @return string|null |
|
90 | */ |
|
91 | protected function getEmailFromRelatedObject($object) |
|
92 | { |
|
93 | $applicableRelations = $this->getApplicableRelations($object); |
|
94 | if (empty($applicableRelations)) { |
|
95 | return null; |
|
96 | } |
|
97 | ||
98 | $targetEntities = $this->getTargetEntities(); |
|
99 | $propertyAccessor = PropertyAccess::createPropertyAccessor(); |
|
100 | foreach ($targetEntities as $className) { |
|
101 | if (!isset($applicableRelations[$className])) { |
|
102 | continue; |
|
103 | } |
|
104 | foreach ($applicableRelations[$className] as $fieldName) { |
|
105 | return $this->getEmail($propertyAccessor->getValue($object, $fieldName)); |
|
106 | } |
|
107 | } |
|
108 | ||
109 | return null; |
|
110 | } |
|
111 | ||
112 | /** |
|
113 | * @param object $object |
@@ 176-195 (lines=20) @@ | ||
173 | * |
|
174 | * @return string|null |
|
175 | */ |
|
176 | protected function getPhoneNumberFromRelatedObject($object) |
|
177 | { |
|
178 | $applicableRelations = $this->getApplicableRelations($object); |
|
179 | if (empty($applicableRelations)) { |
|
180 | return null; |
|
181 | } |
|
182 | ||
183 | $targetEntities = $this->getTargetEntities(); |
|
184 | $propertyAccessor = PropertyAccess::createPropertyAccessor(); |
|
185 | foreach ($targetEntities as $className) { |
|
186 | if (!isset($applicableRelations[$className])) { |
|
187 | continue; |
|
188 | } |
|
189 | foreach ($applicableRelations[$className] as $fieldName) { |
|
190 | return $this->getPhoneNumber($propertyAccessor->getValue($object, $fieldName)); |
|
191 | } |
|
192 | } |
|
193 | ||
194 | return null; |
|
195 | } |
|
196 | ||
197 | /** |
|
198 | * @param object $object |