admin/jsonadm/src/Admin/JsonAdm/Standard.php
protected function patchItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response )
	{
		$body = (string) $request->getBody();

		if( ( $payload = json_decode( $body ) ) === null || !isset( $payload->data ) ) {
			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
		}

		$manager = \Aimeos\MShop::create( $this->getContext(), $this->getPath() );

		if( is_array( $payload->data ) )
		{
			$data = $this->saveData( $manager, $payload );

			$view->data = $data;
			$view->total = count( $data );
			$response = $response->withHeader( 'Content-Type', 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"' );
		}
		elseif( ( $id = $view->param( 'id' ) ) != null )
		{
			$payload->data->id = $id;
			$data = $this->saveEntry( $manager, $payload->data );

			$view->data = $data;
			$view->total = 1;
		}
		else
		{
			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 );
		}

		return $response;
	}
protected function patchItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response )
	{
		$body = (string) $request->getBody();

		if( ( $payload = json_decode( $body ) ) === null || !isset( $payload->data ) ) {
			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
		}

		$manager = \Aimeos\MShop::create( $this->getContext(), $this->getPath() );

		if( is_array( $payload->data ) )
		{
			$data = $this->saveData( $manager, $payload );

			$view->data = $data;
			$view->total = count( $data );
			$response = $response->withHeader( 'Content-Type', 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"' );
		}
		elseif( ( $id = $view->param( 'id' ) ) != null )
		{
			$payload->data->id = $id;
			$data = $this->saveEntry( $manager, $payload->data );

			$view->data = $data;
			$view->total = 1;
		}
		else
		{
			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 );
		}

		return $response;
	}
protected function patchItems ( \ Aimeos \ MW \ View \ Iface $ view , ServerRequestInterface $ request , ResponseInterface $ response ) { $ body = ( string ) $ request -> getBody ( ) ; if ( ( $ payload = json_decode ( $ body ) ) === null || ! isset ( $ payload -> data ) ) { throw new \ Aimeos \ Admin \ JsonAdm \ Exception ( sprintf ( 'Invalid JSON in body' ) , 400 ) ; } $ manager = \ Aimeos \ MShop :: create ( $ this -> getContext ( ) , $ this -> getPath ( ) ) ; if ( is_array ( $ payload -> data ) ) { $ data = $ this -> saveData ( $ manager , $ payload ) ; $ view -> data = $ data ; $ view -> total = count ( $ data ) ; $ response = $ response -> withHeader ( 'Content-Type' , 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"' ) ; } elseif ( ( $ id = $ view -> param ( 'id' ) ) != null ) { $ payload -> data -> id = $ id ; $ data = $ this -> saveEntry ( $ manager , $ payload -> data ) ; $ view -> data = $ data ; $ view -> total = 1 ; } else { throw new \ Aimeos \ Admin \ JsonAdm \ Exception ( sprintf ( 'No ID given' ) , 400 ) ; } return $ response ; }
Saves new attributes for one or more items

@param \Aimeos\MW\View\Iface $view View that will contain the "data" and "total" properties afterwards
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@param \Psr\Http\Message\ResponseInterface $response Response object
@return \Psr\Http\Message\ResponseInterface Modified response object
@throws \Aimeos\Admin\JsonAdm\Exception If "id" parameter isn't available or the body is invalid
Saves new attributes for one or more items