Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /data/e/7/e76990b9-3372-4d88-8089-fce36e16744a/webperfection.net/sub/rady-nosu/wp-content/plugins/seo-ultimate/modules/class.su-module.php on line 1195
zend framework 2 – how to get params | Real Solution for Your Problem!

July 17, 2014 | In: Programovanie

zend framework 2 – how to get params

how to get params out of the request

http://domain.ltd/controller/get/5?id=5
/apigility/resource[/:id]?lang=en_US


// module.config.php
// 'route' => '/[:controller[/:action[/:id]]]',

// apigility module.config.php
// key zf-rest
// 'collection_query_whitelist' => array('lang'),

var_dump(
$this->getEvent()->getQueryParams(),
$this->getEvent()->getParams(),
$this->getEvent()->getRouteParam('id),
$this->getEvent()->getRouteMatch()->getParam('id'),
// controller: (which goes like (new HttpRequest)->method(Params() param)...
$this->params()->fromRoute('id'),
$this->params()->fromQuery('id'),
$this->params()->fromPost('id'),
$this->params('id')
);

Share This:

Comments are closed.