Adds a new media to the account.

@param $id
@param Request $request

@return Response
432289
public function postAction($id, Request $request)
    {
        return $this->addMediaToEntity($this->getContactEntityName(), $id, $request->get('mediaId', ''));
    }
33829
public function update(Request $request, $id)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate(["content" => "required|max:1024"]);
        $note = Note::findOrFail($id);
        $note->content = $request->get("content");
        $this->authorize('manage', $note);
        $note->save();
        return fractal($note, new NoteTransformer())
            ->withResourceName('note')
            ->respond();

    }
312272
protected function editEntityForm($id, Request $request = NULL)
    {
        $attributes['method'] = 'PUT';

        $form = $this->createForm($this->type, $this->repository->find($id), $attributes);

        return $request ? $form->handleRequest($request) : $form;
    }
935260
public function deleteAction(Request $request, $id)
    {
        $mediaManager = $this->get('opifer.media.media_manager');
        $media = $mediaManager->getRepository()->find($id);

        $dispatcher = $this->get('event_dispatcher');
        $event = new MediaResponseEvent($media, $request);
        $dispatcher->dispatch(OpiferMediaEvents::MEDIA_CONTROLLER_DELETE, $event);

        if (null !== $event->getResponse()) {
            return $event->getResponse();
        }

        $mediaManager->remove($media);

        return $this->redirectToRoute('opifer_media_media_index');
    }
276726
public function show(Request $request, $id)
    {
        $this->validate($request, [
            'id' => 'uuid'
        ]);

        try{
            $did = $request->user()->dids()->where('id', $id)->with(['tags', 'client'])->firstOrFail();
            $results = fractal()->item($did, new DidTransformer());
            return response()->json($results);
        }catch (\Exception $e){
            return response()->json([ 'error' => 404, 'message' => 'Not found' ], 404);
        }

    }
1370484
public function update(Request $request, $id)
    {
        $response = $this->repository->update($id, $request->all());
        return Response::apiResponse([
            'data' => $response
        ]);

    }
1257448
public function downloadAction(Request $request, $id)
    {
        try {
            if (ob_get_length()) {
                ob_end_clean();
            }

            $version = $request->get('v', null);
            $noCount = $request->get('no-count', false);

            $fileVersion = $this->getFileVersion($id, $version);

            if (!$fileVersion) {
                return new Response(null, 404);
            }

            if ($request->query->has('inline')) {
                $forceInline = (bool) $request->get('inline', false);
                $dispositionType = $forceInline ? ResponseHeaderBag::DISPOSITION_INLINE : ResponseHeaderBag::DISPOSITION_ATTACHMENT;
            } else {
                $dispositionType = $this->get('sulu_media.disposition_type.resolver')
                    ->getByMimeType($fileVersion->getMimeType());
            }

            if (!$noCount) {
                $this->getMediaManager()->increaseDownloadCounter($fileVersion->getId());
            }

            $response = $this->getFileResponse($fileVersion, $request->getLocale(), $dispositionType);

            return $response;
        } catch (MediaException $e) {
            throw $this->createNotFoundException('File not found: ' . $e->getCode() . ' ' . $e->getMessage());
        }
    }
809992
public function getAction(Request $request, $id)
    {
        $document = $this->getModel()->getSerialised($id, $request);

        $response = $this->getResponse()
            ->setStatusCode(Response::HTTP_OK)
            ->setContent($document);

        return $response;
    }
466579
public function getAction(Request $request, $id)
    {
        if (null !== $request->get('fields')) {
            return $this->getContent($request, $id);
        }

        return $this->getSingleNode($request, $id);
    }
960184
public function update($id,Request $request)
    {
        $feature = Feature::findOrfail($id);
    	
        $feature->name = $request->name;
        
        $feature->description = $request->description;
        
        $feature->featuretype_id = $request->featuretype_id;

        $feature->demonstration_URL = $request->demonstration_URL;

        $feature->package_id = $request->package_id;       
        
        $feature->save();

        return redirect('feature');
    }
