zend-framework2

How to use multiple versions at the same time in an Apigility app with Doctrine?

会有一股神秘感。 提交于 2019-12-23 13:24:29
问题 Context first: Apigility driven application based on Zend Framework 2. In the first version ( V1 ) I was using the ZfcBase DbMapper for the model layer. Now I'm implementing the V2 with Doctrine 2 as ORM. Apigility provides an easy switching between versions and every version can use its own DB adapter: /config/autoload/global.php / /config/autoload/local.php <?php return array( ... 'db' => array( 'adapters' => array( 'DB\\myproject_v1' => array( // settings (driver, hostname, database,

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,

404 The requested URL could not be matched by routing

心已入冬 提交于 2019-12-23 12:42:58
问题 I'd just started to learn zend-framework and following this user guide. I'm able to successfully install the zend skeleton application and moved on to the routing and controllers. But after completion of the tutorial I requested the url: http://zf2-tutorial.localhost/album in my browser and I'm getting 404 . I'd looked down into the comments where some people saying about changes in 'route' => '/album[/][:action][/:id]' needs to be 'route' => '/album[/:action][/:id]' but that doesn't help

Zend\Form: Call to a member function insert() on a non-object in Zend/Form/Fieldset.php

不羁的心 提交于 2019-12-23 11:56:42
问题 I am learning how to use Zend Framework 2 (2.1.4) forms and running into this error. Call to a member function insert() on a non-object in ... /Zend/Form/Fieldset.php on line 178 I don't want use the form to automatically connect to a database, in fact I only want to use the form to help validate and will pull from and populate it with an array of values. How do I turn off the database connectivity in the form objects? I am used to dealing with the ZF1 forms so this new form system is

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' =>

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

How to start using Doctrine 2 in an Apigility application with zf-apigility-doctrine?

一曲冷凌霜 提交于 2019-12-23 09:58:58
问题 I want to integrate the Doctrine 2 to an Apigility driven Zend Framework 2 application. So I installed zfcampus/zf-apigility-doctrine $ composer require zfcampus/zf-apigility-doctrine "~0.3" and activated the modules Phpro\DoctrineHydrationModule , ZF\Apigility\Doctrine\Server , and ZF\Apigility\Doctrine\Admin in the application config files ( /config/application.config.php and /config/development.config.php ). What should be done next to start using Doctrine in the application as general and

ZF2: Module could not be initialized

你说的曾经没有我的故事 提交于 2019-12-23 09:47:40
问题 I'm trying to get started with ZF2 and I have a problem when I writting code from tutorial (on ZF website). My code: Module.php: <?php namespace About; class About { public function getAutoloaderConfig() { return array( 'Zend\Loader\ClassMapAutoloader' => array( __DIR__ . '/autoload_classmap.php', ), 'Zend\Loader\StandardAutoloader' => array( 'namespaces' => array( __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, ), ), ); } public function getConfig() { return include __DIR__ . '/config

How to make username case insensitive in zf2

旧城冷巷雨未停 提交于 2019-12-23 08:57:18
问题 I used zf2 authentication for authenticate user in my project.I saved Harib in my user table as user name but if i use my user name Harib then its accept or if i use harib then its not accept,i want to remove case sensitivity of user name so both Harib or harib access how i fix this? Here is my code: public function loginAction() { $this->layout('layout/login-layout.phtml'); $login_error = false; $loginForm = new LoginForm(); $form_elements = json_encode($loginForm->form_elements); if ($this-

Zendframework 2. ID parameter in SQL query

﹥>﹥吖頭↗ 提交于 2019-12-23 06:06:31
问题 I kind of understand what is needed but I am new to ZF2 so just need pushing in the right direction. I currently have a route set up, for example, viewsystem/1 , which has the form [action][id] . When a person clicks on a link, they change their id, for example, viewsystem/5 . In the model where I run the SQL, I wish the id to change for the SQL statement: ->where('system.Id = "'.$id.'" ') Can anyone explain where I can "get" the parameter and use this as a variable in the SQL? Do I need to