/** * {@inheritdoc} */ protected function addFields(array &$result, $className, EntityManager $em, $withVirtualFields, $applyExclusions, $translate) { // in workflow exclusions not used $applyExclusions = false; parent::addFields($result, $className, $em, $withVirtualFields, $applyExclusions, $translate); $metadata = $em->getClassMetadata($className); // add single association fields foreach ($metadata->getAssociationNames() as $associationName) { if (!$this->isWorkflowField($associationName) && $metadata->isSingleValuedAssociation($associationName)) { if (isset($result[$associationName])) { // skip because a field with this name is already added, it could be a virtual field continue; } if (!$this->entityConfigProvider->hasConfig($metadata->getName(), $associationName)) { // skip non configurable relation continue; } if ($this->isIgnoredField($metadata, $associationName)) { continue; } if ($applyExclusions && $this->exclusionProvider->isIgnoredField($metadata, $associationName)) { continue; } $this->addField($result, $associationName, $this->getRelationFieldType($className, $associationName), $this->getFieldLabel($className, $associationName), false, $translate); } } }
/** * {@inheritdoc} */ protected function addFields(array &$result, $className, $applyExclusions, $translate) { // exclusions are not used in workflow parent::addFields($result, $className, false, $translate); $metadata = $this->getMetadataFor($className); // add single association fields foreach ($metadata->getAssociationNames() as $associationName) { if ($this->isIgnoredInWorkflow($metadata, $associationName)) { continue; } if (isset($result[$associationName])) { // skip because a field with this name is already added, it could be a virtual field continue; } if (!$this->entityConfigProvider->hasConfig($metadata->getName(), $associationName)) { // skip non configurable relation continue; } $label = $this->getFieldLabel($className, $associationName); $field = ['name' => $associationName, 'type' => $this->getRelationFieldType($className, $associationName), 'label' => $translate ? $this->translator->trans($label) : $label]; $result[$associationName . '-field'] = $field; } }