zend-framework-modules

Unable to access module forms in module controller

折月煮酒 提交于 2019-12-24 14:58:36
问题 I have a test module. In test module I have a Form in forms folder. myproject/application/modules/test/forms/TestForm.php class Test_Form_TestForm extends Zend_Form { //form elements } myproject/application/modules/test/controllers/TestController.php class Test_TestController extends Zend_Controller_Action { public function indexAction() { $this->view->form = new Test_Form_TestForm(); // this is generating error } } // end class Form initialization in controller is generating following error:

ZF2 An Invalid Factory Was Registered

≡放荡痞女 提交于 2019-12-23 10:01:07
问题 I've the following classes and my module config in ZF2 application and it is giving the below error: While attempting to create applicationformuserform(alias: Application\Form \UserForm) an invalid factory was registered for this instance type. UserFormFactory.php <?php namespace Application\Factory\Form; use Zend\ServiceManager\FactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; use Application\Form\UserForm; class UserFormFactory implements FactoryInterface { public function

Symfony2: upload a file using a file upload plugin

家住魔仙堡 提交于 2019-12-18 18:30:35
问题 I want to upload a text file received via AJAX request in Symfony2 (using Uploadify 2.1.4). How can I process it in an action? I've found some info in the official docs, but I guess it is not what I'm looking for. For instance, I processed such a situation in Zend Framework this way: $adapter = new Zend_File_Transfer_Adapter_Http(); $adapter->setFilters(array( 'Rename' => array( 'target' => sprintf('%s/%d_%s', Zend_Registry::get('config')->uploads->uploadPath, time(), $adapter->getFileName

Zend reusable widgets / plugins / miniapplications?

百般思念 提交于 2019-12-13 14:52:11
问题 I'm new to Zend framework and trying to get some insights about code re-usability. I definitely know about modules but there seems to be a bit of uncertainty about what functionality should go into modules and what not. What I'm trying to accomplish: 1) to have reusable mini programs/widgets/plugins (whatever you may call them) that one can simply plug into any site be doing this in layout or view: <?php echo $this->contactform;?> or this in the view: <?php echo $this->layout()->blog;?> I'd

ZF2: How to attach listener on the event in the Module class?

风格不统一 提交于 2019-12-13 06:45:34
问题 I want to set a basePath to be the same for every component of my Mvc for a given request. I mean when I call these methods I want to get the same result, lets say '/spam/ham/' : echo $this->headLink()->prependStylesheet($this->basePath() . '/styles.css') // $this->basePath() has to be '/spam/ham/' $this->getServiceLocator() ->get('viewhelpermanager') ->get('headLink') ->rependStylesheet($this->getRequest()->getBasePath() . '/styles.css') // $this->setRequest()->getBasePath() has to be /spam

Automatic convention-based routing within a module in Zend Framework 2--possible?

折月煮酒 提交于 2019-12-13 04:23:25
问题 I'm trying to understand all the configuration necessary to get my routing working in Zend Framework 2, and I can't help but wonder if I am making this more complicated than necessary. I am working on a simple app that will follow a very simple convention: /:module/:controller/:action I've already created and wired up my module, "svc" (short for "service)". I then created a second controller, the "ClientsController", and I can't get the routing to pass through my requests to, e.g., /svc

zend modules like in rails

人盡茶涼 提交于 2019-12-11 22:49:46
问题 is there a way to do modules in rails 3 like zend framework modules ? In zend framework, you have a folder 'modules' like following structure: /application/modules/admin /application/modules/site /application/modules/service and it's routed in this way: http://myapp.local/admin http://myapp.local/service http://myapp.local/ -- to site module (default). How can I achieve this in Rails 3? There's a better way to do this type things in rails ? Thanks in advANCE 回答1: How about controller

ZF2 - Error Handling for a Specific Module Only

回眸只為那壹抹淺笑 提交于 2019-12-11 18:17:25
问题 I have a multi-modular app. And one of its modules listens to "dispatch.error" with 999 priority. And it appears to catch errors from all other modules. What I need is to catch error in my specific module only and behave appropriately. It will work if I for example will listen to "dispatch.error" with 1000 priority and filter out errors specific to my module (by exception names or using route filtering), but there's no guarantee that some other module won't come with 10000 priority for the

Translations from DB in ZF2

人盡茶涼 提交于 2019-12-11 12:33:57
问题 I have problem with creating custom translator from database in ZF2. I have a DB like this and files: 1)Application/module.config.php 'service_manager' => array( 'abstract_factories' => array(), 'factories' => array( 'translator' => function($sm){ $translator = new \Zend\I18n\Translator\DatabaseTranslationLoaderFactory(); return $translator->createService($sm); }, ), ), 'translator' => array( 'locale' => 'en_US', 'translation_file_patterns' => array( array( 'type' => 'Zend\I18n\Translator

ZF2: How can I set basePath to be the same for a whole application?

会有一股神秘感。 提交于 2019-12-11 10:23:00
问题 The manual's example shows how to set the basePath only for some specific viewModel : $this->getHelper('basePath')->setBasePath() But I want to set it somewhere in one place and then it is the same for any viewModel I create in any Controller. How can I do it? 回答1: You could set a global base path in config: 'view_manager' => array( 'base_path' => '/path/' ) 来源: https://stackoverflow.com/questions/13955426/zf2-how-can-i-set-basepath-to-be-the-same-for-a-whole-application