You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -215,42 +215,52 @@ public function getPropertyMetadata(string $propertyName): KeyValueStore
215
215
thrownew \InvalidArgumentException(sprintf('The "%s" field does not exist in the "%s" entity.', $propertyName, $this->getFqcn()));
216
216
}
217
217
218
+
publicfunctiongetClassMetadata(): ClassMetadata
219
+
{
220
+
return$this->metadata;
221
+
}
222
+
223
+
/**
224
+
* @deprecated since 4.27 and to be removed in 5.0, use $entityDto->getClassMetadata()->getFieldMapping($propertyName)->type and $entityDto->getClassMetadata()->getAssociationMapping($propertyName)->type() instead
thrownew \RuntimeException(sprintf('Could not guess a field class for "%s" field. It possibly is an association field or an embedded class field.', $fieldDto->getProperty()));
thrownew \RuntimeException(sprintf('The Doctrine type of the "%s" field is "%s", which is not supported by EasyAdmin. For Doctrine\'s Custom Mapping Types have a look at EasyAdmin\'s field docs.', $fieldDto->getProperty(), $doctrinePropertyType));
180
+
thrownew \RuntimeException(sprintf('The Doctrine type of the "%s" field is "%s", which is not supported by EasyAdmin. For Doctrine\'s Custom Mapping Types have a look at EasyAdmin\'s field docs.', $fieldDto->getProperty(), $doctrineFieldMappingType));
if (true === $field->getCustomOption(AssociationField::OPTION_RENDER_AS_EMBEDDED_FORM)) {
59
-
if (false === $entityDto->isToOneAssociation($propertyName)) {
59
+
if (false === $entityDto->getClassMetadata()->isSingleValuedAssociation($propertyName)) {
60
60
thrownew \RuntimeException(
61
61
sprintf(
62
62
'The "%s" association field of "%s" is a to-many association but it\'s trying to use the "renderAsEmbeddedForm()" option, which is only available for to-one associations. If you want to use a CRUD form to render to-many associations, use a CollectionField instead of the AssociationField.',
@@ -130,11 +130,11 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c
130
130
// * the route is not found, which happens when the associated entity is not accessible from this dashboard; do nothing in that case either.
131
131
}
132
132
} else {
133
-
if ($entityDto->isToOneAssociation($propertyName)) {
133
+
if ($entityDto->getClassMetadata()->isSingleValuedAssociation($propertyName)) {
134
134
$this->configureToOneAssociation($field);
135
135
}
136
136
137
-
if ($entityDto->isToManyAssociation($propertyName)) {
137
+
if ($entityDto->getClassMetadata()->isCollectionValuedAssociation($propertyName)) {
0 commit comments