901130
public function putMediaAction(Request $request, $id)
    {
        $_PUT = json_decode($request->getContent(), true);

        $response = $this->getFilter($request);
        if ($response['success'] === false) {
            return $response['value'];
        }
        $filter = $response['value'];

        $mm = $this->getMediaManager();

        $media = $mm->findOneBy(array(
            'id' => $id,
            'filter' => $filter,
        ));

        if ($media === null) {
            return new Response($this->get('translator')->trans('error.mediaIdNotFound', array('%id%' => $id), 'ApoutchikaMediaBundle'));
        }

        $media->setCryptedFilter($response['crypted']);

        // Rotate
        if (isset($_PUT['rotate']) && in_array($_PUT['rotate'], array(-90, 90))) {
            $rotate = new Rotate($mm, $media);
            $rotate
                ->setAngle($_PUT['rotate'])
                ->apply();

            return $this->createResponse($media);
        }

// Mirror
        if (isset($_PUT['mirror']) && in_array($_PUT['mirror'], array('x', 'y'))) {
            $mirror = new Mirror($mm, $media);
            $mirror
                ->setDirection($_PUT['mirror'])
                ->apply();

            return $this->createResponse($media);
        }

// Crop
        if (
            isset($_PUT['x']) && is_numeric($_PUT['x']) &&
            isset($_PUT['y']) && is_numeric($_PUT['y']) &&
            isset($_PUT['w']) && is_numeric($_PUT['w']) &&
            isset($_PUT['h']) && is_numeric($_PUT['h'])
        ) {
            $crop = new Crop($mm, $media);
            $crop
                ->setSize(
                    $_PUT['x'],
                    $_PUT['y'],
                    $_PUT['w'],
                    $_PUT['h']
                )
                ->apply();

            return $this->createResponse($media);
        }

        if (isset($_PUT['name'])) {
            $media->setName($_PUT['name']);
        }
        if (isset($_PUT['description'])) {
            $media->setDescription($_PUT['description']);
        }
        if (isset($_PUT['alt'])) {
            $media->setAlt($_PUT['alt']);
        }
        if (isset($_PUT['focusLeft'])) {
            $media->setFocusLeft($_PUT['focusLeft']);
        }
        if (isset($_PUT['focusTop'])) {
            $media->setFocusTop($_PUT['focusTop']);
        }

        $mm->save($media);

        return $this->createResponse($media);
    }
604221
public function update(int $id, Request $request)
    {
        $attachment = Attachment::findOrFail($id)
            ->fill($request->all());

        $attachment->save();

        return response()->json($attachment);
    }
821299
public function cgetAction($id, Request $request)
    {
        return $this->getMultipleView(
            $this->getContactEntityName(),
            'get_contact_medias',
            $this->get('sulu_contact.contact_manager'),
            $id,
            $request
        );
    }
1071088
public function uploadProfileImage(Request $request, $id)
    {

        if (!$id) {
            throw $this->createNotFoundException('Unable to upload.');
        }

        if ($id != $this->get('security.token_storage')->getToken()->getUser()->getId()) {
            throw $this->createNotFoundException('Can not upload anything to a profile that is not their own.');
        }
        
        $em = $this->container->get('doctrine')->getManager();
        $entity = $this->get('security.token_storage')->getToken()->getUser();
        if ($request->files->get('file') instanceof UploadedFile) {
            $imagePath = $this->get('core_manager')->uploadProfileImagePost($request->files->get('file'), $entity);
            $img = new Image();
            $img->setPath($imagePath);
            $em->persist($img);
            $entity->setImage($img);
            $em->flush();
        }

        return new JsonResponse($imagePath);

    }
1132373
public function putAction(Request $request, $id)
    {
        $locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));

        try {
            $attribute = $this->getManager()->save(
                $request->request->all(),
                $locale,
                $this->getUser()->getId(),
                $id
            );
            $view = $this->view($attribute, 200);
        } catch (AttributeDependencyNotFoundException $exc) {
            $exception = new EntityNotFoundException($exc->getEntityName(), $exc->getId());
            $view = $this->view($exception->toArray(), 400);
        } catch (AttributeNotFoundException $exc) {
            $exception = new EntityNotFoundException($exc->getEntityName(), $exc->getId());
            $view = $this->view($exception->toArray(), 404);
        } catch (MissingAttributeException $exc) {
            $exception = new MissingArgumentException(self::$entityName, $exc->getAttribute());
            $view = $this->view($exception->toArray(), 400);
        }

        return $this->handleView($view);
    }
413144
public function putAction(Request $request, $id)
    {
        $jsonData = $request->getContent();
        $data = json_decode($jsonData, true);

        // Id should be taken of request uri.
        $data['id'] = $id;

        $targetGroup = $this->deserializeData(json_encode($data));
        $targetGroup = $this->getTargetGroupRepository()->save($targetGroup);
        $this->getEntityManager()->flush();

        return $this->handleView($this->view($targetGroup));
    }
278668
public function addCommentAction($id, Request $request = null)
    {
        $action = $this->container->get(CreateCommentAction::class);

        return $action($this->resolveRequest($request), $id);
    }