zend-framework2

Zend Framework and Doctrine 2 - are my unit tests sufficient?

二次信任 提交于 2019-12-22 04:29:13
问题 I'm quite new to Zend and unit testing in general. I have come up with a small application that uses Zend Framework 2 and Doctrine. It has only one model and controller and I want to run some unit tests on them. Here's what I have so far: Base doctrine 'entity' class, containing methods I want to use in all of my entities: <?php /** * Base entity class containing some functionality that will be used by all * entities */ namespace Perceptive\Database; use Zend\Validator\ValidatorChain; class

ZF2 - what will be dispatched if router matches multiple routes?

戏子无情 提交于 2019-12-22 04:13:08
问题 So - what if I have a url that might be matched against many routes... which route will win? Which action will be dispatched? Is it simple- first defined - first dispatched? Here's routes for example: 'route-catchall' => array( 'type' => 'regex', 'options' => array( 'regex' => '/api/v1/.*', 'defaults' => array( 'controller' => 'IndexController', 'action' => 'apiCatchAll', ), ), ), 'route-test1' => array( 'type' => 'literal', 'options' => array( 'route' => '/api/v1/route1', 'defaults' => array

Cant find zf.bat in zend framework download [duplicate]

喜你入骨 提交于 2019-12-22 03:44:39
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Zend Framework 2 “Zend Tool Missing” in bin folder I am trying to install the zend framework on my computer and it seems that I need a file zf.bat and its supposed to be in the bin folder. All that I have in the bin folder is: autoload_example.php autoload_examples.php classmap_generator.php createAutoloadTestClasses.php pluginmap_generator.php I know that this isn't a programming question, so can someone help

How to use collections in a fieldset factory in ZF2

狂风中的少年 提交于 2019-12-22 03:20:52
问题 I am developing a project with ZF2 and Doctrine. I am attempting to use Doctrine Hydrator in the form creation as shown in this tutorial. In this method, an ObjectManager object is created in the controller and passed to the new form when it is instantiated. Passing the ObjectManager object from the controller to the form creates a problem when I want to use ZF2's FormElementManager because ZF2 requires that I get an instance of the form class through the Zend\Form\FormElementManager instead

ZF2 detach listener from EventManager

好久不见. 提交于 2019-12-21 23:15:40
问题 Implementing a new ZF2 app I found myself struggling with the EventManager. In the application module I created an AuthenticationListener and a NotifierListener . The first checks for proper authentication on users and the second displays custom messages addressed to the logged user. Now I'm creating a new module that dispatches xml files to export. I want to keep the AuthenticationListener but detach the NotifierListener to avoid E_NOTIFY errors. The problem is that after reading blogs

zf2 display module action in another module

你。 提交于 2019-12-21 21:58:20
问题 Hi I created two modules first application second comment. Idea is to use comment module(Widget) in any application action (website page). Application module Test controller public function commentAction(){ //seting redirection for form $this->getCommentService()->setRedirection('test/comment'); $list = $this->forward()->dispatch('comment_controrller', array('action' => 'list')); $add = $this->forward()->dispatch('comment_controrller', array('action' => 'add')); $view = new ViewModel(); $view

How to validate nested fieldsets in Zend Framework 2 without using factory

六眼飞鱼酱① 提交于 2019-12-21 21:16:55
问题 I've got a form class that dynamically creates fieldsets with elements/fieldsets recursively. I do this to get settings[general][rpp][value] as an input name (for example). The fields get generated because the settings are user defined in an XML file. Fieldsets are getting created like this: $fieldset = new Fieldset(...); $fieldset->add(...); $form->add($fieldset); The form is being output correctly; everything works. Except i need validation. My goal is to define validators and filters for

Use spiffy navigation with zfcrbac module

99封情书 提交于 2019-12-21 21:10:40
问题 I'm trying to understand how spiffy-navigation works. I integrate the module, it's working very well. I have my navigation. But the doc says : Rbac specific options role: required The role to use to determine if access is granted. permission: required The permission to use to determine if access is granted. But, even if i did something like that, it still not working. 'containers' => array( 'default' => array( array( 'options' => array( 'label' => 'profil', 'route' => 'profil', 'role' =>

ZF2 Service Locator

依然范特西╮ 提交于 2019-12-21 20:17:09
问题 I'm quite new to zf2 and I'm experimenting with it. I have a view helper and I need it to access a table object. In my controller I can run: $this->getServiceLocator(); But ideally I would run this inside my view helper. Unfortunately, I can't seem to access it from within my view helper. I tried passing it through the constructor, configuring a factory method in module.config.php, but when I try that, Zend will no longer pass a tablegateway object into one of my model objects created from a

Implementing a password validator for zf2

柔情痞子 提交于 2019-12-21 19:29:10
问题 What is a good approach to write a password validator that validates two inputs (must be eqeal) and how would you integrate that into a zf2 form. 回答1: There is an "Identical" validator that check two fields to be equal, it can be used in the following way in form constructor: $this->add(array( 'name' => 'password', // add first password field /* ... other params ... */ )); $this->add(array( 'name' => 'passwordCheck', // add second password field /* ... other params ... */ 'validators' =>