public function mapRoleAssignments(array $data)
    {
        $roleAssignmentData = array();
        foreach ($data as $row) {
            $id = (int)$row['id'];
            $roleId = (int)$row['role_id'];
            $contentId = (int)$row['contentobject_id'];
            // if user already have full access to a role, continue
            if (isset($roleAssignmentData[$roleId][$contentId])
              && $roleAssignmentData[$roleId][$contentId] instanceof RoleAssignment) {
                continue;
            }

            $limitIdentifier = $row['limit_identifier'];
            if (!empty($limitIdentifier)) {
                $roleAssignmentData[$roleId][$contentId][$limitIdentifier][$id] = new RoleAssignment(
                    array(
                        'id' => $id,
                        'roleId' => $roleId,
                        'contentId' => $contentId,
                        'limitationIdentifier' => $limitIdentifier,
                        'values' => array($row['limit_value']),
                    )
                );
            } else {
                $roleAssignmentData[$roleId][$contentId] = new RoleAssignment(
                    array(
                        'id' => $id,
                        'roleId' => $roleId,
                        'contentId' => $contentId,
                    )
                );
            }
        }

        $roleAssignments = array();
        array_walk_recursive(
            $roleAssignmentData,
            function ($roleAssignment) use (&$roleAssignments) {
                $roleAssignments[] = $roleAssignment;
            }
        );

        return $roleAssignments;
    }
public function mapRoleAssignments(array $data)
    {
        $roleAssignmentData = array();
        foreach ($data as $row) {
            $id = (int)$row['id'];
            $roleId = (int)$row['role_id'];
            $contentId = (int)$row['contentobject_id'];
            // if user already have full access to a role, continue
            if (isset($roleAssignmentData[$roleId][$contentId])
              && $roleAssignmentData[$roleId][$contentId] instanceof RoleAssignment) {
                continue;
            }

            $limitIdentifier = $row['limit_identifier'];
            if (!empty($limitIdentifier)) {
                $roleAssignmentData[$roleId][$contentId][$limitIdentifier][$id] = new RoleAssignment(
                    array(
                        'id' => $id,
                        'roleId' => $roleId,
                        'contentId' => $contentId,
                        'limitationIdentifier' => $limitIdentifier,
                        'values' => array($row['limit_value']),
                    )
                );
            } else {
                $roleAssignmentData[$roleId][$contentId] = new RoleAssignment(
                    array(
                        'id' => $id,
                        'roleId' => $roleId,
                        'contentId' => $contentId,
                    )
                );
            }
        }

        $roleAssignments = array();
        array_walk_recursive(
            $roleAssignmentData,
            function ($roleAssignment) use (&$roleAssignments) {
                $roleAssignments[] = $roleAssignment;
            }
        );

        return $roleAssignments;
    }
public function mapRoleAssignments ( array $ data ) { $ roleAssignmentData = array ( ) ; foreach ( $ data as $ row ) { $ id = ( int ) $ row [ 'id' ] ; $ roleId = ( int ) $ row [ 'role_id' ] ; $ contentId = ( int ) $ row [ 'contentobject_id' ] ; // if user already have full access to a role, continue if ( isset ( $ roleAssignmentData [ $ roleId ] [ $ contentId ] ) && $ roleAssignmentData [ $ roleId ] [ $ contentId ] instanceof RoleAssignment ) { continue ; } $ limitIdentifier = $ row [ 'limit_identifier' ] ; if ( ! empty ( $ limitIdentifier ) ) { $ roleAssignmentData [ $ roleId ] [ $ contentId ] [ $ limitIdentifier ] [ $ id ] = new RoleAssignment ( array ( 'id' => $ id , 'roleId' => $ roleId , 'contentId' => $ contentId , 'limitationIdentifier' => $ limitIdentifier , 'values' => array ( $ row [ 'limit_value' ] ) , ) ) ; } else { $ roleAssignmentData [ $ roleId ] [ $ contentId ] = new RoleAssignment ( array ( 'id' => $ id , 'roleId' => $ roleId , 'contentId' => $ contentId , ) ) ; } } $ roleAssignments = array ( ) ; array_walk_recursive ( $ roleAssignmentData , function ( $ roleAssignment ) use ( & $ roleAssignments ) { $ roleAssignments [ ] = $ roleAssignment ; } ) ; return $ roleAssignments ; }
Map data for a set of role assignments.

@param array $data

@return \eZ\Publish\SPI\Persistence\User\RoleAssignment[]
Map data for a set of role assignments .