plugin/exo/Controller/Api/Item/ShareController.php
public function shareAction(Request $request, User $user)
    {
        $errors = [];

        $data = $this->decodeRequestData($request);
        if (empty($data)) {
            $errors[] = [
                'path' => '',
                'message' => 'Invalid JSON data.',
            ];
        } else {
            try {
                $this->shareManager->share($data, $user);
            } catch (InvalidDataException $e) {
                $errors = $e->getErrors();
            }
        }

        if (!empty($errors)) {
            return new JsonResponse($errors, 422);
        } else {
            return new JsonResponse(null, 201);
        }
    }
public function shareAction(Request $request, User $user)
    {
        $errors = [];

        $data = $this->decodeRequestData($request);
        if (empty($data)) {
            $errors[] = [
                'path' => '',
                'message' => 'Invalid JSON data.',
            ];
        } else {
            try {
                $this->shareManager->share($data, $user);
            } catch (InvalidDataException $e) {
                $errors = $e->getErrors();
            }
        }

        if (!empty($errors)) {
            return new JsonResponse($errors, 422);
        } else {
            return new JsonResponse(null, 201);
        }
    }
public function shareAction ( Request $ request , User $ user ) { $ errors = [ ] ; $ data = $ this -> decodeRequestData ( $ request ) ; if ( empty ( $ data ) ) { $ errors [ ] = [ 'path' => '' , 'message' => 'Invalid JSON data.' , ] ; } else { try { $ this -> shareManager -> share ( $ data , $ user ) ; } catch ( InvalidDataException $ e ) { $ errors = $ e -> getErrors ( ) ; } } if ( ! empty ( $ errors ) ) { return new JsonResponse ( $ errors , 422 ) ; } else { return new JsonResponse ( null , 201 ) ; } }
Shares a list of questions to users.

@EXT\Route("", name="questions_share")
@EXT\Method("POST")
@EXT\ParamConverter("user", converter="current_user")

@param Request $request
@param User    $user

@return JsonResponse
Shares a list of questions to users .