zend-framework2

How to use Apigility with an existing ZF2 application?

拜拜、爱过 提交于 2019-12-06 23:15:44
问题 I have a ZF2 Application with some modules. I would like to allow use my existing modules with Apigility, inside my application. I tried installing these modules with composer : "require": { "php": ">=5.3.3", "phpoffice/phpexcel":"*", "monolog/monolog" : "1.*", "zendframework/zend-developer-tools": "dev-master", "bjyoungblood/bjy-profiler": "dev-master", "radnan/rdn-router": "1.*", "bshaffer/oauth2-server-php": "dev-develop", "rwoverdijk/assetmanager": "~1.3", "zfcampus/zf-apigility": "~1.0

How to set filters and validators in ZF2 fieldsets using Zend\Form\Factory?

末鹿安然 提交于 2019-12-06 19:27:11
问题 I use Zend\Form\Factory to create forms in zend framework2 $factory = new Zend\Form\Factory(); $factory->createForm(array( 'elements' => array( array( 'spec' => array( 'name' => 'name', ), ), ), 'input_filter' => array( 'name' => array( 'validators' => array( // validators for field "name" ), 'filters' => array( // filters for field "name" ), ), ), )); You can see that there are filters and validators for field "name". It works. I have the problem if I use fieldsets: $factory->createForm

Zend Framework 2 Forms Array notation for drop down onchange event

二次信任 提交于 2019-12-06 16:07:32
问题 I am using Zend Framework 2 Forms using array notion for a select (drop down box). Code snippet from MenuForm.php is below: $options_for_select = $menuTable->GetParents(); $this->add(array( 'type' => 'Zend\Form\Element\Select', 'name' => 'parent', 'attributes' => array( 'options' => $options_for_select, ), 'options' => array( 'label' => 'Select parent item', ), ) ); When this drop down changes I would like to populate another drop down list on the form with a list of options that are related

OAUTH2 Refresh Token

孤街浪徒 提交于 2019-12-06 15:34:05
I am little confuse of Refresh Token in OAuth2. Like it says access token limit the time window of 1 hour that hacker can use the user credentials and refresh token is long live token which can be use to recreate the access token. I am confused if someone stole the access token from cookie he can also stole the refresh token and can use the refresh token to create new access token as I have ajax request in JQuery (Client Side) NOTE: I have created ajax request to send refresh token on server side I append the Client ID and Secret there with grant type refresh token. I have saved both access

zf2 generating entity with doctrine ORM

眉间皱痕 提交于 2019-12-06 15:31:15
I have Entity classes generated with Doctrine ORM, and ZF2. I changed a table structure and I want to update an entity class, so I am trying to regenerate the entity class but it's not working. I used the following code: vendor/doctrine/doctrine-module/bin/doctrine-module orm:convert-mapping --namespace="Album\Entity\" --force --from-database annotation ./module/Album/src/clear I got the error: [Doctrine\ORM\Mapping\MappingException] Property "status" in "Album\Entity\TestRun" was already declared, but it must be declared only once orm:convert-mapping [--filter="..."] [--force] [--from

Zend Framework 2: formatting a date in a view

只谈情不闲聊 提交于 2019-12-06 15:13:40
问题 I'm new to Zend framework and have decided to try to build a simple app using ZF2. I have a date that is being pulled from the database where my table gateway extends the AbstractTableGateway, this is pulling my data correctly but i'd like to format my date using Zend_Date and not manipulate the string representation myself in my model / view. Does anybody have any ideas about how i do this? 回答1: Here is my custom datatime helper for reference: https://github.com/AlloVince/eva-engine/blob

Zf2 Locale in URL and $this->url

做~自己de王妃 提交于 2019-12-06 14:52:01
I am developing a web app on ZF2 Skeleton App base. I have played with lot of options but failed to get final headway. I need to route the url as under: http://myapp/ http://myapp/en/album to AlbumController/indexAction. Also, links need to work as: http://myapp/en/album/edit/1 http://myapp/en/album/delete/1 The code generates correct URLs but on clicking returns "404" error My Application/module.config.php is as under: return array ( 'router' => array ( 'routes' => array ( 'home' => array ( 'type' => 'Zend\Mvc\Router\Http\Literal', 'options' => array ( 'route' => '/', 'defaults' => array (

ZF2 get values from database into form class

浪子不回头ぞ 提交于 2019-12-06 14:51:28
问题 In ZF2, suppose I have a Select in the form: $this->add([ 'type' => 'Zend\Form\Element\Select', 'name' => 'someName', 'attributes' => [ 'id' => 'some-id', ], 'options' => [ 'label' => 'Some Label', 'value_options' => [ '1' => 'type 1', '2' => 'type 2', '3' => 'type 3', ], ], ]); How can I put the values 'type 1', 'type 2', 'type 3', etc. from a database query into value_options ? 回答1: By registering a custom select element with the form element manager, you can use a factory to load the

Zf2 - Set value in element inside collection

心不动则不痛 提交于 2019-12-06 14:43:40
I have a collection used in form, i know that if i want to set a value in a normal element i use: $form->get('submit')->setValue('Update'); How can i set a value in the field 'Address "For example"' in a collection '' "I use zend Framework 2". $companies = $this->getCompaniesTable()->getCompanies($id); $form = new CompaniesForm(); $form->bind($companies); $form->get('submit')->setValue('Update'); $form->get('submit')->setValue('Update'); $form->get('address')->setValue('test address'); Last line of the prev. code doesn't work, what's wrong ?! The form code is: <?php namespace Companies\Form; /

How to work with cron job in zendframework 2? [duplicate]

我与影子孤独终老i 提交于 2019-12-06 14:29:13
问题 This question already has answers here : How to run cron job with zend framework 2 (2 answers) Closed 6 years ago . I have two functions in zend framework 2, which fetch me the details of apartments from another site and save them in my data base. (BUT THEY DO SO ONLY WHEN I RUN THE FUNCTIONS). say the controller name is 'FetchFromSourceController' and the functions are 'index' and 'ical'. those are the names I used. But my requirement is those two functions should run automatically one after