zend-framework2

How should I create a log off button in my menu bar that's rendered by a view helper?

巧了我就是萌 提交于 2019-12-13 04:40:56
问题 I have a subnav bar in my module created from a view partial via a helper. Here is the config in module.config.php: 'navigation' => array( 'default' => array( array( 'label' => 'Create', 'route' => 'mymodule\Create', ), array( 'label' => 'View', 'route' => 'mymodule\view', ), array( 'label' => 'Search', 'route' => 'mymodule\search', ), array( 'label' => 'Log Off', 'route' => 'mymodule\logoff', ), ), ), ); So here is my problem, I don't just want to redirect the user to the login page, I want

ZF2 and implementing a SOAP server returning a complex type

喜夏-厌秋 提交于 2019-12-13 04:40:47
问题 I'm trying to implement a SOAP server using Zend Framework 2 in PHP5.5. I've come as far as this: library.php <?php namespace Library; class IncrementedInt { /** * @var integer **/ public $original; /** * @var integer **/ public $incremented; public function __construct($num) { $this->original = $num; $this->incremented = ++$num; } } webservice.php <?php require_once 'library.php'; require_once 'Zend/Loader/StandardAutoloader.php'; $loader = new Zend\Loader\StandardAutoloader(array(

Form not validating correctly zend framework 2

删除回忆录丶 提交于 2019-12-13 04:39:48
问题 I am trying a custom configuration for a new system wide. I'm stuck on Form validations using Filter. Primary Question: $form = new CrudForm($this->getEntityManager()); $request = $this->getRequest(); if ($request->isPost()) { $filter = new CrudFilter(); $form->setInputFilter($filter); $post = $request->getPost(); $form->setData($post); //$crudLogic->edit($crudLogic->populateEntity($post)->update()); if ($form->isValid()) { } } This Form Never Get Validated. But what makes me crazy is that

routing in zendframework 2 is not working

十年热恋 提交于 2019-12-13 04:38:08
问题 /* Here is my module config */ 'controllers' => array( 'invokables' => array( 'User\Controller\User' => 'User\Controller\UserController', ), ), 'router' => array( 'routes' => array( 'user' => array( 'type' => 'Literal', 'options' => array( 'route' => '/user', 'defaults' => array( 'controller' => 'User\Controller\User', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'default' => array( 'type' => 'Segment', 'options' => array( 'route' => '/[:controller[/:action]]',

php zf2 select where clause with SQL function

耗尽温柔 提交于 2019-12-13 04:36:01
问题 I need to compare DATE format from a DATETIME. Prior ZF 2.3.5, the following code was working fine: $select->where('DATE(arrival_date) <= DATE(NOW())'); $select->where('DATE(departure_date) >= DATE(NOW())'); $select->where('enable = true'); With ZF 2.4.2+ it does not work anymore and produce the following error: Cannot inherit previously-inherited or override constant TYPE_IDENTIFIER from interface Zend\Db\Sql\Predicate\PredicateInterface I have tried the following (without error). The

Can we implement memcache without php_memcached.dll in ZF2?

允我心安 提交于 2019-12-13 04:33:18
问题 I want to implement memcache into my Zendframework 2 application. For that, is it possible to implement only with Zend framework 2 library without php_memcache.dll and php_memcached.dll? If not, How can I install php_memcached.dll. I have searched with google for php_memcached.dll they have given some daemon, kindly help me how to proceed with that daemon. I have referred this links: Does memcached.dll exist? http://www.couchbase.com/forums/thread/libmemcacheddll-32-bit-and-64-bit-php

Partial View Script in FlashMessanger

旧城冷巷雨未停 提交于 2019-12-13 04:29:16
问题 Is there a way to parse a partial view script as a flash message? Iam using some big flash messages with html code blocks in it and the ability to read or format those messages is really bad. 回答1: There's several ways to address the issue you're talking about and cptnk offered you one. However so much code within View-Files isn't often something you want. Luckily ZF2 offers a way to configure the same thing via configuration, too: 'view_helper_config' => array( 'flashmessenger' => array(

How to pass an argument to a Zend Form Collection instance & How to set custom Fieldset labels in ZF2?

和自甴很熟 提交于 2019-12-13 04:25:54
问题 I'm trying to understand and get around this whole form collection thing, but the documentation isn't really expansive and I just can't find out how to do some specific things I need. I will refer to the example in the official manual to explain what i need: When the collection is created, you get to use a custom fieldset as target: $this->add(array( 'type' => 'Zend\Form\Element\Collection', 'name' => 'categories', 'options' => array( 'label' => 'Please choose categories for this product',

ZF2 empty session container between pages

人走茶凉 提交于 2019-12-13 04:25:25
问题 After looking around the internet for days, i decided to ask your help here. I got a problem with Zend Framework 2 session container management. I don't understand why, but the framework emptied all my containers each time i'm changing page. My case is simple, i'm building an online shop : The customer is on a product and click the "add to cart" button The product is saved to session The customer get back to the products list to choose another product ... but there is no product anymore in

Automatic convention-based routing within a module in Zend Framework 2--possible?

折月煮酒 提交于 2019-12-13 04:23:25
问题 I'm trying to understand all the configuration necessary to get my routing working in Zend Framework 2, and I can't help but wonder if I am making this more complicated than necessary. I am working on a simple app that will follow a very simple convention: /:module/:controller/:action I've already created and wired up my module, "svc" (short for "service)". I then created a second controller, the "ClientsController", and I can't get the routing to pass through my requests to, e.g., /svc