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?
As far as I understand your question, you are looking for a custom
data_point_selectioncontent 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_selectionis implemented. This is a selection for the custom entitylocation.Another great example for a custom
selectionorsingle_selectionis the example pull request of the sulu demo.As a side note, the implementation of the
ContactBundleis very specific for this case. Therefore the extendability and usability of the used components likeCardCollectionis 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.