天道酬勤,学无止境

zend-framework

Zend Framework: This row has been marked read-only

This is the first time I've come across this issue. When saving one of my models I get the error message: "This row has been marked read-only". Not sure why I'm getting this error and how to solve it. The stack trace didn't help me. How can I resolve this issue so I can save the record?

2021-06-15 11:41:23    分类:问答    zend-framework

Page Load - White “flash” inbetween pages

There are two websites, one live one under development. I am porting a site to Zend Framework (for maintainability/integration purposes). The original (live) site has seamless page loads - it will load, then update the content on the screen while keeping the background image, navigation etc on the page. The ported site (development) "flashes" completely white for a brief moment then all of the content appears simultaneously. From what I understand, this is not a FOUC (flash of unstyled content). The content on both of the sites always appears fully styles with all CSS rules. The two sites look

2021-06-15 09:06:23    分类:问答    php   css   zend-framework   xhtml   fouc

Zend Framework: How to 301 redirect old routes to new custom routes?

I have a large list of old routes that I need to redirect to new routes. I am already defining my custom routes in the Bootstrap: protected function _initRoutes() { $router = Zend_Controller_Front::getInstance()->getRouter(); $oldRoute = 'old/route.html'; $newRoute = 'new/route/*'; //how do I add a 301 redirect to the new route? $router->addRoute('new_route', new Zend_Controller_Router_Route($newRoute, array('controller' =>'fancy', 'action' => 'route') )); } How can I add routes that redirect the old routes using a 301 redirect to the new routes?

2021-06-15 07:53:01    分类:问答    zend-framework   redirect   http-status-code-301

Magento: Get Collection of Order Items for a product collection filtered by an attribute

I'm working on developing a category roll-up report for a Magento (1.6) store. To that end, I want to get an Order Item collection for a subset of products - those product whose unique category id (that's a Magento product attribute that I created) match a particular value. I can get the relevant result set by basing the collection on catalog/product. $collection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToFilter('unique_category_id', '75') ->joinTable('sales/order_item', 'product_id=entity_id', array('price'=>'price','qty_ordered' => 'qty_ordered')); Magento doesn't

2021-06-15 06:38:50    分类:问答    sql   zend-framework   magento

How do I configure Bisna for use with Doctrine 2.1 and Zend Framework 1.11.9? [EDIT - my mistake]

I had the previous version of Bisna (before July 22nd), with Doctrine 2.0 working good, according to the instructions in http://www.zendcasts.com/unit-testing-doctrine-2-entities/2011/02/. Yesterday I decided to upgrade to Doctrine 2.1, and had to upgrade Bisna as well, as it was incompatible with Doctrine 2.1. So I deleted the entire Doctrine and Bisna directories from my library directory, brought in the new version of each of them, added the autoload init method to the bootstrap, and updated my application.ini file with the relevant changes. However, when I try to access the application

2021-06-15 06:38:46    分类:问答    zend-framework   doctrine-orm

How to add variable at the start of the URL in Zend Framework?

I am trying here to create url, like: /admin/login /moderator/login both the request would be served by same controller & action made for login, i.e. /account/login/<type> Currently, all I am able to make the following URL: /login/admin /login/moderator My current config file looks like the following: resources.router.routes.login.route = "login/:type" resources.router.routes.login.defaults.controller = "account" resources.router.routes.login.defaults.action = "login" I can't figure out, on how to put the type variable at the start of URL, I tried it but it gives server error. edit I got this

2021-06-15 05:00:09    分类:问答    php   zend-framework   zend-route

Magento - How to query admin's role name?

I am trying to get the name of the role of the currently logged in admin. I can get the admin user, but I can't figure out how to query their role name. The Magento docs are weak =/ $usr = Mage::getSingleton('admin/session')->getUser(); Ideas anyone?

2021-06-15 04:07:19    分类:问答    php   zend-framework   magento

How to capture a Zend view output instead of actually outputting it

Problem: sometimes in our zend controller we don't want the script to be output directly, but rather want the content of that script. One example: when we need the result html output of a view script be included in another structure like JSON or XML for processing in the client side. I found the result here at stack overflow, but not so quick since it was in a different context. I have been struggling with this for 2 days now. As it turned out it was very simple: // in our controllers' action method $this->_helper->layout()->setLayout('empty'); // disable layout $this->_helper->viewRenderer-

2021-06-15 04:06:55    分类:问答    zend-framework   capture   zend-view

Optimize my performance

I'm working on a project with Zend Framework 1.11, Doctrine 2, some Symfony 2 componenents and others tools & libraries. I'm trying to optimize performance using Xdebug & Webgrind. I've already found some bottlenecks like parsing Ini config, etc.. and cached that. Now, I just realize that the autoloading is the most costly part of my application: Opl\Autoloader\ApcLoader->loadClass 274 31.36 43.86 Zend_Loader_PluginLoader->load 150 4.80 12.29 Zend_Loader_Autoloader->getClassAutoloaders 278 1.42 1.91 Zend_Controller_Router_Route_Regex->_getMappedValues 291 1.29 1.35 Doctrine\ORM\UnitOfWork-

2021-06-15 04:02:10    分类:问答    php   performance   zend-framework   optimization   autoloader

Attachment name and file extension not working in email *.eml

I want to create email files in .eml format with multiple attachments in. The attachments are generated and the content of the attachments are correct. But the attachments always come in .dat format and the file names go as "ATT00001", "ATT0002".. etc Currently I am following the solution given in this stackoverflow question and my code is as follows PHP foreach($reports as $pdf){ $attachment = file_get_contents("auto_report_attachments\\Template_Attachment.eml"); $attachment = str_replace("TEMPLATE_MIME_TYPE", $pdf['type'], $attachment); $attachment = str_replace("TEMPLATE_FILE_NAME", $pdf[

2021-06-15 03:51:11    分类:问答    php   email   zend-framework   email-attachments   eml