3232use Symfony \Component \HttpFoundation \Response ;
3333use Symfony \Component \HttpKernel \Exception \NotFoundHttpException ;
3434use Symfony \Component \Security \Http \Attribute \IsGranted ;
35+ use Symfony \Contracts \Translation \TranslatorInterface ;
3536
3637#[IsGranted('ROLE_USER ' )]
3738class ProcessExecutionCrudController extends AbstractCrudController
3839{
3940 public function __construct (
4041 private readonly ProcessExecutionRepository $ processExecutionRepository ,
4142 private readonly string $ logDirectory ,
43+ private readonly TranslatorInterface $ translator ,
4244 ) {
4345 }
4446
@@ -52,12 +54,12 @@ public function configureFields(string $pageName): iterable
5254 return [
5355 TextField::new ('code ' ),
5456 EnumField::new ('status ' ),
55- DateTimeField::new ('startDate ' )->setFormat ('Y/M/dd H:mm:ss ' ),
56- DateTimeField::new ('endDate ' )->setFormat ('Y/M/dd H:mm:ss ' ),
57+ DateTimeField::new ('startDate ' )->setFormat ('short ' , ' medium ' ),
58+ DateTimeField::new ('endDate ' )->setFormat ('short ' , ' medium ' ),
5759 TextField::new ('source ' )->setTemplatePath ('@CleverAgeUiProcess/admin/field/process_source.html.twig ' ),
5860 TextField::new ('target ' )->setTemplatePath ('@CleverAgeUiProcess/admin/field/process_target.html.twig ' ),
5961 TextField::new ('duration ' )->formatValue (function ($ value , ProcessExecution $ entity ) {
60- return $ entity ->duration (); // returned format can be changed here
62+ return $ entity ->duration ($ this -> translator -> trans ( ' %H hour(s) %I min(s) %S s ' ) ); // returned format can be changed here
6163 }),
6264 ArrayField::new ('report ' )->setTemplatePath ('@CleverAgeUiProcess/admin/field/report.html.twig ' ),
6365 ContextField::new ('context ' ),
0 commit comments