zend-framework2

ZF2 module best practices

老子叫甜甜 提交于 2019-12-11 03:05:22
问题 What is the accepted best practice with the Zend Framework's new module system in version 2? Is it the intention that I create one module per controller for my application, or am I supposed to use the modules to group related controllers and their models together in some way? 回答1: See Rob Allens introduction into Modules or Matthews introduction into Modules. In Short: A module is simply a bunch of Classes that perform one specific task. I.E.: A Guestbook could be one Module. GuestbookMailing

A 404 error occurred Page not found Zend skeleton application

自古美人都是妖i 提交于 2019-12-11 02:59:07
问题 I have installed the skeleton application on my system. Its working development server. But when I run the code localhost I am receiving error following type error: A 404 error occurred Page not found. The requested URL could not be matched by routing. No Exception available © 2005 - 2015 by Zend Technologies Ltd. All rights reserved. 回答1: You must also ensure that Apache is configured to support .htaccess files. This is usually done by changing the setting: 1 AllowOverride None to 1

baseUrl view helper not working on ZendFramework 2

淺唱寂寞╮ 提交于 2019-12-11 02:40:27
问题 I'm testing with the new Zend Framework 2, and I found a problem when trying to use the baseUrl view helper, I'm getting the following error when calling $this->baseUrl() inside my phtml view file; Debug Error: C:\Zend\ZendServer\share\ZendFramework2\library\Zend\ServiceManager\ServiceManager.php line 424 - Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for baseUrl' in

$moduleManager->getEventManager()->getSharedManager()->attach is not working in stable zf2

空扰寡人 提交于 2019-12-11 02:38:38
问题 namespace Auth; use Zend\ModuleManager\ModuleManager; class Module { public function init(ModuleManager $moduleManager) { $sharedEvents = $moduleManager->getEventManager()->getSharedManager(); $sharedEvents->attach(__NAMESPACE__, 'dispatch', function($e) { echo "I am init module dispatch"; exit(); }, 100); } } $moduleManager->getEventManager()->getSharedManager()->attach() is working fine in ZF2 BETA5 but it is not working in stable final release. Has this functionality taken off in final

Zend Framework 2, Module Redirect

我的未来我决定 提交于 2019-12-11 02:38:18
问题 I have a function in my module.php with the following function which is called before everything else starts to load, it verifies that the user is logged on but I need it to redirect to the login page if the user is not logged in, I could just use "header" but I want to learn the "Zend" way of doing things. public function preDispatch($e) { if (!isset($_SESSION)) session_start(); $sm = $e->getApplication()->getServiceManager(); $adapters = $sm->get('dbAdapters'); if (!isset($_SESSION['auth'])

How do I send json data using Zend 2 http?

感情迁移 提交于 2019-12-11 02:35:35
问题 I've been struggling with this for a few days now - I need to send a set of data encoded in json to an api. I'm trying to use Zend 2 http to achieve this but I've had no luck so far. Here is what the manual for the api says : Bulk Create Contacts This command can be used to insert new numbers into your Textlocal contact groups and will allow you to insert extra fields such as the contact's name. Parameter Description group_id ID of the group you’d like to store the numbers in. This contacts A

ZF2 inputfilter doctrine NoObjectExists editing object does not validate

爱⌒轻易说出口 提交于 2019-12-11 02:27:11
问题 So i got a ZF2 application, got a Form and a InputFilter in the InputFilter i have: $this->add( array( 'name' => 'email', 'required' => true, 'validators' => array( array( 'name' => 'EmailAddress' ), array( 'name' => 'DoctrineModule\Validator\NoObjectExists', 'options' => array( 'object_repository' => $sm->get('doctrine.entitymanager.orm_default')->getRepository('YrmUser\Entity\User'), 'fields' => 'email' ), ), ), ) ); works great, however when i edit a existing object and save it the

Can't insert value to mapped column in Doctrine 2 in OneToOne relation

不羁岁月 提交于 2019-12-11 02:26:21
问题 I am quite new to Doctrine and need help in one situation. I have 2 simple tables Albums & Genre. Please check the structures below: Albums id | title | genre_id | createdon 1 | Album 1 | 1 | 21/05/2015 2 | Album 2 | 2 | 21/05/2015 Genre id | genre | active 1 | Pop | 1 2 | Blue | 1 3 | Rock | 1 4 | Country | 1 genre_id from Albums table is mapped to id column of Genre table. In Albums entity I have mapped this by the below process: /** * @ORM\OneToOne(targetEntity="Genre", mappedBy="albums")

zf2 + doctrine2 and No Metadata Classes to process

大城市里の小女人 提交于 2019-12-11 02:23:45
问题 I'm using tutorial http://www.nuvolia.com/2013/03/09/zend_framework_doctrine_install/. The module Application fork fine with Doctrine ORM but when i'm tring to connect in another module i'm reciving error: d:\Aptana Studio\Projects\app01>vendor\bin\doctrine-module orm:schema-tool:create Deprecated: "Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Qu estionHelper" instead. in D:\Aptana Studio

zf2 way to set up a navigation bar

女生的网名这么多〃 提交于 2019-12-11 02:22:02
问题 I'm struggling to connect the dots between the ZF1 way of initializing things in a bootstrap, and the ZF2 way of injecting things from a config file (seemingly). To wit, in ZF1, I had something like this in my boostrap: protected function _initNavigation() { $this->bootstrap('layout'); $this->bootstrap('view'); $navigation = new Zend_Navigation(); // ...code to add pages... $layout = $this->getResource('layout'); $view = $layout->getView(); $view->navigation($navigation); } In ZF2, I'm not