zend-framework2

Set custom filter plugin inside servicemanager config zend framework

旧街凉风 提交于 2019-12-25 07:44:45
问题 I have the following code in my application user form that creates the input filter for the address2 element . $inputFilter = new InputFilter(); $inputFilter->add([ 'name' => 'address2', 'required' => true, 'filters' => [ ['name'=>'StringTrim'], ['name'=>'Administration\Filter\Ucwords'] ] ]); As you can see, I have the class name set as the name of the filter. I get the following error: A plugin by the name "Administration\Filter\Ucwords" was not found in the plugin manager Zend\Filter

Sub Query at join not coming in right way

风流意气都作罢 提交于 2019-12-25 06:44:59
问题 Hiii, Currently I am stuck with a problem. I am finding no way to remove quotes generated by the zend on query generation of a sub query which is placed in a join operation. The $selectInnerQuery creates the sub query which is used in the join operation this is called as inneranswer table. This is used to join with answer table. $select is used for the final query. Please help me on this... $selectInnerQuery= $sql->select()->from(array('answer' => 'tblanswer'))->columns(array('aid' => new

Zend\Db: Select from subquery

心不动则不痛 提交于 2019-12-25 06:01:15
问题 I'm porting an application from ZF1 to ZF2 and as part of that I have to rewrite our database mappers. I'm struggling with this SQL statement: SELECT full_name, GROUP_CONCAT(value) FROM ( SELECT full_name, value FROM my_table ORDER BY id DESC ) as subtable GROUP BY full_name ORDER BY full_name DESC; The underlying problem I'm trying to solve is that I need to order the results of the sub query before running GROUP_CONCAT and I need it to work for both MySQL and Sqlite. In MySQL I could simply

ZF2 Dependency Injection of Module Service without Bootstrap.php

与世无争的帅哥 提交于 2019-12-25 05:30:07
问题 I am trying to create an instance of a service which I have implemented in ZF2. Module.php namespace ProductImage; use Zend\Db\ResultSet\ResultSet; use ProductImage\Model\ProductImageStorage; use ProductImage\Service\ProductImageService; use Zend\ModuleManager\Feature\ServiceProviderInterface; use Zend\Db\TableGateway\TableGateway; use ProductImage\Model\ProductImageTable; use ProductImage\Model\ProductImage; class Module implements ServiceProviderInterface { /* Invoked by Module Manager */

How to calculate sha256 for large files in PHP

假如想象 提交于 2019-12-25 05:23:25
问题 I would like to ask your assistance on how to calculate sha256 of large files in PHP. Currently, I used Amazon Glacier to store old files and use their API to upload the archive. Initially, I just used small files that cannot reach to MB-sized images. When I tried to upload more than 1MB, the API response said that the checksum I gave to them is different from what they had calculated. Here is my code to upload the file: //get the sha256 using the file path $image = //image path; $sha256 =

Get default zend db adapter in table model

岁酱吖の 提交于 2019-12-25 03:59:34
问题 How can I get the default db adabter in my table model? I want to use it to create a transaction. In database.global.php: return array( 'service_manager' => array( 'factories' => array( 'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory', ), 'aliases' => array( 'db' => 'Zend\Db\Adapter\Adapter', ), ), 'db' => array( 'driver' => 'Pdo', 'dsn' => 'mysql:dbname=cww;host=localhost', 'driver_options' => array( PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'' ), ), ); Now I

Log each request in ZF2

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 03:44:06
问题 We are using zend framework 2 for a new application, i would like to have the same logging system of Rails or similar, i would like have a log for each request, is possible to do this in Zend? 回答1: It depends what you want to log. If it is just an access log, you should try to use the webserver's log. The logs from Apache/nginx/IIS etc perform better than you will achieve in your ZF2 app. If you need to log inside the ZF2 application, you have two choices. First option is at bootstrap . It's

Zend - form doesn't get validated

荒凉一梦 提交于 2019-12-25 03:34:43
问题 I'm trying to validate a form in the actual form itself, but it doesn't get validated at all. If I type "someemail&*!([]@gmail.com", it doesn't really give a crap and moves on. Form: class RecoverPasswordForm extends Form { public function __construct($options = null) { parent::__construct("RecoverPassword"); $username = new Element("username"); $username->setLabel("Email"); $username->setAttributes( array('filters' => array( array('name' => 'StringTrim'), array('name' => 'StripTags')),

Zend Framework 2 routing issue

主宰稳场 提交于 2019-12-25 03:27:44
问题 I have just started learning ZF2, so I apologize if the question is trivial. What I want to achieve is to redirect the user from projectname.loc:8888/user to projectname.loc:8888/user/login If I enter projectname.loc:8888/user/login manually the form is displayed without any issues. If I enter projectname.loc:8888/user then I get the following error message: Route with name "login" not found. The route setting is modul.config.php are: 'user' => array( 'type' => 'Literal', 'options' => array(

How to create SOAP service using ZF2?

雨燕双飞 提交于 2019-12-25 03:19:21
问题 What is wrong in my code? How to create SOAP service for my Math class? Please note that, i don't mentioned namespace for Math.php because if i did that i got class Math does not exist message on browser. Without mentioning namespace of Math class how to create Math object in indexAction(). Please guid me how to create my first wsdl for Math class. Folder structure Module --Soap ----Controller ------>IndexController.php ----Services ------>Math.php IndexController.php include_once __DIR__ . '