EasyAdmin: is there any way to have entity's fileds when calling setTemplatePath method in easyadmin?

46 Views Asked by At

Is there any way to get more than one filed of an entity when calling setTemplatePath() method in easyadmin ?

for example :

I have an entity called OperatorSystem which has 3 properties : id, label and status.

I want to show operator label based on status flag. So in my twig file I need both label and status.

I tried to call entity.status but it doesn't work.

For now I can show in my twig the operator's name like this:

{% set operator = field.value|upper %}

But I need to have status for if else condition.

public function configureFields(string $pageName): iterable
    {
    yield TextField::new(SystemConstants::FIELD_OPERATOR_ID)
                ->setLabel(SystemConstants::FIELD_OPERATOR_LABEL)
                ->setSortable(false)
                ->setHelp(SystemConstants::FIELD_OPERATOR_HELP)
                ->setTemplatePath(UtilityConstants::OPERATOR_TEMPLATE_PATH);
0

There are 0 best solutions below