Unverified Commit 6be7ffa7 authored by Sebastian Castro's avatar Sebastian Castro
Browse files

Fixs exporting all elements

parent b2667723
......@@ -17,16 +17,16 @@ class ElementAdmin extends ElementAdminShowEdit
{
public function getExportFields()
{
$container = $this->getConfigurationPool()->getContainer();
$container = $this->getConfigurationPool()->getContainer();
$em = $container->get('doctrine_mongodb')->getManager();
$basicFields = [
'id' => 'id',
'name' => 'name',
'categories' => 'optionsString',
'latitude' => 'geo.latitude',
'longitude' => 'geo.longitude',
'id' => 'id',
'name' => 'name',
'categories' => 'optionsString',
'latitude' => 'geo.latitude',
'longitude' => 'geo.longitude',
'streetAddress' => 'address.streetAddress',
'addressLocality' => 'address.addressLocality',
'addressLocality' => 'address.addressLocality',
'postalCode' => 'address.postalCode',
'addressCountry' => 'address.addressCountry'
];
......@@ -36,31 +36,5 @@ class ElementAdmin extends ElementAdminShowEdit
$customFields[$prop] = 'data';
}
return array_merge($basicFields, $customFields);
}
public function getDataSourceIterator()
{
$datagrid = $this->getDatagrid();
$datagrid->buildPager();
$fields = [];
foreach ($this->getExportFields() as $key => $field) {
$label = $this->getTranslationLabel($field, 'export', 'label');
$transLabel = $this->trans($label);
// NEXT_MAJOR: Remove this hack, because all field labels will be translated with the major release
// No translation key exists
if ($transLabel == $label) {
$fields[$key] = $field;
} else {
$fields[$transLabel] = $field;
}
}
$datagrid->buildPager();
$query = $datagrid->getQuery();
return new DoctrineODMQuerySourceIterator($query instanceof ProxyQuery ? $query->getQuery() : $query, $fields);
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment