zend-framework

zend framework 2 - compare 2 inputs using validator?

依然范特西╮ 提交于 2019-12-12 18:28:09
问题 I'm new to zend framework 2 and I have a question on comparing two inputs in the factory-backed form. My scenario is like following: I want to compare two inputs, for example, $startDate and $endDate . I want to validate that $startDate is always less than $endDate . How I'm going to do this? For example: $inputFilter->add($factory->createInput(array( 'name' => 'startDate', 'required' => true, 'validators' => array( array( 'name' => 'LessThan', 'options' => array( 'max' => $endDate, ), ), ),

Zend Framework url redirect

懵懂的女人 提交于 2019-12-12 18:19:02
问题 <?php class PI_Controller_Plugin_AssetGrabber extends Zend_Controller_Plugin_Abstract { public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) { /* The module name */ $moduleName = $request->getModuleName(); /* This modules requires the user to be loggedin in order to see the web pages! */ $loginRequiredModules = array('admin'); if (in_array($moduleName,$loginRequiredModules)) { $adminLogin = new Zend_Session_Namespace('adminLogin'); if (!isset($adminLogin->loggedin))

Zend_Form Jquery & fileUploadErrorIniSize

泄露秘密 提交于 2019-12-12 18:18:10
问题 Edit, I fixed it by changing my JS to: $('.zend_form input:not([type="file"]), .zend_form textarea').each(function() { data[$(this).attr('name')] = $(this).val(); }); Hello, As I posted earlier, I followed a ZendCast that allowed you to use jQuery to detect and display to users problem with their form. However, file fields always return: fileUploadErrorIniSize (File 'image_front_url' exceeds the defined ini size" even if the file is within size limits. TPL For Forms: <?php $this->headScript()

doctrine 2 no metadata classes to process

怎甘沉沦 提交于 2019-12-12 18:16:08
问题 I already integrated zf 1 with doctrine 2 I created entities by this: php doctrine.php orm:convert-mapping --force --from-database annotation C:/wamp/www/ip/application/models now I'm going to create getter and setter for them and generating entities I get the errors no metadata classes to process php doctrine.php orm:generate-entities --generate-annotations="true" C:/wamp/www/ip/application/models 回答1: 1- In the entity files generated, you need to delete this line: "use Doctrine\ORM\Mapping

How to use Zend_Date to print a time in a specific timezone

佐手、 提交于 2019-12-12 18:13:38
问题 In my app I use Zend_Date. I have set date_default_timezone_set('UTC') because internally and in the database I only want to have UTC times. For users I want to display it in their local time. What is the easiest way to do this? Let's say, I have in the view $user->timezone and $date, where $timezone is 'Europe/Helsinki' and $date is a Zend_Date. 回答1: This should be better documented in the manual, as it's a pretty common use case. Fortunately it's nice and easy: $date->setTimezone($user-

Zend Framework Widget Tutorial question

一曲冷凌霜 提交于 2019-12-12 17:28:34
问题 I try to follow this tutorial, but I can't get it to work: http://weierophinney.net/matthew/archives/246-Using-Action-Helpers-To-Implement-Re-Usable-Widgets.html I did everything as described, but I don't know how to make it available in my controllers. My filesystem looks like this: - application - controllers - IndexController.php - modules - user - configs user.ini - controllers - forms Login.php - helpers HandleLogin.php - views - scripts login.phmtl profile.phtml Bootstrap.php - views

How can I join tables in Zend while using a class that inherits from Zend_Db_Table_Row_Abstract?

空扰寡人 提交于 2019-12-12 17:19:28
问题 I have a class that extends Zend_Db_Table lets call it 'Users' that uses the class 'User' (inheriting from Zend_Db_Table_Row_Abstract) as its rowClass. I need it this way because User has additional methods that I use. As far as I know it is not possible to join tables inside my Users class so I use: $query = $db->select(); $query->from(...); $query->joinInner(...); instead of $this->select(); ... But then of course the rows I get are not of the User class. So I would like to know how can I

How to create modular MVC components in Zend Framework

大兔子大兔子 提交于 2019-12-12 16:16:45
问题 I've been having problems created modular reusable components in my Zend Framework app. In this case I'm not referring to Zend Framework modules but rather the ability to have a reusable MVC widgety thing if you like. The problems I'm having may be very particular to my implementation, but I'm completely happy to throw it out and start again if someone can point me in the right direction. Anyway, specifics and code will hopefully explain things better and even if what I'm doing is not the

Is there a way to prefix Zend_Form element name?

前提是你 提交于 2019-12-12 16:14:57
问题 I have a page that has multiple forms on it. Several of the forms share an element with the same name like CustomerID. This means the element ID CustomerID will collide with that same ID in the other forms. I would like to find a clean way to prefix the field name with the name of the form. For instance PaymentProfile_CustomerID. Suggestions? So far, the best I have been able to come up with is: class MyForm extends Zend_Form { public function init() { $this->setName("PaymentProfile"); ...

Zend ACL Dynamic Assertion

无人久伴 提交于 2019-12-12 16:12:14
问题 I want to restrict my users to edit/delete only the comments which they added. I found an example on youtube by a guy named intergral30 and followed his instruction. And now my admin account has the possibility to edit/delete everything, but my user has no access to his own comment. Here's the code: Resource class Application_Model_CommentResource implements Zend_Acl_Resource_Interface{ public $ownerId = null; public $resourceId = 'comment'; public function getResourceId() { return $this-