main/core/Controller/APINew/User/ProfileController.php
public function updateAction(Request $request)
    {
        $formData = $this->decodeRequest($request);

        // dump current profile configuration (to know what to remove later)
        /** @var Facet[] $facets */
        $facets = $this->om->getRepository('ClarolineCoreBundle:Facet\Facet')->findAll();

        $this->om->startFlushSuite();

        // updates facets data
        $updatedFacets = [];
        foreach ($formData as $facetData) {
            $updated = $this->crud->update(
                'Claroline\CoreBundle\Entity\Facet\Facet',
                $facetData,
                [Options::DEEP_DESERIALIZE]
            );
            $updatedFacets[$updated->getId()] = $updated;
        }

        // removes deleted facets
        foreach ($facets as $facet) {
            if (empty($updatedFacets[$facet->getId()])) {
                $this->crud->delete($facet);
            }
        }

        $this->om->endFlushSuite();

        return new JsonResponse(
            $this->serializer->serialize()
        );
    }
public function updateAction(Request $request)
    {
        $formData = $this->decodeRequest($request);

        // dump current profile configuration (to know what to remove later)
        /** @var Facet[] $facets */
        $facets = $this->om->getRepository('ClarolineCoreBundle:Facet\Facet')->findAll();

        $this->om->startFlushSuite();

        // updates facets data
        $updatedFacets = [];
        foreach ($formData as $facetData) {
            $updated = $this->crud->update(
                'Claroline\CoreBundle\Entity\Facet\Facet',
                $facetData,
                [Options::DEEP_DESERIALIZE]
            );
            $updatedFacets[$updated->getId()] = $updated;
        }

        // removes deleted facets
        foreach ($facets as $facet) {
            if (empty($updatedFacets[$facet->getId()])) {
                $this->crud->delete($facet);
            }
        }

        $this->om->endFlushSuite();

        return new JsonResponse(
            $this->serializer->serialize()
        );
    }
public function updateAction ( Request $ request ) { $ formData = $ this -> decodeRequest ( $ request ) ; // dump current profile configuration (to know what to remove later) /** @var Facet[] $facets */ $ facets = $ this -> om -> getRepository ( 'ClarolineCoreBundle:Facet\Facet' ) -> findAll ( ) ; $ this -> om -> startFlushSuite ( ) ; // updates facets data $ updatedFacets = [ ] ; foreach ( $ formData as $ facetData ) { $ updated = $ this -> crud -> update ( 'Claroline\CoreBundle\Entity\Facet\Facet' , $ facetData , [ Options :: DEEP_DESERIALIZE ] ) ; $ updatedFacets [ $ updated -> getId ( ) ] = $ updated ; } // removes deleted facets foreach ( $ facets as $ facet ) { if ( empty ( $ updatedFacets [ $ facet -> getId ( ) ] ) ) { $ this -> crud -> delete ( $ facet ) ; } } $ this -> om -> endFlushSuite ( ) ; return new JsonResponse ( $ this -> serializer -> serialize ( ) ) ; }
Updates the profile configuration for the current platform.

@EXT\Route("", name="apiv2_profile_update")
@EXT\Method("PUT")

@param Request $request

@return JsonResponse
Updates the profile configuration for the current platform .