zend-framework2

Implementing a password validator for zf2

て烟熏妆下的殇ゞ 提交于 2019-12-04 09:45:41
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. 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' => array( array( 'name' => 'Identical', 'options' => array( 'token' => 'password', // name of first password field

ZF2 Shared Modules Event Manager

China☆狼群 提交于 2019-12-04 09:43:34
问题 I need to implement in each of my modules an event trigger when something specific happens. I also need that all the other modules that must to do some work when that event is trigger, be aware of it. I'm trying to create some common endpoint where I can send my triggers, and where all the modules need to be listening, but I'm having some trouble figuring out how can I achieve that. Any ideas? 回答1: Based on the comments to @Andrew's answer, as long as your controller extends the

doctrine migrations 2 + zend framework 2 = is it possible?

安稳与你 提交于 2019-12-04 08:59:35
I have used this guide http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/ and now I have a working Doctrine 2 + ZF2 software. I use a versioning system and I want then use Doctrine MIGRATIONS tool to have a database migration system. If I put on a shell ./doctrine-module orm:schema-tool:update it works correctly, but if I use a migration tools for example ./doctrine-module migrations:status the system give me an error: [Doctrine\DBAL\Migrations\MigrationException] Migrations namespace must be configured in order to use Doctrine migrations. Which configurations are needs?

ZF2 - How to change the error/404 response page? Not just template but to set a new ViewModel

ε祈祈猫儿з 提交于 2019-12-04 08:55:38
By default the page is set like this in the Application module.config array: 'template_map' => array( 'error/404' => __DIR__ . '/../view/error/404.phtml' I want to change the page. I want new ViewModel for it full of variables. It means that simply to change the template is not enough: 'error/404' => __DIR__ . '/../view/error/my_new_404_template.phtml' But I can't understand how to make it. I can't see the way the request comes to the 'error/404' . How to create new ViewModel for it? How to attach variables to it? How the route comes to 'error/404' to catch it to change? For example, I have

ZF2 SOAP “Procedure not present” Error

浪子不回头ぞ 提交于 2019-12-04 08:53:48
I'm having serious trouble to solve this issue. I got an APP with 3 modules that got different services to provide by SOAP. What happens is that 2 of them are getting this response: SoapFault File: /var/www/empreendimentos/vendor/zendframework/zendframework/library/Zend/Soap/Client.php:10 Message: Procedure not present I already double checked, and the names of the functions are right and I use the method getFunctions. This is the return from getFunctions(): array 0 => string 'Array getCliAll(anyType $filter)' (length=32) 1 => string 'Array insertCli(anyType $data)' (length=30) 2 => string

Routing Zend Framework 2 Language in url

空扰寡人 提交于 2019-12-04 08:53:23
For my application translation I would like to use a language structure e.g.: site.com (english) site.com/de/ (german) site.com/fr/ (france) site.com/nl/ (dutch) etc.. I can do this easily with the router option in Literal as '[a-z]{2}' but I want to exclude languages I do not support, e.g. site.com/it/ if it is not supported I want a 404. I tried to fix this with regex (adding supported languages) but something (I do not know) went wrong. Thanks in advance! 'router' => array( 'routes' => array( 'home' => array( 'type' => 'Literal', 'options' => array( 'route' => '/', 'defaults' => array(

Autocompletion for ZF2 view helpers in PhpStorm

醉酒当歌 提交于 2019-12-04 08:47:36
Does anyone know if PHPStorm has some builtin support for view helper autocompletion or a possibility to write a plugin for it. I don't want to use inline var definitions for this as this would be cumbersome to do if I use a lot of view helpers $this->inlineScript()-> //I want some autocomplete here. $this->translate('some translation')-> //Please give me autocompletion If I use var definitions it will end up as something like this, but it will really clutter up my view: /* @var $inlineScript \Zend\View\Helper\InlineScript */ $inlineScript = $this->inlineScript(); $inlineScript-> //Now I have

Entity Manager in Service in Zend Framework 2

为君一笑 提交于 2019-12-04 08:22:49
问题 I have written a custom service for my module. This service provides public static functions which should validate a given token. Now i want to implement another public static function which checks if an Doctrine-Entity exists or not. For this case i need the object-manager or the service-locator in my service. class ApiService { const KEY_LENGTH = 10; const USE_NUMBERS = true; const USE_CHARS = true; public static function isValid($apiKey) { $isValid = false; # more code tbd $isValid = self:

Change Fieldset Fields' required parameter dynamically

泄露秘密 提交于 2019-12-04 08:08:31
I have a moneyFieldset with 2 fields, amount and currency. class MoneyFieldset ... { public function __construct($name = null, $options = array()) { parent::__construct($name, $options); $this->setHydrator(...); $this->add(array( 'name' => 'currency', 'type' => 'select', 'options' => array( 'value_options' => \Core\Service\Money::getAvailableCurrencies(true), ), 'attributes' => array( 'value' => \Core\Service\Money::DEFAULT_CURRENCY, ), )); $this->add(array( 'name' => 'amount', 'type' => 'text', )); } } public function getInputFilterSpecification() { $default = [ 'amount' => [ 'required' =>

Does Zend Framework 2.0 leave out the amazon s3 library functions that were included in 1.12?

狂风中的少年 提交于 2019-12-04 08:00:49
I was unable to find the equivalent of this http://framework.zend.com/manual/1.12/en/zend.service.amazon.s3.html In the 2.0 version documentation. I also noticed that the 2.0 minimal version is 2.5MB while the 1.12 minimal version is 8.7MB and the full 1.12 version is ~30MB. ZF2 doesn't provides a built-in library for S3 or any other AWS services by default. Zend\Service components has been removed from repository as of July 2012 and some of them still maintained under individual repositories. But the good news is Amazon announced their own AWS-SDK module for ZF2 on March 2013. Also it has a