zend-framework

How to set the message of the NotEmpty validator on a Zend_Form_Element?

前提是你 提交于 2019-12-10 09:26:41
问题 I have a form element that I'm setting as required: $this->addElement('text', 'email', array( 'label' => 'Email address:', 'required' => true )); Since I'm setting required to true, it makes sure that it's not empty. The default error message looks like this: "Value is required and can't be empty" I tried setting the message on the validator, but this throws a fatal error: $validator = $this->getElement('email')->getValidator('NotEmpty'); $validator->setMessage('Please enter your email

Change Zend Framework Default Module

≡放荡痞女 提交于 2019-12-10 09:25:46
问题 I'm working on a project and have the following project layout: |Project |-Application |-api |-configs |-controllers |-models |-modules |-core |-controllers |-models |-views |-Bootstrap.php |-site1 |-site2 |-site3 |-views |-Bootstrap.php |-Docs |-Library |-Public |-.zfproject.xml I've used this in my application.ini to try and set the default module to be the core module: resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.frontController.moduleDirectory

Taking Database Settings out of the application.ini and into the environment

三世轮回 提交于 2019-12-10 09:17:09
问题 In traditional coding of Zend based applications, the database settings are stored in the application.ini . This stores the settings on a per application basis. Has anyone here on StackOverflow explored the possibility of moving database settings from the application.ini into the environment? For example, a basic way would be storing possibly database connections settings in the Apache2 envvars file or possibly in something like /etc/profile or /etc/environment . There are a couple of reasons

Multiple layouts for different modules - Zend Framework

大城市里の小女人 提交于 2019-12-10 06:18:19
问题 I have a question about layouts in Zend Framework. This is my structure of my project: I have 2 modules named "backoffice" and "frontoffice". I have one layout.phtml in layouts/scripts for both the backoffice and frontoffice. Now I want seperate "layouts/scripts" for "backoffice" and "frontoffice" In my application.ini I have: resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/" Now how can I fix this that I have seperate layouts? 回答1: Just place another layout in the layout

Zend Framework 2: Composer\Autoload\includeFile is slow

喜夏-厌秋 提交于 2019-12-10 04:51:59
问题 According to New Relic transaction tracer, sometimes Composer\Autoload\includeFile takes around 318 ms to load my project. I have dumped a classmap from composer, but still no difference it made. composer.json requires the following: "require": { "php": ">=5.3.3", "zendframework/zendframework": "2.4.*", "zendframework/zendservice-amazon": "2.*", "wisembly/elephant.io": "~3.0", "knplabs/github-api": "~1.2" } I only have one module in my ZF2 application. How can my ZF2 autoloading perform

GROUP_CONCAT with JOINLEFT in Zend Db Select

橙三吉。 提交于 2019-12-10 04:12:08
问题 Assuming that I have 2 tables articles id title 1 Article 1 2 Article 2 Images id article_id image 1 1 a.png 2 1 b.png 3 2 c.png 4 2 d.png All that I want is retreive all articles with their images. For example: article_id title images 1 Article 1 a.png, b.png 2 Article 2 c.png, d.png How could I do that with Zend_Db_Select? I tried something like this but had no luck: $select = $this->getDbTable()->select()->setIntegrityCheck(false)->distinct(); $select->from(array('a'=>'articles')) -

Nested Select using Zend Db

ε祈祈猫儿з 提交于 2019-12-10 03:52:11
问题 I have a query like select empl.idemp ,(select em.firstnm from tbl_employeemaster em where em.idemp = empl.approvedby) as approvedby from tbl_empleaveapplication empl join tbl_employeemaster emp on empl.idemp = emp.idemp join tbl_leavemaster lvm on empl.idleavemaster = lvm.idleavemaster I need to use zend db to build this type of query 回答1: Here is how you can convert your string query into Zend_Db_Select class Empleaveapplication extends Zend_Db_Table_Abstract { protected $_name = 'tbl

passing parameters to zend paginationControl partial

余生颓废 提交于 2019-12-10 03:14:29
问题 I have a page that displays a lot of data, including Zend_Paginator. The page action is /po/fetch?id=someID . what i want to do is to pass the "id" parameter to zend paginationControl so the pagination links will be something like /po/fetch?id=someID&page=somePage . unfortunally i can't find anywhere explanation on how i can pass that parameter to the paginationControl. my call to paginationControl: echo $view->paginationControl($paginator, 'Sliding',$control, $params); where $params = array(

How do I display exception errors thrown by Zend framework

我怕爱的太早我们不能终老 提交于 2019-12-10 02:58:27
问题 Hi guys I'm working with Zend framework and just hate the fact that I seem to encounter hundreds of exception errors like if I try to reference a non existant property of an object my application just dies and crashes. However I have no idea where to see these errors or how to be able to display them on screen. I've set display errors to true and error reporting to E_ALL but when an error is thrown all I see is a blank page rendered only until a bit before where the error apparently occurred

Mysql: General error: 1366 Incorrect string value

蓝咒 提交于 2019-12-10 01:24:06
问题 Today I got an error while I was developing an app based on PHP, MySql and the Zend Framework. Moreover, I'm using phpseclib to encrypt the data using the AES algorithm and here came the problem. The output of the AES algorithm is in a form that seems MySql doesn't like. Infact when I try to insert the data into the database a got an Sql Exception. The error is: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xE4\xD5\xABtZM...' for column 'Name' I've already read all the