zend-framework2

Zend Framework 2 session life time

早过忘川 提交于 2019-12-07 06:46:03
问题 I am trying to set the max life time of a session with the \Zend\Session\Container . To test it I put it to 1 sec. Now I looked at the docs So i did $config = new StandardConfig(); $config->setOptions(array( 'remember_me_seconds' => 1, )); $manager = new SessionManager($config); $session = new Container('user', $manager); But no success. Then I started googling and found this answer So I made the config to return array( 'session' => array( 'remember_me_seconds' => 2419200, 'use_cookies' =>

ZF2 Models shared between Modules

若如初见. 提交于 2019-12-07 06:42:31
问题 I've just started setting up a new ZF2 application for a new project, based off the ZF2 skeleton, and am looking at their tutorial on Models. tl;dr: how should I share a Model between multiple different modules, by putting it somewhere in a higher level (outside /module)? We have several modules setup like so: / /module/ModuleName /module/ModuleName/config /module/ModuleName/src /module/ModuleName/src/ModuleName I was just about to setup a folder /module/ModuleName/src/ModuleName/Model

How to Render a custom view with plugins in Zend Framework 2

为君一笑 提交于 2019-12-07 05:28:23
问题 I'm working on an app that needs to send an email after a process is complete. Since the email needs to be HTML I had the bright idea of rendering a view as the email message body so that I can implement a "Click here to see this on your browser" functionality. This is all taking part inside a controller that implements AbstractRestfulController so the view itself resides in my front end module so that it can be accessed from a URL through a browser. However I am getting an No

Zend Framework 2 SOAP server WSDL failed to load

白昼怎懂夜的黑 提交于 2019-12-07 05:11:21
I can't get the SOAP server working in Zend Framework 2 module. I am not completely sure, but I believe that the problem is the WSDL file. I try to create the WSDL file via Autodiscover, which is provided by the Zend Framework. Here is the error.log: [Fri Apr 19 20:39:29 2013] [error] [client 172.23.31.109] PHP Warning: SoapServer::SoapServer(): I/O warning : failed to load external entity "http-LINK/services?wsdl" in /PATH/public_html/vendor/zendframework/zendframework/library/Zend/Soap/Server.php on line 749 [Fri Apr 19 20:39:29 2013] [error] [client 172.23.31.109] PHP Fatal error: SOAP

Set Zend\Form Error Messages from Controller

半城伤御伤魂 提交于 2019-12-07 03:39:01
问题 this is probably a very simple task, but currently I'm failing horribly at it. I just want to add a custom error to my form when my authentication fails. What i tried $form->setMessages(array( array('password' => $this->failedLoginMessage) )); Unexpected Result \Zend\Debug\Debug::dump($form->getMessages()); array(0) {} If i understand the code correctly this should attach an error message to the password element. Actually looking at the setMessages i thought attaching a single-dimension array

ZF2/3 Load Modules from Database

杀马特。学长 韩版系。学妹 提交于 2019-12-07 02:59:27
I would like to know if there is a way to load modules from a database table in zend framework 2 preferable 3? I want to be able to dynamically disable or enable modules based on a status column inside a database table I'm pretty sure you can accomplish this by attaching listener to some of ModuleManager events. There are docs for v3 https://docs.zendframework.com/zend-modulemanager/module-manager/ and v2 https://framework.zend.com/manual/2.1/en/modules/zend.module-manager.module-manager.html And don't forget autoloading for v3 By reading your question tom_cruz , I realize that I have exactly

Zend 2:: getting public folder path or basePath() easily in controller action

别等时光非礼了梦想. 提交于 2019-12-07 01:59:31
问题 In my application, to move a file to a specific directory i need to know public folder path in controller action. I read different this type solution but not getting easy one. I know that in view we can get easily public folder path using $this->basePath(); view helper. I exactly want this in controller action. Anybody can guide me how can i achieve that. Thanks in advance. 回答1: index.php sets the current working dir to you application root (the folder containing composer.json , init

How can Smarty 3 be Used with Zend Framework 2?

旧街凉风 提交于 2019-12-07 01:58:44
问题 I used PHP5 a long time ago and am presently trying to refresh my knowledge and augment it with knowledge of Zend Framework 2 and Smarty 3 for a possible project. I'm currently trying to figure out how to use Smarty 3 as a replacement/supplement to Zend Framework 2. Everything I can find through Google on this topic either: Is outdated (e.g. Zend Framework 1) Assumes I have a more intimate working knowledge about both Zend and Smarty than I actually do. Can someone please explain to me as

How to use Zend Framework 2 with MS SQL Server on *nix?

对着背影说爱祢 提交于 2019-12-07 01:53:28
What, if it exists, is the canonical way to use ZF2 with MS SQL Server on a non-Windows OS? From what I can tell from the documentation , only the Sqlsrv driver is officially supported, which only works on the Windows platform. In ZF1, we used the Pdo_Mssql adapter and specified the pdoType as dblib . I can't find any references to doing anything similar in ZF2. Apparently there was a Pdo\Mssql driver some time ago which was removed during a major refactoring , but I don't see a currently documented way of using Pdo_Dblib. According to the adapter documentation above, you can set the driver in

send email with attached files in ZF2

与世无争的帅哥 提交于 2019-12-07 01:00:50
问题 How to send email with text/plain, text/html and attaches in zf2 ? I use this code to send email with smtp: $files = $this->params()->fromFiles(); $smtp = new \Zend\Mail\Transport\Smtp(); $smtp->setAutoDisconnect(true); $optn = new \Zend\Mail\Transport\SmtpOptions(array( 'host' => 'mail.myserver.com', 'connection_class' => 'login', 'connection_config' => array( 'username' => 'user@myserver.com', 'password' => 'mypassword', ), )); $smtp->setOptions($optn); $htmlPart = new \Zend\Mime\Part('<p