zend-framework

zf tool & PHPunit not recognised in include_path

谁说胖子不能爱 提交于 2019-12-07 23:22:41
问题 I've be struggling with this for a while. When using the zf tool included in the Zend Framework 1.11 to both create projects and actions and so on, I always get the notice that PHPUnit was not found in the include path and hence the test have not automatically been created. I know that this is only a notice and not an error however I would like it to work. I am using OS X 10.7 and MAMP, my include path in MAMP is as follows: include_path = ".:/Applications/MAMP/bin/php/php5.3.6/lib/php:

changing zend framework default action based on the controller

柔情痞子 提交于 2019-12-07 22:25:50
问题 So I know that you can set a custom default action in Zend Framework in the application.ini : resources.frontController.defaultAction = "something" But what if I want this default action to be contingent on the controller? So controller A 's default action will be B , controller C 's default action will be D , etc how do I configure the controllers to take these default action parameters? What piece of code is needed and where should I place them? 回答1: You can add in your Bootstrap.php

Error in Draw image on PDF using Zend Framework in Magento2

大兔子大兔子 提交于 2019-12-07 22:14:37
问题 I am working on create a catalog PDF in Magento-2 using Zend Framework. My code is here to print catalog image on PDF. foreach ($collection as $product) { $image = $product->getImage(); $path = $mediaUrl."catalog/product".$image; $imagef = Zend_Pdf_Image::imageWithPath($path); // write image to page $page->drawImage($imagef, 50, 50, 400, 400); } But it did not work for me. 来源: https://stackoverflow.com/questions/48800875/error-in-draw-image-on-pdf-using-zend-framework-in-magento2

Zend form and Zend filter HtmlEntities

我怕爱的太早我们不能终老 提交于 2019-12-07 22:07:20
问题 I have a registration form with a few fields. One of them looks like this: $first_name = new Zend_Form_Element_Text('first_name'); $first_name ->setLabel("First name") ->setRequired(true) ->addFilter(new Zend_Filter_HtmlEntities()); I use the same form for editing user's details. The problem is with the Zend_filter_HtmlEntities. It does the job when I send the form's data to the database, it replaces html special chars with their alternatives. However, when I initialise this form and give it

Where to place Zend_Forms, Controller? Model? Somewhere else?

こ雲淡風輕ζ 提交于 2019-12-07 22:01:56
问题 Where is it best to put the code for building my Zend_Forms? I used to put this logic inside my Controllers, but moved away from that after I needed to use the same form in different places. It meant I had to duplicate the creation of forms in different controllers. So I moved the form creation code into my Models. Does this seem right, it works for me. Or is there something I am missing, and they should in fact go somewhere else? 回答1: I usually put my form building code in separate files,

Zend Mysql get ENUM values

你说的曾经没有我的故事 提交于 2019-12-07 22:01:26
问题 I use Zend Framework in my application. And I want to know how to get values from ENUM field in MySQL table. For example: i have permissions field ( ENUM ('delete_admin', 'edit_admin')). How to get array('delete_admin', 'edit_admin') in he best way? Thank you in advance. 回答1: This is how i did it: in your model put this function getInfoTabella() { $data = $this->info(self::METADATA); return $data; } then use this: $model = new $model_name(); $description = $model->getInfoTabella(); $enum =

Phpunit skeleton generator cannot find extends class

梦想与她 提交于 2019-12-07 21:41:53
问题 I have an application based on the Zend Framework that I am trying to use phpunit to generate skeletons for the test cases. Phpunit can't seem to find the parent classes of the classes I am trying to generate for: phpunit --skeleton-test Default_Model_Person ../application/models/Person.php PHPUnit 3.5.11 by Sebastian Bergmann. PHP Fatal error: Class 'X1_Db_Table_Auditable' not found in /path/to/application/models/Person.php on line 3 Fatal error: Class 'X1_Db_Table_Auditable' not found in

Add HTML placeholder into Zend_Form

别来无恙 提交于 2019-12-07 21:12:31
问题 I'm using Zend_Form for an application form using this code: class Form_ApplicationForm extends Zend_Form { public function init() { $this->setAction('/application/new') ->setMethod('post') ->setAttrib('id','application'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Your Name') ->setRequired(TRUE) ->addValidator('alpha', FALSE, array('allowWhiteSpace' => true)); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email Address') ->setRequired(TRUE) ->addValidator(

Fatal exception in loading ini file

筅森魡賤 提交于 2019-12-07 20:37:14
问题 My project folder is demo, inside which I have the folders application, library and public. Inside the application folder, I have a folder named configs, inside which I have a file 'application.ini', which contains my database parameters. So, in the bootstrap.php which is in application directory, I set my database in Zend registry in a function called _initDbAdapter : $config = new Zend_Config_Ini('/demo/application/configs/application.ini', 'development'); Zend_Registry::set('config',

zend framework FlashMessenger problem

半世苍凉 提交于 2019-12-07 19:49:46
问题 i am using FlashMessenger helper to set messages, but i am unable to retrieve messages using getMessages() method. it returns null. here is my sample code: <?php class Admin_TestController extends Zend_Controller_Action { protected $_flashMessenger = null; public function init() { $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger'); $this->initView(); } public function myAction() { $this->_flashMessenger->addMessage('test message'); $this->_helper->Redirector("mynextrequest")