Add methods to be used by AdminBundle#233
Add methods to be used by AdminBundle#233VincentLanglet wants to merge 1 commit intosonata-project:masterfrom VincentLanglet:improveInterface
Conversation
|
I have only one issue. SonataAdminBundle Datagrid use in the And That's why the AdminBundle Datagrid works with I wouldlike that the DatagridBundle Datagrid works with FieldDescriptionInterface but I don't know how to import this class.
Any advice @greg0ire ? |
This should be BC, and sounds good to me. You could have the admin interface extend the datagrid interface. |
Let's go with this interface FieldDescriptionInterface
{
public function setFieldName($fieldName);
public function getFieldName();
public function setName($name);
public function getName();
public function getOption($name, $default = null);
public function setOption($name, $value);
public function setOptions(array $options);
public function getOptions();
public function setTemplate($template);
public function getTemplate();
public function setType($type);
public function getType();
public function setParent(AdminInterface $parent);
public function getParent();
public function setAssociationMapping($associationMapping);
public function getAssociationMapping();
public function getTargetEntity();
public function setFieldMapping($fieldMapping);
public function getFieldMapping();
public function setParentAssociationMappings(array $parentAssociationMappings);
public function getParentAssociationMappings();
public function setAssociationAdmin(AdminInterface $associationAdmin);
public function getAssociationAdmin();
public function isIdentifier();
public function getValue($object);
public function setAdmin(AdminInterface $admin);
public function getAdmin();
public function mergeOption($name, array $options = []);
public function mergeOptions(array $options = []);
public function setMappingType($mappingType);
public function getMappingType();
public function getLabel();
public function getTranslationDomain();
public function isSortable();
public function getSortFieldMapping();
public function getSortParentAssociationMapping();
public function getFieldValue($object, $fieldName);
}For the Datagrid, I only need the methods
If I want to add the
So I can make a smaller interface interface FieldInterface
{
public function setName($name);
public function getName();
public function getOption($name, $default = null);
public function setOption($name, $value);
public function setOptions(array $options);
public function getOptions();
public function mergeOption($name, array $options = []);
public function mergeOptions(array $options = []);
public function getLabel();
public function getTranslationDomain();
public function isSortable();
public function getSortFieldMapping();
public function getSortParentAssociationMapping();
}I just don't know if I should have in this interface Or if this should be in the Admin one. Any idea @greg0ire ? And I don't think these methods Are needed in the interface, since it's just helpers called once ; in the datagrid. And I could use After these decisions, I'll start the PR :) |
I don't know either, it's unclear to me what the scope of datagrid is, and what these methods do. Let's see if other @sonata-project/contributors that also, you know, use Sonata think :P |
I feel sad for your company for not using the excellent Sonata bundles ! @core23 Made some PR on this bundle, maybe he'll know. |
| return false; | ||
| } | ||
|
|
||
| public function hasDisplayableFilters(): bool |
There was a problem hiding this comment.
I'm not sure if we should add this method. Showing a filter or not is logic for the UI, not the general lib
There was a problem hiding this comment.
What is the purpose of the library ?
hasActiveFilters and hasDisplayableFilters are really similar. I think it's better to have the two methods in the same Interface/class.
Currently we have a loooot of duplicated code/really similar code. I want to deal with this, and I think we'll have to make some small trade-off.
There are some others UI method in this bundle, like Filter::getRenderSettings, or getTranslationDomain. The Datagrid class is also mainly a UI class, and is never use by others bundle. They only use the Pager and the ProxyQuery.
|
Closing in favor of #239 |
Subject
I am targeting this branch, because BC-break.
The AdminBundle and the DatagridBundle has a lot of classes in common.
I would like that the AdminBundle requires the DatagridBundle and use his classes.
But currently some methods are missing in the interface, so I added them.
Changelog