zend-framework2

How do I access a routed parameter from inside a controller?

落爺英雄遲暮 提交于 2019-12-08 13:43:48
问题 This is the route... 'panel-list' => array ( 'type' => 'Segment', 'options' => array ( 'route' => '/panel-list/:pageId[/:action]', 'constraints' => array ( 'pageId' => '[a-z0-9_-]+' ), 'defaults' => array ( 'action' => 'index', 'controller' => 'PanelList', 'site' => null ), ), ), What do I need to put in here.... public function indexAction() { echo ??????? } to echo the pageId? 回答1: In beta5 of zf2 it changed to easier usage so you don't need to remember different syntax for every different

How to include third party lib in Zend Framework 2

亡梦爱人 提交于 2019-12-08 13:30:58
问题 I'm migrating application from ZF1 to ZF2. I have a controller depends on third party lib 'Solarium'. namespace Stock\Controller; class BaseController extends AbstractActionController { protected function indexAction() { require_once('Solarium/Autoloader.php'); Solarium_Autoloader::register(); The 'Solarium' exists under 'vendor', and in 'init_autoloader.php' I have: set_include_path(implode(PATH_SEPARATOR, array( realpath('vendor') ))); But, when I viewing the page, there's an error: Fatal

ZF2 Skeleton Application Without Virtual Host?

吃可爱长大的小学妹 提交于 2019-12-08 13:16:48
问题 I am new in ZF2. I have developed my small application in my local computer using virtual host.I want to run this site without virtual host. My Folder Directory Structure is like this: -ProjectName -config -module -vendor - zendframework -public - css - img - JS - index.php Index.php File: <?php /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); // Decline static file requests back to the PHP built-in

Why won't zend 2 http verify my ssl cert?

柔情痞子 提交于 2019-12-08 13:09:54
问题 I've just started using Zend 2 and it works really well (locally) but I can't get it to pass data via https to another server. I'm a bit of a noob when it comes to ssl certs and I think this is where the problem lies. I've got a CERT, a Private Key and a CA cert - these are being used for an ssl cert on one of our vhost domains on our server the locations are : - SSLCertificateFile /usr/local/psa/var/certificates/cert-#### SSLCACertificateFile /usr/local/psa/var/certificates/cert-#### In

Can't get blueimp / jQuery-File-Upload and ZF2 running

大城市里の小女人 提交于 2019-12-08 12:52:27
问题 Has anybody expierience with 'blueimp / jQuery-File-Upload' in combination with Zend Framework 2? I am struggeling to get is working. The form seems to do his thing and works but when the controllers wants to do his magic, I am stuck. This is my function that is called by the script to upload and save the files. public function indexAction() { $request = $this->getRequest(); $files = $request->getFiles(); $httpadapter = new \Zend\File\Transfer\Adapter\Http(); if($httpadapter->isValid()) {

Injecting custom navigation using a View Helper through the ServiceManager

瘦欲@ 提交于 2019-12-08 12:39:08
问题 I'm just starting out developing for Zend Framework 2. I'm trying to add a simple menu to my Application. The menu will eventually be loaded from a database as user-definable bookmarks, so at the moment, I am trying to instantiate a view helper I've defined, add pages programmatically in the controller, and then inject the view helper's navigation into the view model. My problem is that when I try to retrieve my view helper in the controller by using the ServiceLocator, I get a

Zend 2 Http Client Request times out when requesting php file from localhost/public directory

大兔子大兔子 提交于 2019-12-08 12:15:44
问题 The below http-request issued from an Zend Controller Action towards localhost fails with a timeout. My guess is that I have missed a very basic concept, since a request to an outside uri (e.g. www.google.com) returns normally. Of course the URL below ($localUrl) does return the expected result (TEST) when pasted directly into the browser. I am using Zend Framework 2 (based on the current skelleton application - today: 2016/06/19) in an XAMPP 3.2.2 Windows (Developer Environment) with PHP 5.6

Zend Framework 2 - Doctrine 2 Model Forms

六眼飞鱼酱① 提交于 2019-12-08 11:19:49
问题 Is there a way to autocreate forms based on the models I defined within Doctrine? In Django its a basic feature. I found some old sources where someone had tried to implement it by himself... but nothing up-to-date or official-looking These model forms save loads of time. I do ask myself why people don't complain about this (possibly) missing feature... 回答1: Zend 2 cannot create a form from the Entity itself. Doctrine 2 is not even part of the framework or tied to it as close as to Symfony 2.

How get basepath from model or helper en Zend Framework 3

喜欢而已 提交于 2019-12-08 11:17:28
问题 I recently decided to use Zend Framework 3 after 3 years of using Zend Framework 1. This decision has given me headaches, Zend 3 instead of making things easier made things more difficult. In Zend 1, I customize the url for the selected template in the database as follows: public function getUrl(string $file = '') { if($this->_helperBaseUrl === null) { $this->_helperBaseUrl = new Zend_View_Helper_BaseUrl(); } return $this->_helperBaseUrl->baseUrl($file); } public function getSkinUrl(string

Update two tables from one form with ZF2 and Doctrine

三世轮回 提交于 2019-12-08 10:34:38
问题 I am looking for a tutorial or example module that uses ZF2 and Doctrine to join two or more tables, creates a form, and updates all tables with form input/changes. (It would be an added bonus to find something that includes a method to add records in associated tables when the query doesn’t find records to join.) The pattern I’m trying to replicate in ZF2/Doctrine is something like this: perhaps there is a members table and a personal_info table. While there is a one-to-one relationship