Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs about DataSource #1770

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/reference/data_source.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
Export / DataSource
===================

When using an admins export feature you might want to modify how dates and times are exported.
This is done by calling ``setDateTimeFormat`` on the data source iterator.
When using an admins export feature you might want to modify how values, such as dates, times and enumerations are exported.
This is done by calling convenience methods like ``setDateTimeFormat()`` and ``useBackedEnumValue()`` on the data source iterator.

Here's one way to do it:

1. Decorate the default Sonata\DoctrineORMAdminBundle\Exporter\DataSource with your own and call ``setDateTimeFormat`` there.::
1. Decorate the default Sonata\DoctrineORMAdminBundle\Exporter\DataSource with your own and calls there.::

namespace App\Service\Admin;

Expand All @@ -34,6 +34,7 @@ Here's one way to do it:
$iterator = $this->dataSource->createIterator($query, $fields);

$iterator->setDateTimeFormat('Y-m-d H:i:s');
$iterator->useBackedEnumValue(false);

return $iterator;
}
Expand Down
Loading