zend-framework3

View Helper Manager not accessible in Module Bootstrap using ZF3

Deadly 提交于 2019-12-23 15:07:23
问题 Using Zend Framework 2 I can access the ViewHelperManager doing this: public function onBootstrap(MvcEvent $e) $viewHelperManager = $e->getApplication()->getServiceManager()->get('viewHelperManager'); } This does not seem to work anymore in my Modules since starting a new project using Zend Framework 3 . Not quite sure what to do here. 回答1: The Services are uppercased in Zend Framework 3 apparently. $viewHelperManager = $e->getApplication()->getServiceManager()->get('ViewHelperManager'); var

How can I set up Lazy Loading with ZF3 (no ServiceLocator pattern from anywhere)

 ̄綄美尐妖づ 提交于 2019-12-23 12:59:54
问题 I am writing a new ZF2 app. I have noticed that ServiceLocator usage pattern of calling services "from anywhere" has been deprecated from ZF3. I want to write code in mind for ZF3. I was able to set up my Controller to call all dependencies at constructor time. But that means loading i.e. Doctrine object upfront before I need it. Question How do I set it up so that it is only loaded when I need it immediately? (lazy-loaded). I understand that ZF3 moves loading to Controller construction,

Zend framework not able to route the translated child routes

筅森魡賤 提交于 2019-12-23 10:12:03
问题 I am new to Zend framework 3 and was trying to translate the routes and i have partially succeeded.I am able to translate the main route and redirect it to the required location but for child routes the translation works but the redirection doesn't. can you please help me, my code is below. module.config.php 'router' => [ 'router_class' => TranslatorAwareTreeRouteStack::class, 'routes' => [ 'setting' => [ 'type' => Segment::class, 'options' => [ 'route' => '/{locale}/{setting}', 'defaults' =>

How to reduce the number of database connections in tests in PHPUnit and ZF3?

自古美人都是妖i 提交于 2019-12-23 07:27:23
问题 I'm writing integration/database tests for a Zend Framework 3 application by using zendframework/zend-test 3.1.0 , phpunit/phpunit 6.2.2 , and phpunit/dbunit 3.0.0 My tests are failing due to the Connect Error: SQLSTATE[HY000] [1040] Too many connections I set some breakpoints and took a look into the database: SHOW STATUS WHERE `variable_name` = 'Threads_connected'; And I've actually seen over 100 opened connections. I've reduced them by disconnecting in the tearDown() : protected function

How to reduce the number of database connections in tests in PHPUnit and ZF3?

六眼飞鱼酱① 提交于 2019-12-23 07:27:09
问题 I'm writing integration/database tests for a Zend Framework 3 application by using zendframework/zend-test 3.1.0 , phpunit/phpunit 6.2.2 , and phpunit/dbunit 3.0.0 My tests are failing due to the Connect Error: SQLSTATE[HY000] [1040] Too many connections I set some breakpoints and took a look into the database: SHOW STATUS WHERE `variable_name` = 'Threads_connected'; And I've actually seen over 100 opened connections. I've reduced them by disconnecting in the tearDown() : protected function

Zf3 controller not able to access the model class table located in another module

寵の児 提交于 2019-12-22 12:12:12
问题 I am new to Zend Framework. Is there a way to access the model class table which is located in another module from my active controller? As its bye bye service locator in ZF3 i am not able to access the model class table located in other modules. Previously in ZF2 controller private configTable; public function getConfigTable() { if (!$this->configTable) { $sm = $this->getServiceLocator(); $this->configTable = $sm->get('Config\Model\ConfigTable'); // <-- HERE! } return $this->configTable; }

Zf3 controller not able to access the model class table located in another module

梦想与她 提交于 2019-12-22 12:11:06
问题 I am new to Zend Framework. Is there a way to access the model class table which is located in another module from my active controller? As its bye bye service locator in ZF3 i am not able to access the model class table located in other modules. Previously in ZF2 controller private configTable; public function getConfigTable() { if (!$this->configTable) { $sm = $this->getServiceLocator(); $this->configTable = $sm->get('Config\Model\ConfigTable'); // <-- HERE! } return $this->configTable; }

Best way to build RESTful services using Zend Framework 3

时间秒杀一切 提交于 2019-12-22 08:05:21
问题 We are starting a new project that will make use of RESTful services to talk to web clients (AngularJS) and mobile platforms (Android and iOS). The idea is to hide the bussiness logic inside the RESTful services and to use the same code for both web client and mobile platforms. Our server is being built in PHP using Zend Framework 3 (I´m new to the framework). The application will be have dozen of entities with hundreds of services. I´ve noted on the web that is seems that ZF2 has a REST

ZF3 zend-mvc-skeleton internationalization not working

自古美人都是妖i 提交于 2019-12-22 06:38:04
问题 I'm trying to evaluate if it's already the right time to start moving to ZF3 (or keep developing my application with ZF2). Therefore, I installed the mvc-skeleton application and walked through the MVC tutorial (here) which worked perfectly until I got to the internationalization part. I installed the components (i.e. zend-i18n and zend-mvc-i18n component), created the translation files (i.e. en_US.mo and en_US.po) and copied them into my module/Application/language/ folder and added the

how to Make Http request from reactjs ?

坚强是说给别人听的谎言 提交于 2019-12-19 10:06:14
问题 I am using react js as front end and zf3 as a backend in my ToDo application. I put all my React folder and files in public folder of Zend project. As of now, it is just Simple app there is no database connection. Now I want to add Db for storing tasks. but as a newbie, I don't know how to make Http request for edit delete and add a task. please explain with a example. Any help will be appreciated. Thank you. 回答1: I use axios. It allows you to set some default configuration so that you don't