dachcom-digital / pimcore-members

Pimcore Object, Asset and Document Restriction & Frontend Authentication
Other
54 stars 34 forks source link

[GroupMultiselect] Dependencies are not resolved #139

Closed aarongerig closed 4 years ago

aarongerig commented 4 years ago
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? yes

Description

In a member object you can select a member group object. Unfortunately as of now the dependency to that object is not resolved and doesn't get saved to the DB.

Would it be possible to add the dependency resolver method to the multiselect extension?

Maybe something like:

/**
 * @param Element\AbstractElement|null $data
 *
 * @return array
 */
public function resolveDependencies($data)
{
    $dependencies = [];

    if ($data instanceof Element\ElementInterface) {
        $elementType = Element\Service::getElementType($data);
        $dependencies[$elementType . '_' . $data->getId()] = [
            'id' => $data->getId(),
            'type' => $elementType
        ];
    }

    return $dependencies;
}
aarongerig commented 4 years ago

WDYT @solverat ?

solverat commented 4 years ago

@aarongerig I think this is the same issue (if I got you right): https://github.com/dachcom-digital/pimcore-members/issues/140

aarongerig commented 4 years ago

@solverat Thanks for looking into this! Actually not quite, let me make an example. Let's say we have a MemberGroup object, which gets assigned to a Member object via the GroupMultiselect data type. The MemberGroup then should be listed as dependency in the dependency tab in the Member object (see screenshot below). Right now this does not happen.

Btw, this screenshot is from the Pimcore Demo and is only to show where I expect the dependencies to be listed. This is not an actual Members object. ;)

dependencies

solverat commented 4 years ago

AH! Right! Let's fix that.