zend-framework

Doctrine nested array hydration

筅森魡賤 提交于 2020-01-23 17:49:09
问题 i've try to hydrate an nested array to entities. The array looks something like this <?php $arrData = array( 'username' => 'test', 'email' => 'test@test.at', 'images' => array( array( 'name' => 'test', 'url' => 'http://url1.test' ), array( 'name' => 'test', 'url' => 'http://url1.test' ) ) ); ?> So how you can see, there is an one to many relation between user and images. So if what i want to do, is i want do hydrate them into an User entity something like this: <?php $hydrator = new

Use Zend_Autoloader for Models

纵饮孤独 提交于 2020-01-23 12:03:22
问题 does someone knows how to use the "new" Zend Autoloader to Load Models ? In the Moment my Configuration looks like this : application.ini # Autoloader Namespace autoloadernamespaces.0 = "Sl_" Bootstrap.php /** * Start Autoloader * * @access protected * @return Zend_Application_Module_Autoloader */ protected function _initAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'Sl_', 'basePath' => dirname(__FILE__), )); return $autoloader; } So when I place a

Zend_Paginator return as objects

ぐ巨炮叔叔 提交于 2020-01-23 08:31:41
问题 Zend_Paginator returns results as a standard array but I need to make my results come back as an instance of a class, how do I do this? For example, I want all news articles so would need my items to come back as an instance of News_Model_Article 回答1: You can also create custom zend paginator adapter like: class Application_Paginator_Adapter extends Zend_Paginator_Adapter_DbSelect { public function getItems($offset, $itemCountPerPage) { $this->_select->limit($itemCountPerPage, $offset);

Zend_Paginator return as objects

99封情书 提交于 2020-01-23 08:31:09
问题 Zend_Paginator returns results as a standard array but I need to make my results come back as an instance of a class, how do I do this? For example, I want all news articles so would need my items to come back as an instance of News_Model_Article 回答1: You can also create custom zend paginator adapter like: class Application_Paginator_Adapter extends Zend_Paginator_Adapter_DbSelect { public function getItems($offset, $itemCountPerPage) { $this->_select->limit($itemCountPerPage, $offset);

ZendFramework - How to add ->HeadScript() from Controllers?

感情迁移 提交于 2020-01-23 02:17:05
问题 I have a case where i need to add the Javascript from controller to the Layout where it has already HeadScript(); How to do that from controller? e.g: $this->view->HeadScript()->appendScript(); This is controller: Both does not apply. class RouterController extends Zend_Controller_Action { public function init() { $this->view->HeadScript()->appendFile('/js/test.js')->setIndent(8); $this->view->HeadScript( Zend_View_Helper_HeadScript::FILE, '/js/test.js' ); } } This is the view file: index

Blacklist a directory with Zend Opcache

拜拜、爱过 提交于 2020-01-22 17:47:06
问题 How can i tell Zend Opcache not to cache any files from a specific directory. For e.g /var/www/public_html/devzone/* I use PHP 5.5.13 with Zend OPcache v7.0.4-dev 回答1: You should set the opcache.blacklist_filename configuration value with a file path to your blacklist. The location of the OPcache blacklist file. A blacklist file is a text file containing the names of files that should not be accelerated, one per line. Wildcards are allowed, and prefixes can also be provided. Lines starting

Is it worth using Doctrine 2 with Zend Framework?

给你一囗甜甜゛ 提交于 2020-01-22 07:30:09
问题 I know that some users use Doctrine 2 instead of Zend_Db in Zend Framework. But I don't know why. Why is Doctrine2 better than Zend_Db and why Zend_Db is not good? Thanks 回答1: (7-Mar-2013) Disclaimer: This answer is probably now a bit out of date. I'm not keeping up with the PHP community at the moment and this comparison is between Doctrine ORM v2 and Zend Framework v1. This is an apples vs. oranges comparison because they're two different things. Out-of-the-box Zend_Db is more just an

Zend_Session: unserialize session data

青春壹個敷衍的年華 提交于 2020-01-21 10:20:50
问题 I'm using session SaveHandler to persist session data in the database. Sample session_data column from the database: Messenger|a:1:{s:13:"page_messages";a:0:{}}userSession|a:1:{s:7:"referer";s:32:"http://cms.dev/user/profile/view";}Zend_Auth|a:1:{s:7:"storage";O:19:"User_Model_Identity":3:{s:2:"id";s:1:"1";s:8:"username";s:13:"administrator";s:4:"slug";s:13:"administrator";}} I want to delete Zend_Auth object from this session data. How can I unserialize those objects and remove object I need

Zend Framework, passing variables to view

╄→гoц情女王★ 提交于 2020-01-21 09:04:50
问题 I have a problem with displaying a view. When I pass var to view, view doesn't render. Controller: public function indexAction() { $branchModel = new Application_Model_Branches(); $branches = $branchModel->getAllBranches(); $this->view->menu = $branches; } View (index.phtml): <h2>Menu</h2> <?php $this->htmlList($this->menu); ?> When I try debug $branches without assign it to view, all seems to be ok, but when I try push it to view,index.phtml don't appear. Regards 回答1: You're just missing an

Send mail without blocking 'execution'

不羁岁月 提交于 2020-01-21 08:58:47
问题 I'm using Zend_Mail in a Zend Framework application to send an e-mail with the contents of a web-based contact form. The mailing itself works fine ( im using a Google Apps account ) but it can take fairly long to process ( ranging from a few seconds to nearly a minute ). My controler action would normally redirect the visitor after sending the mail, so I thought I might be able to redirect the visitor prior to calling $mail->send() and let the script continue in the 'background': So I tried