public function putMetadataAction(Page $page, Request $request)
    {
        $metadatas = $this->application
                ->getContainer()
                ->get('nestednode.metadata.resolver')
                ->resolve($page);

        foreach ($request->request->all() as $name => $attributes) {
            if ($metadatas->has($name)) {
                foreach ($attributes as $attr_name => $attr_value) {
                    if ($attr_value !== $metadatas->get($name)->getAttribute($attr_name)) {
                        $metadatas->get($name)->setAttribute($attr_name, $attr_value, null, false);
                    }
                }
            }
        }

        $page->setMetaData($metadatas);
        $this->getApplication()->getEntityManager()->flush();

        return $this->createJsonResponse(null, 204);
    }
public function putMetadataAction(Page $page, Request $request)
    {
        $metadatas = $this->application
                ->getContainer()
                ->get('nestednode.metadata.resolver')
                ->resolve($page);

        foreach ($request->request->all() as $name => $attributes) {
            if ($metadatas->has($name)) {
                foreach ($attributes as $attr_name => $attr_value) {
                    if ($attr_value !== $metadatas->get($name)->getAttribute($attr_name)) {
                        $metadatas->get($name)->setAttribute($attr_name, $attr_value, null, false);
                    }
                }
            }
        }

        $page->setMetaData($metadatas);
        $this->getApplication()->getEntityManager()->flush();

        return $this->createJsonResponse(null, 204);
    }
public function putMetadataAction ( Page $ page , Request $ request ) { $ metadatas = $ this -> application -> getContainer ( ) -> get ( 'nestednode.metadata.resolver' ) -> resolve ( $ page ) ; foreach ( $ request -> request -> all ( ) as $ name => $ attributes ) { if ( $ metadatas -> has ( $ name ) ) { foreach ( $ attributes as $ attr_name => $ attr_value ) { if ( $ attr_value !== $ metadatas -> get ( $ name ) -> getAttribute ( $ attr_name ) ) { $ metadatas -> get ( $ name ) -> setAttribute ( $ attr_name , $ attr_value , null , false ) ; } } } } $ page -> setMetaData ( $ metadatas ) ; $ this -> getApplication ( ) -> getEntityManager ( ) -> flush ( ) ; return $ this -> createJsonResponse ( null , 204 ) ; }
Update page's metadatas.

@param Page    $page    the page we want to update its metadatas
@param Request $request

@return Symfony\Component\HttpFoundation\Response

@Rest\ParamConverter(name="page", class="BackBee\NestedNode\Page")
Update page s metadatas .