0

I have three entities:

class DataSet {
  string $name;
  Collection $points; // List<DataPoint>
  Collection $groups; // List<DataGroup>
}
class DataGroup {
  string $name;
  Collection $assignedPoints; // List<DataGroupPoint>
}
class DataPoint {
  string $name;
  Collection $assignedGroups; // List<DataGroupPoint>
}
class DataGroupPoint {
  DataGroup $group;
  DataPoint $point;
  int $data;
}

I extended the Admin UI to perform CRUD operations on the DataSet entity, as per docs. By looking at the ContactBundle Javascript extension, I was able to add CRUD operations for DataPoint entities within the DataSet form by registering a CardCollection - works fine.

Now, I want to perform CRUD operations on associated DataGroup entities of the DataSet as well - for that I want to put a MultiItemSelection component into the DataGroup overlay form in order to add, edit or remove DataGroupPoints.

For a DataGroupPoint entity, both the DataGroup and the DataPoint are supposed to belong to the same DataSet (which in turn is being edited in the overall form).

How can I provide all matching DataPoint entities to the MultiItemSelection?

Leon Willens
  • 356
  • 1
  • 16

1 Answers1

0

As far as I understand your question, you are looking for a custom data_point_selection content type.

To achieve this I can recommend you to take a look at the Sulu Workshop, especially assignment 11. In this assignment a single_location_selection is implemented. This is a selection for the custom entity location.

Another great example for a custom selection or single_selection is the example pull request of the sulu demo.

As a side note, the implementation of the ContactBundle is very specific for this case. Therefore the extendability and usability of the used components like CardCollection is not the best. For a better developer experience I would recommend you to stick to the documented content types in the docs. Unless you really need these specific components.

Prokyon
  • 128
  • 7
  • When looking at both the assignment changes and the pull request, I gained an understanding on how to implement these fields, however I don't understand how to apply additional repository filters. – Leon Willens Aug 30 '21 at 13:43