zend-framework2

What's the best option to have language switcher in my ZF2 system?

百般思念 提交于 2019-12-08 10:14:05
问题 I have developed small ZF2 doctrine system for one of my client. All is good so far, but they require the system in 2 languages. I can set default language as english or another language from my module/Application/config/module.config.php 'translator' => array( 'locale' => 'en_US', 'translation_file_patterns' => array( array( 'type' => 'gettext', 'base_dir' => __DIR__ . '/../language', 'pattern' => '%s.mo', ), ), ), And I also can use this method to set default in module.php public function

example working config for Doctrine ODM zf2 Module? [closed]

你离开我真会死。 提交于 2019-12-08 09:58:25
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . can anyone please provide an example of driver configuration for reading annotation of documents in Application/src/Application/Document/.... created this but still doctrine-module odm:schema:create said all

ZF2 Configuration Injection Or NOT?

可紊 提交于 2019-12-08 09:45:46
问题 I've googled a lot and read as much as I can on the subject but I cannot find a direct answer to my question anywhere including here. My ZF2 application consists of roughly 7 different modules. 5 of the modules will need access to the same database configuration. The application itself has a database with roughly 124 different tables. So the idea here is to find the proper solution to write the least amount of code considering the setup. What I'm trying to do is create a specific class to

how to forced https instead of http after user login in zend framework2

五迷三道 提交于 2019-12-08 09:37:24
问题 I want user redirect to https insetad of http just after login in my new website made in zend framework2. please help. I there any method available in zend freamework2 to get current used protocol(http or https). 回答1: You can redirect the user to the https version of a page inside the application. Above solution simply redirects all requests to it's http variant, and only for Apache. I would rather do it inside the application (then you're more in control) and make it server agnostic (what

ZF2 InputFilter not validating fieldset

天大地大妈咪最大 提交于 2019-12-08 09:25:41
问题 i use the following fieldset for grouping information: <input type='text' name='personal[firstname]'> <input type='text' name='personal[lastname]'> Now i want to use an InputFilter to validate the form, but nothing happens: class CustomerFilter extends InputFilter /** * Build filter */ public function init() { $this->add(array( 'name' => 'personal[firstname]', 'required' => true, 'filters' => array( array('name' => 'StringTrim'), array('name' => 'StripTags'), ), 'validators' => array( array(

ZendFatal error: Class 'Zend\Ldap\Ldap' not found

独自空忆成欢 提交于 2019-12-08 08:26:32
问题 So, i'm trying to make a Ldap authentication, following the docs in https://zf2.readthedocs.org/en/latest/user-guide/skeleton-application.html I just replace the 'Album' module with a 'Auth' module and use the sample code for Ldap autentication https://zf2.readthedocs.org/en/latest/modules/zend.authentication.adapter.ldap.html but i'm getting this error where Zend can't find the Ldap class when i submit the form with the login data. Fatal error: Class 'Zend\Ldap\Ldap' not found in C:\wamp\www

Using ZF2 Oauth2

依然范特西╮ 提交于 2019-12-08 07:48:53
问题 I'm trying to get https://github.com/zfcampus/zf-oauth2 working with my Application (mainly because I have installed apigility and zf-oauth2 comes with it). I'm reading the very last section and it says to protect, I just simply use the following code (for instance, at the top of a controller): if (!$this->server->verifyResourceRequest(OAuth2Request::createFromGlobals())) { // Not authorized return 401 error $this->getResponse()->setStatusCode(401); return; } // where $this->server is an

How to use Zend Framework 2 with MS SQL Server on *nix?

元气小坏坏 提交于 2019-12-08 07:16:30
问题 What, if it exists, is the canonical way to use ZF2 with MS SQL Server on a non-Windows OS? From what I can tell from the documentation, only the Sqlsrv driver is officially supported, which only works on the Windows platform. In ZF1, we used the Pdo_Mssql adapter and specified the pdoType as dblib . I can't find any references to doing anything similar in ZF2. Apparently there was a Pdo\Mssql driver some time ago which was removed during a major refactoring, but I don't see a currently

Create an instance of Url View Helper in another ViewHelper

核能气质少年 提交于 2019-12-08 07:00:43
问题 In my project i created a Helper to display a-tags, but with an additonal check, if the user has ACL rights. When he has access to the url, i want to create the Url with the existing UrlHelper - but i can't instantiate it: // try 1 $pluginHelper = \Zend\Mvc\Service\ViewHelperManagerFactory::createService($this->getServiceLocator()); $this->_urlHelper = $pluginHelper->get('url'); // try 2 $factory = new \Zend\Mvc\Service\RouterFactory(); $router = $this->_urlHelper = $factory->createService(

ZF2: where do I store partialLoop template files?

心不动则不痛 提交于 2019-12-08 06:26:27
问题 Does anyone know where to store a ZF2 partial loop template file? I have template stored in the relevant view folder under a standard Zend file structure. This worked under ZF1. But on trying to re-factor code to work with ZF2 I get this error? Fatal error: Uncaught exception 'Zend\View\Exception\RuntimeException' with message 'Zend\View\Renderer\PhpRenderer::render: Unable to render template "listingsPartial.phtml"; resolver could not resolve to a file' in C:\zendProject\zf2\vendor