Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Double nested entities problem #874

Open
@konradja100

Description

@konradja100

I've found some issues with double nested relation between entities. Entity "SiteVisit" has ManyToOne relation with "Ip", and "Ip" has ManyToOne relation with "Company".

Everything is working fine, but when i try to search by Company.name field, i get this error:

screenshot_33

My builder fields:

$this->columnBuilder
                ->add('id', Column::class, [
                    'title' => 'Id',
                    'searchable' => false
                ])
                ->add('newStartedAt', DateTimeColumn::class, [
                    'title' => $this->translator->trans('site_visit.started_at'),
                    'date_format' => 'YYYY-MM-DD hh:mm:ss',
                    'name' => 'datefilter',
                    'filter' => [DateRangeFilter::class, [
                        'cancel_button' => true,
                    ]],
                ])
                ->add('ip.number', Column::class, [
                    'title' => $this->translator->trans('ip.number'),
                    'filter' => [TextFilter::class,
                        [
                            'cancel_button' => true,
                        ],
                ]])
                ->add('ip.status', Column::class, [
                    'title' => $this->translator->trans('ip.status'),
                    'filter' => [SelectFilter::class,
                        [
                            'multiple' => false,
                            'cancel_button' => false,
                            'search_type' => 'eq',
                            'select_options' =>
                                [ '' => $this->translator->trans('label.all') ]
                                + $this->getOptionsArrayFromEntities($ipStatuses, 'id', 'name')
                        ],
                ]])
                ->add('ip.country.alpha2Code', Column::class, [
                    'title' => $this->translator->trans('ip.country_code'),
                    'filter' => [TextFilter::class,
                        [
                            'cancel_button' => true,
                        ],
                ]])
                ->add('ip.hostname', Column::class, [
                    'title' => $this->translator->trans('ip.hostname'),
                    'filter' => [TextFilter::class,
                        [
                            'cancel_button' => true,
                        ],
                ]])
                ->add('ip.company.name', Column::class, [
                    'title' => $this->translator->trans('ip.company_name'),
                    'default_content' => '',
                    'filter' => [TextFilter::class,
                        [
                            'cancel_button' => true,
                        ],
                ]])
                ->add('ip.status.name', Column::class, [
                    'searchable' => false,
                    'visible' => false,
                ])
                ->add(null, ActionColumn::class, [
                    'title' => '',
                    'actions' => [
                        [
                            'route' => 'app_site_visit_views',
                            'route_parameters' => ['site' => 'site.id', 'id' => 'id'],
                            'label' => $this->translator->trans('action.show'),
                            'attributes' => [
                                'rel' => 'tooltip',
                                'title' => $this->translator->trans('action.show'),
                                'class' => 'btn btn-action btn-sm btn-default',
                                'role' => 'button',
                            ],
                        ],
                    ],
                ])
            ;

So as you can see, other nested relations are working fine. Relating to this issue: #826 I've aslo tried to add this fields:

                ->add('ip.company.id', Column::class, [
                    'searchable' => false,
                    'visible' => false,
                ])
                ->add('ip.id', Column::class, [
                    'searchable' => false,
                    'visible' => false,
                ])

but it's still the same. Any ideas? You can notice that company field in Ip entity is nullable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions