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
Feature: Add Relation Filter Type to Custom Reports #16618
base: 11.x
Are you sure you want to change the base?
Feature: Add Relation Filter Type to Custom Reports #16618
Conversation
Review Checklist
|
@gjorgic thx very much. could you please have a look at phpstan? |
I found one issue with opening filter when column is not visible; i will fix today |
Quality Gate passedIssues Measures |
now is ready 🎉 |
} | ||
|
||
return ['data' => $data, 'total' => $total]; | ||
} | ||
|
||
protected function loadRelationData(array &$data): void | ||
{ | ||
$columnsDictionary = $this->getRelationColumns(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is empty, we could skip the whole function, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gjorgic 🏓
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, can you check now
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Quality Gate passedIssues Measures |
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx very much for the contribution.
sadly, there are some things which do not work yet, especially with the many-to-many filters.
when setting up a many-to-many object relation filter, I get following error message while opening the report (same for many-to-many asset relation):
URL: /admin/bundle/customreports/custom-report/data?xaction=read&_dc=1713528851388
Method: POST
Message: Pimcore\Bundle\CustomReportsBundle\Tool\Adapter\Sql::loadElementById(): Argument #1 ($id) must be of type int, string given, called in /var/www/html/dev/pimcore/pimcore/bundles/CustomReportsBundle/src/Tool/Adapter/Sql.php on line 92
Trace:
in /var/www/html/dev/pimcore/pimcore/bundles/CustomReportsBundle/src/Tool/Adapter/Sql.php:127
also I'm not sure, if the many-to-many filters work at all. at least in my tests, they didn't filter correctly.
having a look at the implementation, I'm not too sure if that can work at all?!?
when opening the many-to-many object relation modal, the field name says undefined
:
maybe it would make sense to limit that filter feature for many-to-one fields for now?
gridColConfig["filter"] = colConfig["filter"]; | ||
this.gridfilters[colConfig["name"]] = colConfig["filter"]; | ||
} else { | ||
var relationFilterKey = colConfig["filter"].match(this.RELATION_FILTER_REGEX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use const
or let
where possible for new things...
* | ||
* @return string | ||
*/ | ||
public function getHumanReadableElementName(): string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add some documentation about that feature and how to use it, see also https://pimcore.com/docs/platform/Pimcore/Tools_and_Features/Custom_Reports/
@gjorgic did you already had a chance to have a look at my comments? Thx very much! |
Hi @fashxp yes, i go through comment, but i Will not be able make update untill end of next week. Regarding many to many relation, is there chance that issue is related to custom sql query and casting columns to int? If that cause issue do you have any preference how it should be handeled? Regarding JS i want keep writing style as is, but ofc, i Can change var to let |
@gjorgic thx for you reply, no rush! Regarding many-to-many: the thing is, that many-to-many is stored as csv in the query table, e.g. |
Changes in this pull request
Introduce new feature to Custom Reports
Additional info
user will be able some column mark as relation (document, asset or object) and will have ability to filter on same way he can on object grid depending on relation type;
When column is marked as relation, data for that column will be resolved by id and element path will be shown
Future improvement can have some CustomReportShownInGrid interface for object attribute which will display formatted name