zend-framework

Calendar in Zend Framework

不问归期 提交于 2019-12-07 19:26:23
I looking to create a custom calender with Zend Framework, I am hoping that it will be able to list all the days of the month for the coming years and then have a different bg color on the date if there is an event on this. I am however struggling to create this firstly because it needs to go into the layout view, rather than an action, so where does the logic go? I am also unclear as to how the logic with mkdate() would work. Can someone point me in the right direct please? Thanks user114303 Here is a simple Calendar class that uses Zend_Date and Zend_Locale that you can use as a starting

zend framework join 3 tables

不想你离开。 提交于 2019-12-07 19:19:45
问题 I have 3 tables (order, product, order_item). In order i have the date. In order_item i have product_id and order_id . I need to select all products with orders, what created in the current month. It is my select: $select = $this->select() ->setIntegrityCheck(false) ->from(array('o' => 'order')) ->join(array('oi' => 'order_item'), 'o.id = oi.order_id', array('quantity')) ->joinLeft(array('p' => 'product'), 'p.id = oi.product_id', array('id', 'pbv', 'name')) ->where('MONTH(o.date) = MONTH

How to get SSL+mod_rewrite+Zend Framework MVC working together?

我与影子孤独终老i 提交于 2019-12-07 19:17:00
问题 So, I got ZF MVC site and want to force SSL connection on everything under my /checkout/ I tried using mod_rewrite for that, so my .htaccess would look like this: RewriteEngine on RewriteRule (\/checkout.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R] RewriteRule !\.(js|ico|gif|jpg|png|css|swf|xml|avi|flv|mov|mp3|wav)$ index.php [L] Sure enough, it does kick in SSL, but second rule, that's ZF specific and redirects everything to index.php sorta erases the protocol specification. Unfortunately my

Zend Forms - Element ID modification to allow re-use

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 19:15:06
问题 I have a Zend_Form object that I want to re-use several times in one page. The problem I'm having is that each time it's rendered it has the same element IDs. I've been unable to find a method for giving all the IDs a unique prefix or suffix each time I render the form. Complete Solution Subclass Zend_Form : class My_Form extends Zend_Form { protected $_idSuffix = null; /** * Set form and element ID suffix * * @param string $suffix * @return My_Form */ public function setIdSuffix($suffix) {

PHPUnit test a method that returns an objects property

跟風遠走 提交于 2019-12-07 18:55:27
public function thisMethod { $example = $this->methodReturnsObject()->this1->that2->there3->id; return $example; } How would you test thisMethod in PHPUnit? Obviously I could write an expectation that methodReturnsObject() will return something... but what? That object has properties associated with it, but how would you even mock that value? The answer is "You don't". Unit testing should test each class in isolation, what you are trying to do there is not a unit test. As I said in my comment, you are breaking the Law of Demeter , which simply stated says Each unit should have only limited

ZF2 Generate navigation using zfcrbac zfcUser and hierarchical role strategy

谁都会走 提交于 2019-12-07 18:52:22
问题 I begin in zf2 and i have to handle Many to Many permissions/roles. Using ZfcRbac. So i make a mapping with User / Hierarchical Role (table name= role) / permissions And i make some guards with deny policy. My guard, mapping, database, are ok. My HierarchicalRole Entity looks like : class HierarchicalRole implements HierarchicalRoleInterface And it's, for now the same as the original given by Bakura. My user Entity looks like this : class User extends ZfcUserEntity implements

Zend_Rest_Route and hierarchical routes

本小妞迷上赌 提交于 2019-12-07 18:41:54
问题 Using Zend 1.9, I am trying to use Zend_Rest_Route to implement hierarchical url. So I have 2 restFul controller ( users and items ) and invoke the second controller using hierarchical routes. Example: (consider GET http verb) http://example.org/users/ //this point to indexAction of usersController http://example.org/users/234 //this point to getAction of usersController http://example.org/users/234/items //this point to indexAction of itemsController http://example.org/users/234/items/34 /

On submit the form don't display its POST data

人走茶凉 提交于 2019-12-07 18:21:37
I have a little experience with Zend Framework, but I like to fiddle with it until it works. But now I cannot resolve this problem. I have a form: <?php class Application_Form_Login extends Zend_Form { protected $notEmpty; public function init() { // Create NotEmpty validator $notEmpty = new Zend_Validate_NotEmpty(); // Configure validators for username element $notEmpty->setMessage('Gelieve dit veld in te vullen'); $this->setMethod('post'); // emailAddress $this->addElement('text', 'emailAddress', array( 'filters' => array('StringTrim', 'StringToLower'), 'required' => true, 'validators' =>

Magento editor automatic line break issue while adding new product

旧街凉风 提交于 2019-12-07 18:21:16
问题 I'm adding a new product in Magento CE 1.7.0.2. I entered the HTML code in Short Description attribute. MY PROBLEM: I really don't know where these extra <br> coming from. Even the WYSIWYG editor is not showing these <br> but they are appearing on the website's product page. Please help. WHAT I ENTERED: <p>Product Description:</p> <table border="1" cellspacing="0" cellpadding="5px"> <tr> <td>Category</td> <td>Specials</td> </tr> <tr> <td>Texure</td> <td>Digitally Printed on High Quality Matte

Can't set custom validator messages in Zend_Form

删除回忆录丶 提交于 2019-12-07 18:19:29
I just can't figure it out how to set custom validator messages in Zend_Form object. Here is an example code. $this->addElement('password', 'password', array( 'label' => 'Password', 'decorators' => array('ViewHelper'), 'filters' => array('StringTrim'), 'validators' => array( array('Digits', false, array('messages' => array('notDigits' => 'Only digits are allowed here'))) ), 'required' => true )); When I try to validate the form entering invalid data a message saying "notDigits" appear. I tried to change 'notDigits' to Zend_Validate_Digits::NOT_DIGITS, but it still doesn't work as expected. Any