Skip to content

Commit

Permalink
Fix exception if no localized fields are present (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbolka authored Dec 19, 2019
1 parent 15db891 commit efa597e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Divante/MagentoIntegrationBundle/Service/MapperService.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,16 @@ private function getAllFieldDataChilds($field)
*/
protected function getOptionsForSelect(string $elementName, Concrete $object)
{
$localizedFieldsArray = $object->getClass()->getFieldDefinition('localizedfields')->getReferencedFields();
$localizedFieldsArray[] = $object->getClass()->getFieldDefinition('localizedfields');
foreach ($localizedFieldsArray as $localizedFields) {
$dataFields = $this->getAllFieldDataChilds($localizedFields);
foreach ($dataFields as $field) {
if ($field->name == $elementName) {
return $field->getOptions();
$localizedFields = $object->getClass()->getFieldDefinition('localizedfields');
if ($localizedFields) {
$localizedFieldsArray = $localizedFields->getReferencedFields();
$localizedFieldsArray[] = $localizedFields;
foreach ($localizedFieldsArray as $localizedFields) {
$dataFields = $this->getAllFieldDataChilds($localizedFields);
foreach ($dataFields as $field) {
if ($field->name == $elementName) {
return $field->getOptions();
}
}
}
}
Expand Down

0 comments on commit efa597e

Please sign in to comment.