zend-framework2

calling adapter in model

喜夏-厌秋 提交于 2019-12-11 12:47:51
问题 Module : public function getServiceConfig() { return array( 'factories' => array( // 'user' table------------------------------------- 'Album\Model\AlbumTable\dbtable=user' => function($sm) { $tableGateway = $sm->get('UserTableGateway'); $table = new SignupTable($tableGateway); return $table; }, 'UserTableGateway' => function ($sm) { $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter'); $resultSetPrototype = new ResultSet(); $resultSetPrototype->setArrayObjectPrototype(new Signup()); return new

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 / PHPUnit: Mock a Zend/Db/Adapter/Adapter for further usage

为君一笑 提交于 2019-12-11 11:46:51
问题 The goal: Unit test an InputFilter in Zend Framework 2. The problem: A mocked DbAdapter is needed. As I am relatively new to Unit Testing I just got started with mocking classes. After doing a lot of research I'm still unable to find a proper solution for my problem so here we go with my filter to start things off: class ExampleFilter extends Inputfilter { protected $dbAdapter; public function __construct(AdapterInterface $dbAdapter) { $this->dbAdapter = $dbAdapter; } public function init() {

Can I access other Google User's Calendars through the Google API v3

一笑奈何 提交于 2019-12-11 11:39:59
问题 I would like to build an application that manages appointments in Google calendar on behalf of my users when they are not logged in. The application would be a booking service, subscribing users (our service providers) would book out the times they are not available, and customers would see a free/busy representation of the service provider's google calendar The application would need the ability to create, delete, and read appointments. I have gone to the Google Developer's Console and have

zf2 navigation breadcrumbs paging

末鹿安然 提交于 2019-12-11 11:31:39
问题 Cannot find the right way to describe sitemap that works with breadcrumbs. For example i have a navigation described in module.config.php 'navigation' => array( 'default' => array( array( 'label' => 'Home', 'route' => 'home' ), array( 'label' => 'Articles', 'route' => 'articles', 'pages' => array( array( 'label' => 'Paging', 'route' => 'articles', 'id' => 'articles', 'pages' => array( array( 'label' => 'Page 1', 'route' => '1' ), array( 'label' => 'Page 2', 'route' => '2' ) ... ) ) ) ) ), ),

Zend Framework 2 - Wrapped form elements cause validation to fail

和自甴很熟 提交于 2019-12-11 11:23:57
问题 I'm using a form which contains wrapped elements. The wrapping happens in the view like described here. My action looks like this: $myForm = [definition here] $myForm->setName('entity'); $myForm->setWrapElements(true); $request = $this->getRequest(); if ($request->isPost()) { $myEntity = new Entity(); $myForm->bind($myEntity); $myForm->setData($request->getPost()->get('entity')); The problem: When calling $myForm->isValid() it's invalid. When calling $myForm->getData() afterwards it's empty.

Zend Framework 2 - Wrapping $this->content with another layout

*爱你&永不变心* 提交于 2019-12-11 11:18:28
问题 I am trying to create a wrapper for the $this->content of a specific Module. What I have is a main layout (All the modules will follow this layout) which builds the base layout with headers and footers, etc. These will stay the same across all the Modules. However I want to have modules with a custom layout for their body content. I.e. for custom nav bars, etc. So with the following structure: module / ModuleName / view / layout / modulelayout.phtml / modulename / index / index.phtml view /

Where should be stored the environment dependent configs in a Zend Framework 2 application?

耗尽温柔 提交于 2019-12-11 11:09:15
问题 A ZF2 application contains/nneds a lot of different config files: /config/application.config.php , /config/autoload/global.php , /config/autoload/local.php , /module/***/config/module.config.php . Now I've written a module, that covers the caching functionality for the application, and need different values for the livetime of its items in my local/dev and the live environment. I also would like to be able to switch the cache type dependent on the environment. Where should such stuff be sored

ZF2 : disable error page layout

偶尔善良 提交于 2019-12-11 11:07:25
问题 im trying to disable layout while showing error/exception page in my zf2 module but nothing works please help 回答1: Final Solution in my Module.php $eventManager = $e->getApplication()->getEventManager(); $eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR, function($e) { $result = $e->getResult(); $result->setTerminal(TRUE); }); it works and only loads error/404 view file not the layout file thanks andrew 回答2: If you look at the Zend Framework 2 MVC module you will see possibilities for this

ZF2 - How can i call a function of a custom class php from a view? [closed]

六月ゝ 毕业季﹏ 提交于 2019-12-11 10:41:15
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . i've created a custom service as php class ( ServiceClass ) with some functions ( generateInfo() ) and i'm looking for a way to call this function from other views thanks for help. 回答1: You can create your own View Helper namespace MyModule\View\Helper; use Zend\View\Helper\AbstractHelper; class