zend-framework2

How to use the global.php/local.php configs in the getConfig() of a module in a Zend Framework 2 application?

随声附和 提交于 2019-12-30 02:36:10
问题 In a ZF2 application I have some cofigs, that: 1. need to be different dependening on the environment; 2. are specific for a concrete module. I'm curently using it like here described: global.php & local.php return array( ... 'modules' => array( 'Cache' => array( 'ttl' => 1, // 1 second ) ) ... ); Module class Module { ... public function getServiceConfig() { try { return array ( 'factories' => array( 'Zend\Cache\Adapter\MemcachedOptions' => function ($serviceManager) { return new

Create vhost in wamp 2.5 in different directory on win7 returns forbidden error

。_饼干妹妹 提交于 2019-12-30 02:29:07
问题 I have installed wamp in C:\wamp and I want to make DocumentRoot folder in E:\zf2 as virtual host for a dummy domain www.skeltonapplicaiton-zf2.local. Uncommitted the line Include conf/extra/httpd-vhosts.conf in httpd.conf file. httpd-vhosts.conf code is <VirtualHost *:80> ServerName www.skeltonapplicaiton-zf2.local ServerAlias skeltonapplicaiton-zf2.local DocumentRoot "E:\zf2" <directory "E:\zf2"> Options Indexes FollowSymLinks AllowOverride all Order Deny,Allow Deny from all Allow from all

force download using ZF2

耗尽温柔 提交于 2019-12-29 17:46:07
问题 I am trying to do force download using ZF2. Here is the snippet to my code use Zend\Http\Request; ..... public function downloadAction() { $response = new Request(); $response->setHeaders(Request::fromString("Content-Type: application/octet-stream\r\nContent-Length: 9\r\nContent-Disposition: attachment; filename=\"ultimate_remedy_readme.txt\"")); } now i am getting this error /var/www/whowantsmymoney/vendor/zendframework/zendframework/library/Zend/Http/Request.php:88 Message: A valid request

force download using ZF2

天大地大妈咪最大 提交于 2019-12-29 17:45:52
问题 I am trying to do force download using ZF2. Here is the snippet to my code use Zend\Http\Request; ..... public function downloadAction() { $response = new Request(); $response->setHeaders(Request::fromString("Content-Type: application/octet-stream\r\nContent-Length: 9\r\nContent-Disposition: attachment; filename=\"ultimate_remedy_readme.txt\"")); } now i am getting this error /var/www/whowantsmymoney/vendor/zendframework/zendframework/library/Zend/Http/Request.php:88 Message: A valid request

disabling view with in action in ZF2

落花浮王杯 提交于 2019-12-29 14:16:18
问题 I am struggling with disabling view in ZF2 $this->_helper->viewRenderer->setNoRender(); or (true) with no luck as it always says there PHP Fatal error: Call to a member function setNoRender() on a non-object in ../module/Location/src/Location/Controller/LocationController.php on line 190 回答1: To disable the view completely, from within a controller action, you should return a Response object: <?php namespace SomeModule\Controller; use Zend\Mvc\Controller\ActionController, Zend\View\Model

Class 'ZendSearch\Lucene\Lucene' not found ZendFramework2

╄→尐↘猪︶ㄣ 提交于 2019-12-29 09:36:51
问题 I've installed ZendSearch with composer using these commands: $ cd /var/www/CommunicationApp/vendor/ $ git clone https://github.com/zendframework/ZendSearch.git ZendSearch $ cd ZendSearch/ $ curl -s https://getcomposer.org/installer | php $ php composer.phar install And I've installed Zendskeleton according to GITHUB So, I don't know What I'm missing here. Than, in the same book, it teaches how to use ZendSearch, but I'm not getting the same results, instead I'm getting a Fatal error: Fatal

Route mit special characters are not parsed correctly in Zend Framework 2

假装没事ソ 提交于 2019-12-29 01:24:09
问题 URIs with german special characters don't work (error 404). I've already had this problem (here) and it has been resolved with the unicode modifier and a custom view helper, that uses it. Now I have the same issue with a Segment child route, but this time the approach with the unicode identifier and a custom view helper isn't working. Alle requests like sld.tld/sport/sportäöüÄÖÜß/cityäöüÄÖÜß or sld.tld/sport/sportäöüÄÖÜß/cityäöüÄÖÜß/page/123 are ending with a 404 error. /module/Catalog/config

Is it possible to forward data to another controller/action in Zend 2?

对着背影说爱祢 提交于 2019-12-28 13:54:31
问题 I think a common problem is trying to forward (post) data to another page. Normally, I'd resort to sessions to pass data between pages, but this forward helper in Zend looks like it has potential. Is there any way to get information about a forward request? Like ask for the forwarder (and it'd return null normally when there's no forwarder)? And if there's no current implementation, is it possible? It'd be a fun project, and something I've wanted forever anyways. (I'm also currently using my

Zend framework - error wont login

我只是一个虾纸丫 提交于 2019-12-25 18:16:37
问题 CentOS 3.10.0-327.36.3.el7.x86_64, PHP 7.0.12 . public function render($html, $input) { $view = new ViewModel($input); $view->setTemplate($html); $viewRenderer = $this->getServiceLocator()->get('ViewRenderer'); return $viewRenderer->render($view); } In OLD PHP and OLD CentOS its working but when i migrated to new server its failing. PHP Deprecated: You are retrieving the service locator from within the class Application\\Controller\\MainController. Please be aware that

ZF2 - Rendering variables from Module.php to twig layout

懵懂的女人 提交于 2019-12-25 16:30:14
问题 I'm in the midst of converting a ZF2 site from using default templates into twig versions, and so far, for the main part, everything is going well, except I have some variables in Module.php defined from a bootstrap method that I'm now unable to get into the layout.twig template. The original code that worked fine for the default templates is as: public function bootstrapLayout(MvcEvent $e) { $config = $e->getApplication()->getServiceManager()->get('applicationconfig'); $authService = $e-