zend-framework2

Zend Framework 2 Flash Messenger returning no messages

醉酒当歌 提交于 2019-12-04 07:50:41
I'm having a rather odd problem with flash messenger in ZF2. I'm using it in quite a simple scenario, save a 'registration complete' message after registering and redirect to the login page and display the message however the messages are never returned by the flash messenger. In controller register action: $this->flashMessenger()->addMessage('Registration complete'); return $this->redirect()->toRoute('default', array('controller' => 'user', 'action' => 'login')); In controller login action: $flashMessenger = $this->flashMessenger(); $mes = $flashMessenger->hasMessages(); $cur =

How to install zend framework 2.4.11 skeleton application

折月煮酒 提交于 2019-12-04 07:48:43
I am trying to install ZF 2.4.11 using https://framework.zend.com/manual/2.4/en/ref/installation.html , but after completing the installation, the home page displays ZF version 3.0.2 DEV . How can I correctly install Zend Skeleton Application of desired version (2.4.11) . I am using php 5.6 . Execute following: $ git clone https://github.com/zendframework/ZendSkeletonApplication.git zf2 $ cd zf2 $ git checkout origin/release-2.4 You will get a message: HEAD is now at ff7b0e4... Pin to 2.4.11 series After that just run: $ composer install you will have ZF 2.4.11 installed. In the future you

Access to module config in Zend Framework 2

穿精又带淫゛_ 提交于 2019-12-04 07:45:56
问题 How I can get access to my module config from the controller? 回答1: I am really surprised at how obscure this is, because I had exactly the same problem and could not find a definitive answer. One would think the ZF2 documentation would say something about this. Anyhow, using trial and error, I came across this extremely simple answer: Inside controller functions: $config = $this->getServiceLocator()->get('Config'); Inside Module class functions (the Module.php file): $config = $e-

How to use the partial in zendframework2

笑着哭i 提交于 2019-12-04 07:22:48
In ZF1 we use partial in layout.phtml file something like that $this->partial('header.phtml', array('vr' => 'zf2')); How we can do the same in ZF2? this can be achieved by echo $this->partial('layout/header', array('vr' => 'zf2')); you can access the variable in view using echo $this->vr; don't forget to add following line in your view_manager of module.config.php file. 'layout/header' => __DIR__ . '/../view/layout/header.phtml', after adding it looks like this return array( 'view_manager' => array( 'template_path_stack' => array( 'user' => __DIR__ . '/../view' , ), 'display_not_found_reason'

ZF2 - \\Zend\\Db\\Adapter\\Platform::getQuoteIdentifierSymbol()

本秂侑毒 提交于 2019-12-04 07:15:39
Code is as following, where I aim to use Pdo_mysql: use \Zend\Db\Adapter\Adapter; use \Zend\Db\Sql\Sql; use \Zend\Db\Sql\Expression; $params = array( 'driver' => "Pdo_mysql", 'host' => &$this->Registry->config[ 'sql' ][ 'host' ], 'username' => &$this->Registry->config[ 'sql' ][ 'user' ], 'password' => &$this->Registry->config[ 'sql' ][ 'passwd' ], 'dbname' => &$this->Registry->config[ 'sql' ][ 'dbname' ] ); $this->adapter = new \Zend\Db\Adapter\Adapter( $params ); $this->platform = $this->adapter->getPlatform(); $this->sql = new Sql( $this->adapter ); And when I check identifier-quote symbol

How to remove route on overrided module?

做~自己de王妃 提交于 2019-12-04 07:02:52
问题 I added zfcUser module to my project via Composer and overrided it in the module ZfcUserOverride . I want trailing slash work, so I added route in overrided module. zfcUserOverride file module.config.php contents below: <?php $config = array( 'view_manager' => array( 'template_path_stack' => array( 'zfcuser' => __DIR__ . '/../view', ), ), 'controllers' => array( 'invokables' => array( 'zfcuser' => 'ZfcUserOverride\Controller\UserController', ), ) ); $config['router']['routes']['zfcuser'][

Zend Framework 2 FrontController Plugin

时间秒杀一切 提交于 2019-12-04 06:24:39
问题 I have decided to rewrite an application that I wrote a long time ago in ZF1. A key part of this is the utilisation of a FrontController plugin that looks at a URL and if no matching route is found it will pass it on to another controller to process. The benefit of this is it worked for all modules without having to make further changes as it was registered as a plugin for the frontcontroller. Can someone please help as to how I could achieve the same in ZF2 Thanks in Adavance Adam 回答1: Now

What exactly is the user state in ZfcUser?

浪子不回头ぞ 提交于 2019-12-04 06:17:07
Can anybody tell me, what the "user state" in the ZfcUser is doing exactly and why we may need it? What does this user state mean (I assume it's not the role meant by it)? Basically it's a flag to indicate the state of a user. Sometimes you need to be able to disable users, or otherwise affect their 'state' without actually deleting them from the table. That's what the state column is intended for if you use such a system. As a simple example, think of a temporarily banned user on a forum, you don't want to delete them, so you set their state to banned, and only allow users who aren't banned

Losing ZF2 Session after Paypal redirection

左心房为你撑大大i 提交于 2019-12-04 05:56:46
问题 I have a serious problem with managing session in zf2 and PayPal payment. Once I get in the page of the payment, I lose the zf2 session. How to solve it? $mySession = new Container('mySession'); $mySession->login = "name"; $mySession->droit= "admin"; Thanks. Update : the redirect page : <?php session_start(); extract($_GET); if($action == "paypal") header("Location: ./paymentgetway.php?action=$action&invoiceId=$invoiceId&L_NAME0=$L_NAME0&L_AMT0=$L_AMT0&L_DESC0=$L_DESC0&L_QTY0=$L_QTY0"); ?>

how to show data from document to index.phtml in zf2?

喜你入骨 提交于 2019-12-04 05:53:12
问题 i make index action in which i want to get data of calender and show this data using index.phtml but always no calendar shown,how i show calendar data? here is my indexaction: public function indexAction() { $dm = $this->getServiceLocator()->get('doctrine.documentmanager.odm_default'); $qb = $dm->createQueryBuilder('Calendar\Document\Calendar')->select('title', 'description'); $query = $qb->getQuery(); $calendars = $query->execute(); return array('calendars' => $calendars); } and here is my