×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Massimo Zappino
Added: Jan 17, 2016 9:33 PM
Modified: Aug 27, 2017 3:33 PM
Views: 17
This is a plugin used to read PUT parameters using $this->getParam() in controller
  1. <?php
  2.  
  3. class MyApp_Controller_Plugin_PutDataRequest extends Zend_Controller_Plugin_Abstract
  4. {
  5.  
  6.     public function routeStartup(Zend_Controller_Request_Abstract $request)
  7.     {
  8.         if ($this->getRequest()->isPut()) {
  9.             parse_str($request->getRawBody(), $params);
  10.             foreach ($params as $key => $value) {
  11.                 $this->getRequest()->setParam($key, $value);
  12.             }
  13.         }
  14.     }
  15.  
  16. }