protected function addEchoToJsonResponse(JsonResponse $r) {

		// handle JSON encoded request data
		
		if($this->isXhr && $this->xhrBag && $this->xhrBag->get('echo') == 1) {

			// echo is the original xmlHttpRequest sans echo property

			$echo = json_decode($this->xhrBag->get('xmlHttpRequest'));
			unset($echo->echo);

		}
		
		// handle plain POST or GET data
		
		else {

			if($this->request->getMethod() === 'POST' && $this->request->request->get('echo')) {
				$echo = $this->request->request->all();
				unset($echo['echo']);
			}

			else if($this->request->query->get('echo')) {
				$echo = $this->request->query->all();
				unset($echo['echo']);
			}

		}

		if(isset($echo)) {
			$r->setPayload([
				'echo'		=> $echo,
				'response'	=> json_decode($r->getContent())
			]);
		}
		
		return $r;

	}
protected function addEchoToJsonResponse(JsonResponse $r) {

		// handle JSON encoded request data
		
		if($this->isXhr && $this->xhrBag && $this->xhrBag->get('echo') == 1) {

			// echo is the original xmlHttpRequest sans echo property

			$echo = json_decode($this->xhrBag->get('xmlHttpRequest'));
			unset($echo->echo);

		}
		
		// handle plain POST or GET data
		
		else {

			if($this->request->getMethod() === 'POST' && $this->request->request->get('echo')) {
				$echo = $this->request->request->all();
				unset($echo['echo']);
			}

			else if($this->request->query->get('echo')) {
				$echo = $this->request->query->all();
				unset($echo['echo']);
			}

		}

		if(isset($echo)) {
			$r->setPayload([
				'echo'		=> $echo,
				'response'	=> json_decode($r->getContent())
			]);
		}
		
		return $r;

	}
protected function addEchoToJsonResponse ( JsonResponse $ r ) { // handle JSON encoded request data if ( $ this -> isXhr && $ this -> xhrBag && $ this -> xhrBag -> get ( 'echo' ) == 1 ) { // echo is the original xmlHttpRequest sans echo property $ echo = json_decode ( $ this -> xhrBag -> get ( 'xmlHttpRequest' ) ) ; unset ( $ echo -> echo ) ; } // handle plain POST or GET data else { if ( $ this -> request -> getMethod ( ) === 'POST' && $ this -> request -> request -> get ( 'echo' ) ) { $ echo = $ this -> request -> request -> all ( ) ; unset ( $ echo [ 'echo' ] ) ; } else if ( $ this -> request -> query -> get ( 'echo' ) ) { $ echo = $ this -> request -> query -> all ( ) ; unset ( $ echo [ 'echo' ] ) ; } } if ( isset ( $ echo ) ) { $ r -> setPayload ( [ 'echo' => $ echo , 'response' => json_decode ( $ r -> getContent ( ) ) ] ) ; } return $ r ; }
add an echo property to a JsonResponse, if request indicates that echo was requested
useful with vxJS.xhr based widgets

@param JsonResponse $r
@return JsonResponse
@throws \Exception
add an echo property to a JsonResponse if request indicates that echo was requested useful with vxJS . xhr based widgets