zend-framework2

zend framework 2 SQL update and insert affected rows (ZF2)

烂漫一生 提交于 2019-12-24 20:42:09
问题 This is a simple question, but I've looked around and couldn't find the answer. How do I extract the number of affected rows from update/insert SQL queries in ZF2? The following code is working nicely for me (it does update), but I would like to perform proper error checks: public function updateSomeField($id, $some_field){ $data = array( 'some_field' => $some_field ); $sql = new Sql($this->dbAdapter); $update = $sql->update(); $update->table('Table1'); $update->set($data); $update->where

Zend Framework 2 Segment Route matching 'test' but not 'test/'

老子叫甜甜 提交于 2019-12-24 19:27:08
问题 I have two modules Admin and Application. In the module application I have the following route in my module.config.php: 'admin' => array( 'type' => 'Segment', 'options' => array( 'route' => '/admin[/:controller[/:action]]', 'constraints' => array( 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', ), 'defaults' => array ( '__NAMESPACE__' => 'Admin\Controller', 'module' => 'Admin', 'controller' => 'Index', 'action' => 'index', ), ), 'may_terminate' => true, 'child

Zend Framework 2 routing error: resolves to invalid controller class or alias

点点圈 提交于 2019-12-24 17:09:33
问题 I'm trying to learn Zend Framework 2 and I have their skeleton application up and running. In order to access it I visit http://localhost:8080/. When visiting that link it displays their generic Zend page. What I want to be able to do is visit http://localhost:8080/application/test and have it bring me to a different page with a different layout. Here is the module.config.php <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework

The zend framework 2 send email is too slow(google smtp server )

时光毁灭记忆、已成空白 提交于 2019-12-24 16:29:53
问题 I am working on a project, where i need to send notifications to some users, i am using smtp settings with zend framework 2 Zend/Mail library. I have turned on tls and open ssl in php.ini settings. The issue is the notifications are way too slow and usually when 5 or more users are using the application at the same time, i am getting a time out error. Can i make this email send faster using any configuration ? Let me know if there is some configuration can be used. 回答1: Why not add the emails

How to use a data mapper with sql queries

早过忘川 提交于 2019-12-24 16:12:55
问题 I am having trouble understanding the datamapper design pattern. I have two queries (one to get albums and one to get artist). I want to produce a list of albums and artists (band members). There is a one to many relationship between the two. SQL Queries public function getArtist() { $adapter = $this->getAdapter(); $sql = new Sql($adapter); $select = $sql->select(); $select->from('genre'); $select->where(array( 'album_id' => $album,)); $selectString = $sql->getSqlStringForSqlObject($select);

Zend Framwork 2 - mysqli connection configuration and testing example

断了今生、忘了曾经 提交于 2019-12-24 16:12:23
问题 I am trying learn Zend Framework 2 via the skeleton application given, however I don't have any kind of previous experience in Zend. I do know about MVC from other frameworks e.g. yii, symfony. My skeleton app seems to be loading fine, then the next step is to configure a MySQL db connection into the application. So I tried following question's answer: Zend Frameworkd 2 Database connection But that didnt work for me, so I am wondering why. My code is: In the config/autoload/ folder I created

ZF2 File Upload progress not working for me

十年热恋 提交于 2019-12-24 14:20:07
问题 I'm trying to upload files on one of our pages. It's multiupload and I need to track the progress as well. The problem is my XHR request for progress details returns "No upload in progress" message. So here is the code: js: $file.on('change', function(e) { e.preventDefault(); $('#upload-button').prop('disabled', 'disabled'); hideErrors(); hideProgress(); if ($file.val() == '') { showErrors('No file(s) selected'); return; } //$.fn.ajaxSubmit.debug = true; $(this).closest("form").ajaxSubmit({

how can I save PdfModel to file in Zend Framework 2?

蓝咒 提交于 2019-12-24 14:08:25
问题 I use ZF2 and DOMPDFModule\View\Model\PdfModel to generate pdf. When it is shown as a view everything is fine, but I cannot find out how to save it to file (in the code, without asking user about download). I have code like this: use DOMPDFModule\View\Model\PdfModel; $viewModel = new PdfModel($variables); $viewModel->setTemplate('pos/stocklist/' . $type); $viewModel->setOption('paperSize', 'a4'); $viewModel->setOption('paperOrientation', 'portrait'); $viewModel->setOption('fileName', 'stock

Zend Framework 2 - Composer - Manual installation of custom library is removed at install/update

放肆的年华 提交于 2019-12-24 13:29:43
问题 I wrote an own library and included it manually in my composer/autoload_namespaces.php like I was told here. It works fine until I use the install or update command. Then this line is removed and I get an error when trying to use the lib. Any ideas how to prevent this? 回答1: The suggestions you got in the other thread were not very good ones. Composer rewrites the autoload file with information from composer.json and thus you should never edit the php file directly. What you should do is add

ZF2 - validation within a bootstrap modal

做~自己de王妃 提交于 2019-12-24 13:23:29
问题 I am using twitter bootstrap in a zf2 application. A bootstrap modal displays a form containing user details, which i would like to be edited and saved. This is fairly trivial if i just submit form in the dialog and reload the whole page, but i am looking for a way to validate the form without it being submitted, and ideally if the data is valid, for it to pass the new data back to the page when the modal dialog is closed. How can i do this - would it need to be an ajax call? If so how would