You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.
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:
Use getLineFormatter, in there pull the appropriate repository entity referenced from your datatable entity and place whatever data you want into a VirtualColumn
Something like this could work for you ... (located in your EntityDatatable class)
Modify your datatableQueryBuilder in the controller to join your tables before it gets to the datatable.
This code would be located in your Controller for the datatable, and you would then use the QueryBuilder to join whichever tables you want. This example filters out any non-enabled users in my project.
try {
$datatable = $this->dtFactory->create(UserDatatable::class);
$datatable->buildDatatable();
if ($isAjax) {
$responseService = $this->dtResponse;
$responseService->setDatatable($datatable);
$datatableQueryBuilder = $responseService->getDatatableQueryBuilder();
/* Get only users that are enabled */
/** @var QueryBuilder $qb */
$qb = $datatableQueryBuilder->getQb();
// NOTE: entityName must preface a non-relational property
$qb->andWhere("user.enabled = :c");
// DO WHATEVER JOINS YOU WANT TO DO HERE ...
$qb->setParameter('c', true);
return $responseService->getResponse();
}
return $this->render('admin/user_home.html.twig', array(
'datatable' => $datatable,
));
}
I don't know if there is a "best-practices" for what you're trying to accomplish.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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:
My builder fields:
So as you can see, other nested relations are working fine. Relating to this issue: #826 I've aslo tried to add this fields:
but it's still the same. Any ideas? You can notice that company field in Ip entity is nullable.
The text was updated successfully, but these errors were encountered: